상세 컨텐츠

본문 제목

플래시 as3.0 액션스크립트 swf 를 로드시 현재 자신이 만든 Children 을 변수로 지정해 두기

ADOBE

by AlrepondTech 2013. 5. 20. 11:21

본문

반응형

 

 

 

=================================

=================================

=================================

 

 

 

 

 

 

 

출처: http://202psj.tistory.com/

//swf 에 자신이 만든 프레임 객체 contents를 찾아서 변수로 두어서 컨트롤 할때.

 

 

private var _loader:Loader = null;

private var _loadedSwf:MovieClip;

private var _contents_Mc:MovieClip = null; //현재  swf 안에 동영상 안에 재생되고 있는 무비 클립

 

 

 

public function loadSwf(address:String):void

{

var request:URLRequest = new URLRequest(address); 

_loader = new Loader();

 

var linkFn:Function = function (e : Event) : void

{

_loadedSwf = onLoadComplete(e) as MovieClip;

};

_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, linkFn);

_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, fProgress);

 

_loader.load(request);

}

 

 

 

    private function onLoadComplete (e : Event) : DisplayObject

{

trace("Load Complete!!!");

출처: http://202psj.tistory.com/

                        _loadedSwf = e.target.content as MovieClip;

_move.addChild(_loadedSwf);

//Children 을 for으로 불러내어 contents 이름을 같은 객체를 찾아낸다.

for(var n:int=0; n<_loadedSwf.numChildren; n++)

{

_contents_Mc = _loadedSwf.getChildAt(n) as MovieClip;

 

if(_contents_Mc != null)

{

                                        //현재 객체의 이름이 맞은면 break; 출처: http://202psj.tistory.com/

if(_contents_Mc.name.indexOf("contents") != -1)

{

break;

}

}

}

 

_contents_Mc.addEventListener(Event.ENTER_FRAME, 

function f():void

{

if( _contents_Mc.totalFrames <= _contents_Mc.currentFrame)

{

frameEnd();

}

});

 

_btn_fullscreen_on.setVisible(true);

 

setLoadingShow(false);

 

passOk(); //출처: http://202psj.tistory.com/

 

return e.target.content;

}

 

 

=================================

=================================

=================================

 

 

 

 

반응형


관련글 더보기

댓글 영역