Apache flex 外部SWF的加载会导致;找不到资源包消息传递“;错误
我正在使用flash.display.Loader作为加载SWF的用例,SWF在我正在处理的应用程序中使用flex图表组件 这是我用来加载swf的代码: Main.mxml:Apache flex 外部SWF的加载会导致;找不到资源包消息传递“;错误,apache-flex,actionscript-3,actionscript,flex3,Apache Flex,Actionscript 3,Actionscript,Flex3,我正在使用flash.display.Loader作为加载SWF的用例,SWF在我正在处理的应用程序中使用flex图表组件 这是我用来加载swf的代码: Main.mxml: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="onCreationComplete(event);"> <mx
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="onCreationComplete(event);">
<mx:Script>
<![CDATA[
import mx.events.FlexEvent;
import myLoaderClass;
private function onCreationComplete( e:FlexEvent ):void
{
trace("Init!");
var l:myLoaderClass = new myLoaderClass();
this.addChild(l);
}
]]>
</mx:Script>
</mx:Application>
问题是,swf加载的那一刻,我得到了以下运行时错误:
错误:找不到资源包消息传递
位于mx.resources::ResourceBundle$/getResourceBundle()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\resources\ResourceBundle.as:143]
在mx.utils::Translator$cinit()处
在全局$init()处
在mx.messaging.config::ServerConfig$cinit()上
在全局$init()处
在_app_FlexInit$/init()处
位于mx.managers::SystemManager/:\autobuild\3.5.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:3217]
位于mx.managers::SystemManager/docFrameListener()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:3069]
我在这里做错了什么?我不认为您发布的代码没有做错任何事情。我刚刚将它粘贴到一个新项目中(重命名为
JittRunner
为myLoaderClass
),它编译后运行良好(除了没有错误外,什么都没做)
package
{
import mx.core.UIComponent;
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.display.Loader;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.net.URLRequest;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.utils.Dictionary;
public class JittRunner extends UIComponent
{
private var displayedObjects:Dictionary;
public function JittRunner():void
{
displayedObjects = new Dictionary();
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest('ChartSampler.swf');
mLoader.load(mRequest);
}
}
}