In as3 can we dynamically load .swf movies in any player(in web) like flv player?
I want to dynamically load .swf file in a player(like FLV player of as3) in as3.When I shall click on an image the corresponding video will be played on the player on right side(like you tube). Is there something (like FLV player) for .swf files with play, pause, resume, scrubber options to play in web? 开发者_StackOverflow社区
You can start with AS3's Loader Class, which will allow you to load and place SWF files in your application.
Controlling the loaded swf's position is going to be a bit trickier, and you may need to have a Movie Clip with a specific linkage name in the .swf, from which you can create an instance in your code and control with the standard MovieClip timeline commands. You should be able to create some controls that work with gotoAndPlay/gotoAndStop/etc
There are a lot of AS3 video players out there. Here is a tutorial that lets you create one. Once you create your FLVPlayer, you can load it using a Loader
object.
I think this does what you are looking for.
var SWFLoader:Loader=new Loader();
screen_mc.addChild(SWFLoader);
function loadSWF(evt:MouseEvent):void{
if (evt.target==one_btn){
SWFLoader.load(new URLRequest("one.swf"));
}
else if (evt.target==two_btn){
SWFLoader.load(new URLRequest("two.swf"));
}
}
one_btn.addEventListener(MouseEvent.CLICK,loadSWF);
two_btn.addEventListener(MouseEvent.CLICK,loadSWF);
精彩评论