Adobe Flex无法使用ModuleLoader加载模块

时间:2013-05-22 06:40:34

标签: flash flex actionscript mxmlc

的main.swf

<?xml version="1.0"?>
<!-- modules/StyleModLoaderApp.mxml -->
<s:Application 
    xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" 
    xmlns:mx="library://ns.adobe.com/flex/mx">

    <s:layout> 
        <s:VerticalLayout/> 
    </s:layout>

    <fx:Style>
        @namespace s "library://ns.adobe.com/flex/spark";

        s|Button { 
            color:blue;
            cornerRadius:10;
        }
    </fx:Style>

    <s:VGroup>
        <s:ModuleLoader id="ml1" url="mod1.swf"/>
    </s:VGroup>

    <s:Button id="myButton" label="Main App Button"/>

</s:Application>

mod1.swf

<?xml version="1.0"?>
<s:Application 
    xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" 
    xmlns:mx="library://ns.adobe.com/flex/mx">

    <fx:Style>
        @namespace s "library://ns.adobe.com/flex/spark";
        s|Button { 
            color:red;
        }
    </fx:Style>

    <s:VGroup>
        <s:Label id="lab1" text="Module 1"/>
         <s:Button id="myButton1" label="mod1 button"/>
    </s:VGroup>

</s:Application>

为什么会发生这种情况?

Main.swf和mod1.swf都在同一个文件夹中,Main.swf执行正常,但没有mod1.swf按钮,应加载,dwadwadwafeaf

1 个答案:

答案 0 :(得分:0)

只需在mod1.swf中将Application标记重命名为Module即可。模块加载器将无法处理标记为swf的应用程序。