Forked from: northprint's Progression Command Test diff:1 forked from: Progression Command Test Progression 俺俺コマンド Test jakeno forked:1favorite:0lines:90license : All rights reserved modified : 2009-02-25 15:13:02 Embed Tweet // forked from northprint's Progression Command Test // write as3 code here.. // Progression 俺俺コマンド Test package { import flash.display.Sprite; import jp.progression.commands.*; public class Prog_test2 extends Sprite { public function Prog_test2(){ var sList:SerialList = new SerialList(); sList.addCommand( new PlayMovie(this, "http://narayama.heteml.jp/movie/P1020474.flv", 400, 300, true) ); sList.execute(); } } } import jp.progression.commands.*; import jp.progression.core.commands.Command; import flash.display.DisplayObjectContainer; import flash.events.NetStatusEvent; import flash.media.Video; import flash.net.NetConnection; import flash.net.NetStream; import caurina.transitions.Tweener; class PlayMovie extends Command{ private var _movieURL:String; private var _movieWidth:uint; private var _movieHeight:uint; private var _connection:NetConnection; private var _netStream:NetStream; private var _obj:Object; private var _movieObj:Video; private var _movieContainer:DisplayObjectContainer; private var _waitForComplete:Boolean = false; public function PlayMovie(container:DisplayObjectContainer = null, movieURL:String = null, movieWidth = 0, movieHeight = 0, waitForComplete:Boolean = false, initObject:Object = null ){ _movieURL = movieURL; _movieWidth = movieWidth; _movieHeight = movieHeight; _movieContainer = container; _waitForComplete = waitForComplete; super( _execute, _interrupt, initObject ); } //MOVIEの状態 private function onMovieProgress (event : NetStatusEvent) { if (event.info.code == "NetStream.Play.Stop"){ if ( _waitForComplete ) { executeComplete(); } //ムービーが終わったらフェードアウトする Tweener.addTween(_movieObj,{ alpha:0,time:1,onComplete:endExec}); } } //イニシャライズ処理 private function initStream():void { _netStream = new NetStream(_connection); _movieObj = new Video(); var customClient:Object = new Object(); _netStream.client = customClient; //指定されたコンテナの表示リストに追加 _movieContainer.addChild(_movieObj); //幅、高さ設定 _movieObj.width = _movieWidth; _movieObj.height = _movieHeight; _movieObj.attachNetStream(_netStream); //再生 _netStream.play(_movieURL); _netStream.addEventListener(NetStatusEvent.NET_STATUS, onMovieProgress); //ムービー完了待ちをするかどうか if ( _waitForComplete ) { return; } executeComplete(); } //終了処理 private function endExec():void { if (_movieObj) { if ( _waitForComplete ) { _netStream.removeEventListener(NetStatusEvent.NET_STATUS , onMovieProgress); } _movieContainer.removeChild(_movieObj); _movieObj = null; _netStream.close(); _netStream = null; _connection = null; } } private function _execute():void{ //長いムービーだとタイムアウトになるから timeOut = 0; //初期処理 _connection = new NetConnection(); _connection.connect(null); initStream(); } private function _interrupt():void{ endExec(); // 中断処理を終了します interruptComplete(); } public override function clone():Command{ return new PlayMovie( _movieContainer,_movieURL,_movieWidth,_movieHeight,_waitForComplete,this ); } } Code Fullscreen Preview Fullscreen NetStatusEvent.NET_STATUS executeComplete SerialList alpha width close clone attachNetStream height removeEventListener client play addEventListener timeOut NetStream interruptComplete addCommand Command Object Video sort new page view favorite forked pv180 forked from: forked from: Prog.. hacker_mdkhktcb forked:0 favorite:1lines:90 (diff:1)