Solved

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

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

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

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…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
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…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

622 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