Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2002-03-24
3
Medium Priority
?
184 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
  • 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

Industry Leaders: 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

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

972 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