Skip to main content
Inspiring
September 2, 2011
Answered

Multiple FLVs loaded properly

  • September 2, 2011
  • 1 reply
  • 1584 views

Ok,

On my main timeline i have some buttons. When you click a button you are diverted to the a frame label on the main timeline.

When the timeline stops at say frame 2 an flv is loaded into an empty movie clip on the main stage.  If you click on button 2, same thing. So in total I have about four FLV's that play when a button is pushed. If i keep clicking my buttons to test the smoothness of my flv's, after about three clicks from navigating between my frames/loaded flvs, my entire main movie becomes slower.

Each FLV is about 5mb.

Below is the code that gets initated when I click my button and am taken to that frame. My question is this, if i'm jumping between FLV's at every button click is the FLV that played first still playing and causing the entire main movie to slow down? Is there a better way to manage this? Do I have to unload the movie being played when i click? I'm trying to see if there an more efficient way to have smooth streaming from my flv. The flv that is getting initated is simply looping when it's done and servers a 'moving background'.

is there something else i can implement into my code that will keep my loaded flv's playing smoothly? Thanks,

this is the code on the main timeline that loads my external swf that will load the FLV

var myLoader:Loader = new Loader();
addChild(myLoader);
var url:URLRequest = new URLRequest("theexternal.swf");
myLoader.load(url);

This is the code that resides in the external SWF that will initiate the FLV.

import fl.video.*;

function onFLVComplete(event:VideoEvent):void {
      event.target.play();
}

swl.addEventListener(VideoEvent.COMPLETE, onFLVComplete);

This topic has been closed for replies.
Correct answer Asesino
How does the code look if i want to unload the physical movie that i created called 'night_mov'

You cannot unload a movie unless it has been loaded externally using Loader class.


after trial and error i have the winning code and solution. My action script was residing inside the physical movie clip i created that was loading my external swf. I decided to try and bypass this and put the code on the main timeline of the main swf and it worked! Thanks for assiting me everyone.


var myrequest2:URLRequest = new URLRequest("external.swf")

var myloader2:Loader = new Loader();
myloader2.load(myrequest2);
stage.addChild(myloader2);
myloader.unloadAndStop();

1 reply

Community Expert
September 2, 2011

Have just one FLVPlayback in one frame and load different FLV into it on button click - why you need separate frames?

AsesinoAuthor
Inspiring
September 2, 2011

How do I load the FLV's into a single player?

On the main time line frame 2 is 'menu 2' a swf will load along with the flv. How do i tell the flv player to play the corresponding flv?

Community Expert
September 2, 2011

You can use the "source" property:

flvPlaybackInstance.source = "some-flv.flv";

However if FLV needs to be part of your external SWF then this is probably more suitable advice - use "Loader.unloadAndStop()" before you load a new SWF:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Loader.html#unloadAndStop%28%29