Flex  Flash 使



Flex Builder []_[]_[MXML ]
[]_[]_[MXML ]

MyModule.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="500" height="300">
	<mx:VBox width="100%" height="100%" backgroundColor="#aaaaaa" horizontalAlign="center" verticalAlign="middle">
		<mx:Label text="Test" />
	</mx:VBox>
</mx:Application>








mx:Application

mx:Module
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="500" height="300">
	<mx:VBox width="100%" height="100%" backgroundColor="#aaaaaa" horizontalAlign="center" verticalAlign="middle">
		<mx:Label text="Test" />
	</mx:VBox>
</mx:Module>

Flex Builder 





main.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#ffffff">
	<mx:Script>
		<![CDATA[
			public function createModule(moduleLoader:ModuleLoader, urlStr:String):void
			{
				if (!moduleLoader.url) {
					moduleLoader.url = urlStr;
					return;
				}
				moduleLoader.loadModule();
			}
			public function removeModule(moduleLoader:ModuleLoader):void
			{
				moduleLoader.unloadModule();
			}
		]]>
	</mx:Script>
	<mx:ModuleLoader id="myModuleLoader"/>
	<mx:HBox>
		<mx:Button id="loadButton" label="load" click="createModule(myModuleLoader, 'MyModule.swf');"/>
		<mx:Button id="unloadButton" label="unload" click="removeModule(myModuleLoader);"/>
	</mx:HBox>
</mx:Application>







actionScriptProperties


  .actionScriptProperties 


<modules>
<module application="src/main.mxml" destPath="MyModule.swf" optimize="true" sourcePath="src/MyModule.mxml"/>
</modules>


<applications>
<application path="main.mxml"/>
<application path="MyModule.mxml"/>
</applications>



Flex Builder  mx:Application, mx:Module 

HTML5飯