Solved

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

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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 last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

821 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