나는 프리 로더 쓰고 있어요 : 메인 클래스로이 함께프리 로더 -에 getDefinition (에 참조 오류)
package {
import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.text.TextField;
import flash.display.LoaderInfo;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.system.System;
public class Preloader extends Sprite {
private var t:TextField = new TextField();
private var ver:String = "1000";
public function Preloader() {
t.y = 570;
addChild(t);
t.text = ver;
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event):void {
this.root.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoadingProgress);
this.root.loaderInfo.addEventListener(Event.COMPLETE, onLoadingCompleted);
// See if it's already completed
var percent:int = int(root.loaderInfo.bytesLoaded/root.loaderInfo.bytesTotal);
if (percent == 1)
onLoadingCompleted();
}
private function onLoadingProgress(event:Event):void {
var percent:int = int(root.loaderInfo.bytesLoaded/root.loaderInfo.bytesTotal * 100);
t.text = "Loading.. " + percent + "%";
}
private function onLoadingCompleted(event:Event = null):void {
root.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onLoadingProgress);
root.loaderInfo.removeEventListener(Event.COMPLETE, onLoadingCompleted);
var mainClass:Class = loaderInfo.applicationDomain.getDefinition("Main") as Class;
var main:DisplayObject = new mainClass() as DisplayObject;
parent.addChild(main);
parent.removeChild(this);
}
}
}
을 :
package {
import flash.display.Sprite;
public class Main extends Sprite {
public function Main() {
}
}
}
은 그래서 이것은 한 베어 본에 가까운 나는 그것을 만들 수 있었다.
그러나, 그것은 나에게 인사 :
ReferenceError: Error #1065: Variable Main is not defined.
at flash.system::ApplicationDomain/getDefinition()
at ...
은 이미 홈페이지를 삽입 frames.frame를 사용합니다. 개미와 리눅스 SDK를 직접 (mxmlc) 사용하여 컴파일하고 있습니다. 나는 명백한 것을 놓치고 있습니까?
멋지다! 나는 이것을 몰랐다. 나는 이것이 티미의 질문을 해결하기를 희망한다. –
나는 이미 이것을하고있다. 불행히도, "메인을 삽입하기 위해 frames.frame을 사용했다"고했을 때 명확하지 않았습니다. – Timmy
괜찮 았어, 또 다른 제안을 추가했는데 도움이 되었습니까? – grapefrukt