Solved

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

Posted on 2009-07-09
14
387 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Video sharing with user login 3 197
bandwidth 5 67
Can not play videos on sciencechannel.com in Chrome 13 111
Some You tube not working in IE11 on Windows 10 and 8.1 5 57
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 …
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
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): …
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…

914 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now