Created
May 6, 2010 15:23
-
-
Save jankeesvw/392254 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package nl.application.view.components.battlepage { | |
import nl.application.model.vo.BattleData; | |
import nl.debit.flash.swf.SWF; | |
import nl.debit.flash.swf.events.SWFEvent; | |
import nl.debit.flash.video.FLV; | |
import nl.debit.flash.video.events.VideoEvent; | |
import flash.display.Loader; | |
import flash.display.LoaderInfo; | |
import flash.display.MovieClip; | |
import flash.display.Sprite; | |
import flash.events.Event; | |
/** | |
* @author Jankees van Woezik | Base42.nl | |
*/ | |
public class BattleVideoPlayer extends Sprite { | |
public function BattleVideoPlayer() { | |
} | |
public function playBattle(inBattle:BattleData):void { | |
var flv:FLV = new FLV(); | |
flv.addEventListener(VideoEvent.COMPLETE, flvReady); | |
flv.loadVideo("../flv/test.flv"); | |
} | |
private function flvReady(event:VideoEvent):void { | |
var flv:FLV = event.target as FLV; | |
var swf:SWF = new SWF(); | |
swf.addEventListener(SWFEvent.COMPLETE, placeSWF); | |
swf.addVideo(flv, 1, 0, 0); | |
swf.render(); | |
} | |
private function placeSWF(event:SWFEvent):void { | |
var swf:SWF = event.target as SWF; | |
var l:Loader = new Loader(); | |
l.contentLoaderInfo.addEventListener(Event.COMPLETE, handleLoaderComplete); | |
addChild(l); | |
l.loadBytes(swf.bytes); | |
} | |
private function handleLoaderComplete(event:Event):void { | |
var movie:MovieClip = MovieClip(MovieClip(LoaderInfo(event.currentTarget).loader.content).getChildAt(0)); | |
addChild(movie); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment