<?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
layout="vertical" minWidth="1024" minHeight="768"
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:popup="com.adobe.cairngorm.popup.*"
xmlns:commands="samples.commands.*"
xmlns:cairngorm="com.adobe.cairngorm.*"
xmlns:customscope="samples.commands.customscope.*"
xmlns:localscope="samples.commands.localscope.*"
addedToStage="buildContext()">
<mx:Metadata>
[Event(name="parent", type="samples.commands.ParentEvent")]
[ManagedEvents(names="parent")]
</mx:Metadata>
<mx:Script>
<![CDATA[
import mx.logging.LogEventLevel;
import samples.commands.customscope.CustomScopeContext;
import samples.commands.localscope.LocalScopeContext;
import samples.commands.ParentEvent;
import com.adobe.cairngorm.popup.PopUpEvent;
import samples.commands.ParentContext;
import org.spicefactory.parsley.flex.FlexContextBuilder;
import org.spicefactory.parsley.core.context.Context;
[Inject]
[Bindable]
public var context:Context;
private function buildContext():void
{
FlexContextBuilder.build(ParentContext, this);
dispatchEvent(new Event('configureIOC', true));
}
private function dispatchParent():void
{
var event:ParentEvent = new ParentEvent(ParentEvent.NAME);
dispatchEvent(event);
}
]]>
</mx:Script>
<cairngorm:CairngormIntegrationRPCSupport/>
<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>
<mx:Button
label="Dispatch Global Event"
click="dispatchParent()"/>
<mx:HBox
width="100%" height="100%">
<mx:Box id="box1"
width="25%" height="100%"
backgroundColor="0x660099">
<mx:Button
label="Open popup in local scope"
click="localPopup1.open = true"/>
</mx:Box>
<mx:Box id="box2"
width="25%" height="100%"
backgroundColor="0x006699">
<mx:Button
label="Open another popup in local scope"
click="localPopup2.open = true"/>
</mx:Box>
<mx:Box id="box3"
width="25%" height="100%"
backgroundColor="0x009966">
<mx:Button
label="Open popup with custom scope"
click="customScopePopup.open = true"/>
</mx:Box>
</mx:HBox>
<popup:PopUpWrapper id="localPopup1"
parent="{ box1 }">
<localscope:LocalScopePopup/>
<popup:behaviors>
<mx:Array>
<popup:AddPopUpToParsleyContext context="{ context }" />
<popup:MergePopUpContextToParsley context="{ LocalScopeContext }" />
</mx:Array>
</popup:behaviors>
</popup:PopUpWrapper>
<popup:PopUpWrapper id="localPopup2"
parent="{ box2 }">
<localscope:LocalScopePopup/>
<popup:behaviors>
<mx:Array>
<popup:AddPopUpToParsleyContext context="{ context }" />
<popup:MergePopUpContextToParsley context="{ LocalScopeContext }" />
</mx:Array>
</popup:behaviors>
</popup:PopUpWrapper>
<popup:PopUpWrapper id="customScopePopup"
parent="{ box3 }">
<customscope:CustomScopePopup/>
<popup:behaviors>
<mx:Array>
<popup:AddPopUpToParsleyContext context="{ context }" />
<popup:MergePopUpContextToParsley context="{ LocalScopeContext }">
<popup:scopes>
<mx:String>custom</mx:String>
</popup:scopes>
</popup:MergePopUpContextToParsley>
</mx:Array>
</popup:behaviors>
</popup:PopUpWrapper>
</mx:Application>