개발관련(Development)/플랙스(Flex), 에어(AIR)
패키지 내부 파일 로드하기 경로
Clack
2013. 10. 23. 18:33
Source path에 assets 폴더를 추가했을 경우
assets 폴더 밑에있는 경로부터 URL에 입력
public class testClip extends Sprite { private var swfLoader: Loader; public function testClip() { super(); swfLoader = new Loader(); swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onSwfLoaded ); var loaderContext: LoaderContext = new LoaderContext( false, ApplicationDomain.currentDomain, null ); swfLoader.load( new URLRequest( "guestLogin/guestLoginSkin.swf"), loaderContext ); } private function onSwfLoaded( e:Event ): void { trace("load Complete "); var btn: MovieClip = swfLoader.content[ "guestLoginBtn" ]; this.addChild( btn ); } }
src 폴더에 assets 폴더를 추가했을 경우
assets 폴더 부터 URL에 입력
public class testClip extends Sprite { private var swfLoader: Loader; public function testClip() { super(); swfLoader = new Loader(); swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onSwfLoaded ); var loaderContext: LoaderContext = new LoaderContext( false, ApplicationDomain.currentDomain, null ); swfLoader.load( new URLRequest( "assets/guestLogin/guestLoginSkin.swf"), loaderContext ); } private function onSwfLoaded( e:Event ): void { trace("load Complete "); var btn: MovieClip = swfLoader.content[ "guestLoginBtn" ]; this.addChild( btn ); } }