I’m tyring to make a gallery of video work and having some trouble. I’ve created external SWF’s of the actual videos/players and I’m just trying to load them on click into my current project. Ont first attempt the code worked,but the SWF’s would keep loading on top of each other. Not good, but at least the videos loaded and everything played.
So, I went online and learned how to add the listener to detect the containers children and remove them. That seemed to work and the SWF’s now replace each other, but the FLV’s contained in the SWF’s are not loading.
The player skins and graphics show up, so I know the basic code is working correctly, but there are no videos?
Here’s the code I’m using…
import flash.display.*;
import flash.net.URLRequest;
var container:MovieClip;
var ldr:Loader = new Loader();
button1.addEventListener(MouseEvent.MOUSE_DOWN, newvid1);
button2.addEventListener(MouseEvent.MOUSE_DOWN, newvid2);
function newvid1(event:MouseEvent) {
var url:String = “movie1.swf”;
var urlReq:URLRequest = new URLRequest(url);
ldr.load(urlReq);
ldr.contentLoaderInfo.addEventListener(Event.INIT, loaded);
}
function newvid2(evt:MouseEvent):void {
var url:String = “movie2.swf”;
var urlReq:URLRequest = new URLRequest(url);
ldr.load(urlReq);
ldr.contentLoaderInfo.addEventListener(Event.INIT, loaded);
}
function loaded(evt: Event):void {
if(container.numChildren > 0){
container.removeChildAt(0);
}
container.addChild(evt.target.content);
}
Anyone else run across this?