Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

setVariable from external .js - fix this and i give you all my points

Posted on 2002-03-24
3
Medium Priority
?
182 Views
Last Modified: 2008-02-26
i am debugging somebody's flash/javascript/active x mess.
i don't use flash do program so here goes:

I want to setVariable() from a external javascript function referenced by the html doc containing the flash movie. when the variable is set to 1, i want to move form the loading screen to the rest of the movie:

in frame 2 i have the following script:

//declare variable
var cabIsloaded;
//check for full movie load
ifFrameLoaded(60) {

//send command to function in external .js
fscommand ("Get('audioPathLoaded');");

//check to see if the js function has set the variable
if (cabIsloaded == 1)  {
gotoAndPlay("init");]
]

-----------------------
In the js file
the name/id tag = ws & javascript function is:
-----------------------
function Get(str) {

     if (str == "audioPathLoaded" ) {
     isLoaded = (isNS) ? document.Ctrl.Get (str) : Ctrl.Get(str);

          if (isLoaded == 1) {
          window.document.ws.SetVariable("isCabLoaded", "1");
     
}
}
}


i'll give anyone who fixes this all of my points
0
Comment
Question by:antonumia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 3

Expert Comment

by:jeffbeasley
ID: 6897205
Just briefly examining your code I don't see a condition that if movie is not loade do this....
ex...
//your frame 2
ifFrameLoaded(60) {
.....
.....
.....

//else go to and play 1
else {
GotoAnPlay(1);
}

This will continue to loop till you get frames loaded

I may have mis understood your question or dilemna

let me know,
Jeff
0
 
LVL 3

Expert Comment

by:jeffbeasley
ID: 6897209
Also if performing an fscommand that requires a response set up a loop within your frames to wait for response

ex...
//frame a
response=Null;
fscommand ("Get('audioPathLoaded');");

//frame b
play();

//frame c
if (response!=null){
....
//manipulate data

}else{
gotoAndPlay("frame b");
}
0
 
LVL 3

Accepted Solution

by:
jeffbeasley earned 390 total points
ID: 6897220
Flash executes its code in frames without executing all of the components before the code below (this is sporatic within flash..)
for example if in
frame 1 I perform this
a=true;
if(a){
stop;
}else{
play();
}

this may fail to function but if I
do this
//frame 1
a=true;
//frame 2
if(a){
stop;
}else{
play();
}
this will work all the time
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question