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

x
?
Solved

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

Posted on 2009-07-09
14
Medium Priority
?
395 Views
Last Modified: 2013-11-11
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

0
Comment
Question by:pda4me
  • 7
  • 6
14 Comments
 
LVL 22

Expert Comment

by:rascalpants
ID: 24817653

put a stop(); command on the frame.


rp
0
 

Author Comment

by:pda4me
ID: 24817951
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.
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 24818104
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
0
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!

 

Author Comment

by:pda4me
ID: 24818163
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.
0
 
LVL 22

Assisted Solution

by:rascalpants
rascalpants earned 400 total points
ID: 24818342
0
 

Accepted Solution

by:
pda4me earned 1600 total points
ID: 24822141
Thanks for the attempt but that is essentially the same code I provided.  This is what ended up working for me, you will notice the stop(); and gotoplay(2) that ended up being added that did the trick.
stop();
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();
gotoAndPlay(2);
}
 
my_FLVPlybk.addEventListener("progress", listenerObject);
my_FLVPlybk.load("final.flv");

Open in new window

0
 
LVL 22

Expert Comment

by:rascalpants
ID: 24823232
ahhh, I must have misread the question then...

glad you figured it out...



rp
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 24823456
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
0
 

Author Comment

by:pda4me
ID: 24823678
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!
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 24823794
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
0
 

Author Comment

by:pda4me
ID: 24823843
Sounds good thanks.  How long has AS3 been around?  Is there anything new (AS4?) coming on the horizon soon?
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 24824062
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
0
 

Author Comment

by:pda4me
ID: 24824090
cool, thanks for the info!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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 how to how to record live broadcast.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

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