// Generated by Gadget Utils @ Mon Jan 6 15:09:05 GMT+0000 2014 package { import com.worldvds.gadgets.events.GadgetEvent; import com.worldvds.gadgets.VDSGadget; import com.worldvds.gadgets.models.XMLDataParser; import com.worldvds.gadgets.components.AdaptableText; import com.worldvds.gadgets.controlers.GadgetControl; import com.worldvds.gadgets.models.DataCollection; import com.worldvds.gadgets.models.FileObject import flash.display.*; import flash.external.*; import flash.system.* import flash.net.URLRequest; import flash.events.*; import flash.events.TimerEvent; import flash.utils.Timer; public class omxvideoplayer extends VDSGadget { public static const GAD_WIDTH:Number = 1280; public static const GAD_HEIGTH:Number = 720; public var currentmonitorvideo:String; public var monitorVideo:Timer; public function omxvideoplayer(){ super(); _name = "OMX VIDEO Player"; _version = "v1"; _author = "VS" usesDynamicTime = true; selfCrop = true; // mascara para elementos offstage monitorVideo = new Timer(1000, 99999); monitorVideo.addEventListener(TimerEvent.TIMER, onTick); Debug.text = "\n"+Debug.text + "ANIENTRA "; postInitFunction = onInit; playFunction = aniEntra; ginfo = ; gdata = null; /* <![CDATA[[0] Título numero um.]]> <![CDATA[[1] Título Numero dois.]]> test(GAD_WIDTH, GAD_HEIGTH); // */ } protected function playomxvideo(videofile:String , x:int, y:int , w:int, h:int, loop:String){ //-------------------- // Aqui vamos lancar - //-------------------- Debug.text = Debug.text +"\n"+"_playomxmovie:"+videofile+","+x+","+y+","+w+","+h; ExternalInterface.call("_playomxmovie",videofile,x,y,w,h,loop); } protected function stopallomxvideos(){ //--------------------------------- // Vamos desligar todos os videos - //--------------------------------- ExternalInterface.call("_stopallomxmovies"); } protected function checkomxvideoplaying():Boolean{ //------------------------------------------------------------ // Vamos verificar se o video esta a tocar ou se ja terminou - //------------------------------------------------------------ var playling:Boolean = ExternalInterface.call("_getmoviestatus",currentmonitorvideo); return playling } protected function onInit():void { //parse data if (gdata != null) { var parser:XMLDataParser = new XMLDataParser(this); parser.parse(); } } protected function aniEntra():void { var videofileo:FileObject; videofileo = GadgetControl.getGlobalVariable("videofile"); Debug.text = "\n"+Debug.text + "ANIENTRA "+videofileo.path playomxvideo(videofileo.path,0,0,GAD_WIDTH,GAD_HEIGTH,"false") currentmonitorvideo = videofileo.path monitorVideo.start(); } protected function onTick(event:TimerEvent):void { // Tivemos um TICK vamos verificar se o video ainda roda if(!checkomxvideoplaying()){ //------------------------------------------------- // Video chegou ao final vamos terminar o TIMER // Vamos chamar o proximo video //------------------------------------------------- //Debug.text = Debug.text +"\n"+ "ONTICK STOP RECEIVED "; monitorVideo.stop(); stopallomxvideos() GadgetControl.signalEnd(); } } protected function unload():void { return; } } }