Flex 리소스, Skin 등의 파일을 로드하고 객체를 동적으로 생성
3345 단어 Flex
private var symbolLoader:Loader = null;
private var symbolRequest:URLRequest = null;
private function loadTeamSymbol():void{
symbolLoader = new Loader();
symbolLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, symbolLoader_CompleteHandler);
symbolRequest = new URLRequest(SourceImagesPath.teamSymbolPath + "teamSymbol.swf");
var loaderContext:LoaderContext = new LoaderContext(true);
loaderContext.applicationDomain = ApplicationDomain.currentDomain;
symbolLoader.load(symbolRequest, loaderContext);
}
private function symbolLoader_CompleteHandler(event:Event):void{
//var teamSymbolClass:Class = getDefinitionByName("TeamSymbol") as Class;
//var teamSymbolClass:Class = ApplicationDomain.currentDomain.getDefinition("TeamSymbol") as Class;
var teamSymbolClass:Class = symbolLoader.contentLoaderInfo.applicationDomain.getDefinition("TeamSymbol") as Class;
Cache.teamSymbol = new teamSymbolClass();
}
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.SecurityErrorEvent;
import flash.net.URLRequest;
import flash.system.ApplicationDomain;
import flash.system.LoaderContext;
import game.com.tool.MsgBox;
public class LoadExternalRes
{
private static var currObj:LoadExternalRes = new LoadExternalRes();
private var externalResLoader:Loader = null;
private var externalResRequest:URLRequest = null;
public function LoadExternalRes()
{
}
public static function instance():LoadExternalRes{
return currObj;
}
/**
*
* @param path
*/
public function loadExternalResources(path:String):void{
externalResLoader = new Loader();
externalResLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, externalResLoader_CompleteHandler);
externalResLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, externalResLoader_IoErrorHandler);
externalResLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, externalResLoader_SecurityErrorHandler);
externalResRequest = new URLRequest(path);
var loaderContext:LoaderContext = new LoaderContext(true);
loaderContext.applicationDomain = ApplicationDomain.currentDomain;
externalResLoader.load(externalResRequest, loaderContext);
}
private function externalResLoader_CompleteHandler(event:Event):void{
//
}
private function externalResLoader_IoErrorHandler(event:IOErrorEvent):void{
var loaderUrl:String = (event.currentTarget as LoaderInfo).loaderURL;
MsgBox.newMsgBoxByContent("IoError:" + loaderUrl + " ...");
}
private function externalResLoader_SecurityErrorHandler(event:SecurityErrorEvent):void{
var loaderUrl:String = (event.currentTarget as LoaderInfo).loaderURL;
MsgBox.newMsgBoxByContent("SecurityError:" + loaderUrl + " ...");
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
⭐️ Flex & OpacityThe flex CSS shorthand property sets how a flex item will grow or shrink to fit the space available in its flex containe...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.