<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2007 - 2009 Adobe
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:example="example.*"
layout="vertical"
width="100%"
height="100%"
xmlns:spicefactory="http://www.spicefactory.org/parsley"
xmlns:cairngorm="com.adobe.cairngorm.*">
<mx:Script>
<![CDATA[
import example.api.BroadcastMessage;
import example.api.ClearLogMessage;
import example.api.PingMessage;
import example.api.PongMessage;
import mx.logging.LogEventLevel;
import mx.modules.IModuleInfo;
import org.spicefactory.lib.reflect.ClassInfo;
[Bindable]
[Inject(id="moduleA")]
public var moduleA:IModuleInfo;
[Bindable]
[Inject(id="moduleB")]
public var moduleB:IModuleInfo;
[Bindable]
[Inject(id="moduleC")]
public var moduleC:IModuleInfo;
[MessageDispatcher]
public var dispatcher:Function;
private var compile:Array=[PongMessage, ClearLogMessage, ClassInfo];
protected function dispatchPingMessage(moduleId:String=null):void
{
dispatcher(new PingMessage(moduleId));
}
protected function dispatchBroadcastMessage():void
{
dispatcher(new BroadcastMessage());
}
private var moduleCount:int=5;
protected function button1_clickHandler(event:MouseEvent):void
{
/* var modulePod:ModulePod=new ModulePod();
modulePod.percentWidth=100;
modulePod.percentHeight=100;
modulePod.label=modulePod.moduleId="moduleA" + moduleCount++; */
//modulePod.moduleInfo=moduleA;
//tabNav.addChild(modulePod);
}
]]>
</mx:Script>
<spicefactory:ContextBuilder>
<cairngorm:CairngormModuleSupport/>
<cairngorm:CairngormModuleXMLSupport/>
<spicefactory:XmlConfig file="runtimeContext.xml"/>
</spicefactory:ContextBuilder>
<spicefactory:Configure/>
<mx:TraceTarget level="{ LogEventLevel.DEBUG }"
includeCategory="true">
<mx:filters>
<mx:Array>
<mx:String>com.adobe.cairngorm.*</mx:String>
<mx:String>org.spicefactory.*</mx:String>
</mx:Array>
</mx:filters>
</mx:TraceTarget>
<cairngorm:CairngormModuleSupport/>
<mx:HBox width="100%">
<mx:Button label="Ping moduleA"
click="dispatchPingMessage('moduleA')"/>
<mx:Button label="Ping moduleA2"
click="dispatchPingMessage('moduleA2')"/>
<mx:Button label="Ping moduleB"
click="dispatchPingMessage('moduleB')"/>
<mx:Button label="Pong ModuleC"
click="dispatcher( new PongMessage() )"/>
<mx:Button label="Ping all ModuleA"
click="dispatchBroadcastMessage()"/>
<mx:Spacer width="10"/>
<mx:Button label="CLEAR ALL LOGS"
click="dispatcher( new ClearLogMessage() )"/>
<mx:Spacer width="100%"/>
<mx:Button label="Add new instance of ModuleA"
click="button1_clickHandler(event)"/>
<mx:TextInput id="moduleIdInput"
width="150"
text="moduleA3"/>
<mx:Button label="Ping"
click="dispatchPingMessage(moduleIdInput.text)"/>
</mx:HBox>
<mx:HBox width="100%"
height="100%">
<mx:VBox width="350"
height="100%">
<!--<example:ModulePod width="100%"
height="25%"
moduleId="moduleA"
moduleInfo="{ moduleA }"
label="moduleA"/>
<example:ModulePod width="100%"
height="25%"
moduleId="moduleA2"
moduleInfo="{ moduleA }"
label="moduleA2"/>
<example:ModulePod width="100%"
height="25%"
moduleId="moduleB"
moduleInfo="{ moduleB }"
label="moduleB"/>-->
<mx:ViewStack width="100%"
height="25%"
id="moduleCStack">
<mx:Canvas width="100%"
height="100%">
<mx:Button horizontalCenter="0"
verticalCenter="0"
label="Instantiate ModuleC"
click="moduleCStack.selectedIndex=1"/>
</mx:Canvas>
<!--<example:ModulePod width="100%"
height="100%"
moduleInfo="{ moduleC }"
label="moduleC"/>-->
</mx:ViewStack>
</mx:VBox>
<mx:TabNavigator width="100%"
height="400"
id="tabNav">
<!--<example:ModulePod width="100%"
height="100%"
moduleId="moduleA3"
moduleInfo="{ moduleA }"
label="moduleA3"/>
<example:ModulePod width="100%"
height="100%"
moduleId="moduleA4"
moduleInfo="{ moduleA }"
label="moduleA4"/>-->
</mx:TabNavigator>
</mx:HBox>
</mx:Application>