Actionscript 3 外部swf中的stage.scaleMode导致TypeError:错误#1009

Actionscript 3 外部swf中的stage.scaleMode导致TypeError:错误#1009,actionscript-3,Actionscript 3,当我尝试使用以下代码将外部swf加载到主文件中时 var imageLoader:Loader = new Loader(); var url:URLRequest = new URLRequest("Content.swf"); imageLoader.load(url); imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded); function imageLoaded(e:Event):vo

当我尝试使用以下代码将外部swf加载到主文件中时

var imageLoader:Loader = new Loader(); 
var url:URLRequest = new URLRequest("Content.swf");
imageLoader.load(url);

imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
function imageLoaded(e:Event):void {
image.addChild(imageLoader);
} 
如果外部swf有此代码

   stage.scaleMode = StageScaleMode.NO_SCALE;
然后我得到这个错误:TypeError:error#1009:无法访问null对象引用的属性或方法。但是如果swf中有TLF文本(或者至少只有一个TLF文本字段,甚至没有字符),那么一切都正常。对于经典文本,错误仍然存在。为什么外部swf中存在TLF文本可以解决问题?
提前感谢使用
事件。在您的外部swf中添加了\u到\u STAGE
,以确保该STAGE是可访问的:

public function astest1()
{
    if(stage)
        init();
    else
        addEventListener(Event.ADDED_TO_STAGE, init);
}

protected function init(event:Event = null):void
{
    if(event)
        EventDispatcher(event.target).removeEventListener(event.type, arguments.callee);

    trace("stage = ", stage);
}
至于TLF已经修复了这个问题,我想可能是RSL的影响,最有可能的是flash加载了TLF运行时库,因此它延迟了对swf的构造函数的调用,因此主swf添加了带有外部swf的加载程序(并使外部swf可以访问
stage
),但这是不稳定的(当然)在这两种情况下,我建议您先听
事件。在阶段使用之前,将\u添加到\u阶段
事件