Solved

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

Posted on 2009-07-09
14
388 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
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 

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 100 total points
ID: 24818342
0
 

Accepted Solution

by:
pda4me earned 400 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
3D rotation for a product 3 340
Does Flash have a Firefox problem? 5 315
Rotating Adobe pdf document 4 313
Why is this simple, masked Flash animation flickering? 20 194
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

777 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