Created
October 4, 2010 00:04
-
-
Save marc-hughes/609070 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<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" minWidth="955" minHeight="600" | |
creationComplete="application1_creationCompleteHandler(event)" | |
> | |
<fx:Script> | |
<![CDATA[ | |
import com.roguedevelopment.objecthandles.ObjectHandles; | |
import com.roguedevelopment.objecthandles.SelectionEvent; | |
import mx.core.IVisualElement; | |
import mx.events.FlexEvent; | |
protected var oh:ObjectHandles; | |
protected function application1_creationCompleteHandler(event:FlexEvent):void | |
{ | |
oh = new ObjectHandles( handleContainer ); | |
oh.registerComponent( c1, c1 ); | |
oh.registerComponent( c2, c2 ); | |
oh.selectionManager.addEventListener(SelectionEvent.ADDED_TO_SELECTION, onAddedToSelection); | |
} | |
private function onAddedToSelection(event:SelectionEvent):void | |
{ | |
if( oh.selectionManager.currentlySelected.length == 0) return; | |
var selected:IVisualElement = oh.selectionManager.currentlySelected[0]; | |
handleContainer.depth = selected.depth; | |
} | |
]]> | |
</fx:Script> | |
<fx:Declarations> | |
<!-- Place non-visual elements (e.g., services, value objects) here --> | |
</fx:Declarations> | |
<s:Group id="c1" width="50" height="50" x="10" y="10" depth="10"> | |
<s:Ellipse width="100%" height="100%" x="0" y="0" > | |
<s:stroke> | |
<s:SolidColorStroke color="#000000" weight="4" /> | |
</s:stroke> | |
<s:fill> | |
<s:LinearGradient> | |
<s:GradientEntry color="#555533" /> | |
<s:GradientEntry color="#ff5533" /> | |
</s:LinearGradient> | |
</s:fill> | |
</s:Ellipse> | |
</s:Group> | |
<s:Group id="c2" width="50" height="50" x="10" y="110" depth="20"> | |
<s:Ellipse width="100%" height="100%" x="0" y="0" > | |
<s:stroke> | |
<s:SolidColorStroke color="#000000" weight="4" /> | |
</s:stroke> | |
<s:fill> | |
<s:LinearGradient> | |
<s:GradientEntry color="#555533" /> | |
<s:GradientEntry color="#ff5533" /> | |
</s:LinearGradient> | |
</s:fill> | |
</s:Ellipse> | |
</s:Group> | |
<s:SpriteVisualElement id="handleContainer" width="100%" height="100%" /> | |
</s:Application> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment