Link to home
Start Free TrialLog in
Avatar of pda4me
pda4me

asked on

Actionscript 2.0 Stop frames from advancing until video is loaded in Flash CS3

I am using the following actionscript 2.0 on the first frame of my flash movie to not play the .flv until its 50% loaded.  This works great but the rest of the movie advances as that preloads.  How do I stop the advance of the flash movie as well until the .flv loads 50%?  

Can anyone update the actionscript below to also stop the advance of the flash movie please so I can see how its done?  FYI, I plan on having a movie clip on another layer saying LOADING... while this runs...
import mx.video.*;
 
var listenerObject:Object = new Object();
 
my_FLVPlybk.progressInterval = 001;
my_FLVPlybk.autoPlay = false;
 
listenerObject.progress = function(eventObject:Object) :Void {
 
var perc = Math.floor(eventObject.bytesLoaded * 100 / eventObject.bytesTotal);
//implement you loading visual representation here
 
if(perc == 50)
my_FLVPlybk.play();
 
}
 
my_FLVPlybk.addEventListener("progress", listenerObject);
my_FLVPlybk.load("final.flv");

Open in new window

Avatar of rascalpants
rascalpants
Flag of United States of America image


put a stop(); command on the frame.


rp
Avatar of pda4me
pda4me

ASKER

close, but that essentially stops the advance of the movie for good.  I think I need to adjust the code to stop and then play once its loaded.
oh, I guess i didnt' see that part of the question...

you need to add a new event listener...  


listenerObject.complete = function(eventObject:Object) :Void {
 
  my_FLVPlybk.play();
 
}
 
my_FLVPlybk.addEventListener("complete", listenerObject);



rp
Avatar of pda4me

ASKER

I already have this in my original actionscript to a degree, I don't see where this will advance the frames?  I pasted this in, left the stop(); on the first frame and it did not work?  Can you send me what you mean in a sample using a updated version of my actionscript?

Thanks for your help.
SOLUTION
Avatar of rascalpants
rascalpants
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ahhh, I must have misread the question then...

glad you figured it out...



rp
yeah, that is what I did...   the question title threw me off...

"Actionscript 2.0 Stop frames from advancing until video is loaded in Flash CS3"

I must have had that stuck in my brain... and ignored the 50% part.


rp
Avatar of pda4me

ASKER

Cool, thanks.  Will do on assign points in the future.  Getting back into flash from a long hiatus (version 4.0) and I am going to need some support, so much has changed but for the better...so much more you can do with flash now!
yep, and I would highly recommend just jumping directly into AS 3.  Don't learn a programming model that is no longer the standarc (AS 2.0)

good luck

rp
Avatar of pda4me

ASKER

Sounds good thanks.  How long has AS3 been around?  Is there anything new (AS4?) coming on the horizon soon?
I think about 1.5 years now...  I can't imagine Adobe rewriting the framework yet again, because it has had some significant improvements, and is much more like Java now.  Maybe in a year or so they will add some functionality and classes, but I don't forsee a complete switch in programming methodology any time soon.




rp
Avatar of pda4me

ASKER

cool, thanks for the info!