Solved

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

Posted on 2002-03-24
3
176 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 130 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
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 how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now