Solved

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

Posted on 2009-07-09
14
391 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
[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
  • 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Title # Comments Views Activity
How do I change text in a Flash (FLA, SWF) file? 3 1,078
free flash maker 5 223
Where to download Acrobat flash offline installer? 2 271
Shockwave Flash Object within PowerPoint 2013 2 181
This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
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,…
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…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
Suggested Courses

752 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