I’m using bulkLoader to load my mp3 and flv files (thanks to dawsonk for hooking me up with the answer there), and now I need to be able to play/pause and jump ahead and back in the movie that I loaded, but I can’t figure out how to reference it??
Also, when I go to load another movie/audio from a button click, do I need to do anything with the old instance, or will flash take care of that??
Here’s the class:
package{
import br.com.stimuli.loading.BulkLoader;
import br.com.stimuli.loading.BulkProgressEvent;
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.net.*;
public class SimpleExampleMain extends MovieClip{
public var loader : BulkLoader;
public var v : Video;
public var counter : int = 0;
public var mp3:String;
public var flv:String;
public function SimpleExampleMain(mp3,flv) {
loader = new BulkLoader("main-site");
loader.logLevel = BulkLoader.LOG_VERBOSE;
loader.add(flv, {maxTries:6, id:"the-video", pausedAtStart:true});
loader.add(mp3, {"id":"soundtrack", maxTries:1, priority:100});
loader.addEventListener(BulkLoader.COMPLETE, onAllItemsLoaded);
loader.addEventListener(BulkLoader.PROGRESS, onAllItemsProgress);
loader.start();
}
public function onAllItemsLoaded(evt : Event) : void{
var video : Video = new Video();
var theNetStream : NetStream = loader.getNetStream("the-video");
trace("theNetStream "+theNetStream);
addChild(video);
video.attachNetStream(theNetStream);
theNetStream.resume();
video.y = 300;
var soundtrack : Sound = loader.getSound("soundtrack");
soundtrack.play();
}
public function onAllItemsProgress(evt : BulkProgressEvent) : void{
trace(evt.loadingStatus());
}
}
}
here’s how I’m loading it:
var mp3:String="audioFile.mp3";
var flv:String="videoFile.flv";
var se:SimpleExampleMain=new SimpleExampleMain(mp3,flv);
addChild(se);
and here are my button functions:
public function audioStop(e:Event):void {
//this is how I was doing it when I used flvComponent
//video_mc.stop();
//this is what I tried, but it gives errors because theNetStream is declared in a different class/function...I think...
//theNetStream.stop();
//this is what I was using for the sound previously
//pausePoint=channel.position;
//channel.stop();
isPlaying=false;
}
public function nextScreen(e:Event):void {
mp3="newfile.mp3";
flv="newfile.flv";
//just needs to call bulkLoader again but I'm not sure if I need to delete the old items, can I just do:
var se:SimpleExampleMain=new SimpleExampleMain(mp3,flv);
addChild(se);
}
THANKS!!!