This is an automated email from the ASF dual-hosted git repository. gregdove pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit dc935db7fbf8cf8d09be55efc8e1b2bf260a038c Author: greg-dove <[email protected]> AuthorDate: Fri Dec 17 21:45:42 2021 +1300 updating example to show launch of LinkBar/Viewstack combo with children with creationPolicy=none. --- .../src/main/royale/ControlsExample.mxml | 28 +++++++++++-- .../src/main/royale/components/StackItem.mxml | 28 +++++++++++++ .../TitleWindowPopupWindowWithViewStack.mxml | 49 ++++++++++++++++++++++ 3 files changed, 101 insertions(+), 4 deletions(-) diff --git a/examples/mxroyale/ControlsExample/src/main/royale/ControlsExample.mxml b/examples/mxroyale/ControlsExample/src/main/royale/ControlsExample.mxml index 890c442..3600e83 100644 --- a/examples/mxroyale/ControlsExample/src/main/royale/ControlsExample.mxml +++ b/examples/mxroyale/ControlsExample/src/main/royale/ControlsExample.mxml @@ -42,10 +42,11 @@ limitations under the License. <fx:Script> <![CDATA[ + import components.TitleWindowPopupWindowWithViewStack; import mx.containers.TitleWindow; - import mx.events.CloseEvent; import mx.managers.PopUpManager; - + import mx.events.CloseEvent; + import mx.events.FlexEvent; import org.apache.royale.events.Event; private function pushMePushed(event:MouseEvent):void { @@ -74,9 +75,26 @@ limitations under the License. PopUpManager.addPopUp(titleWindow, this, true); PopUpManager.centerPopUp(titleWindow); } + + private function testViewStack():void { + var test:TitleWindowPopupWindowWithViewStack = PopUpManager.createPopUp(this,TitleWindowPopupWindowWithViewStack) as TitleWindowPopupWindowWithViewStack; + test.addEventListener(mx.events.CloseEvent.CLOSE, close); + //@todo implement and test other child creationPolicies... + test.childCreationPolicyTest = 'none'; + test.title = "ViewStack with creationPolicy test:"+test.childCreationPolicyTest; + PopUpManager.centerPopUp(test); + + function close(event:mx.events.CloseEvent):void{ + PopUpManager.removePopUp(test) + } + } ]]> </fx:Script> - + <mx:Canvas width="300" height="100" backgroundColor="yellow"> + <mx:Label text="left:2 right:2 top:2" left="2" right="2" top="2" backgroundColor="white"/> + <mx:Label text="left:10 right:40 top:40" left="10" right="40" top="40" backgroundColor="white"/> + <mx:Label text="left:40 right:40 top:80" left="40" right="40" top="80" backgroundColor="white" /> + </mx:Canvas> <mx:VBox id="vbox1"> <mx:Label text="Hello World"/> <mx:Button label="Change Icon" click="changeIcon()" @@ -109,5 +127,7 @@ limitations under the License. maxChars="100"/> <mx:Button label="Launch TitleWindow" click="testTitleWindow()" toolTip="launchs a test TitleWindow" /> - + <mx:Button label="Launch ViewStack" click="testViewStack()" + toolTip="launchs a test ViewStack with LinkBar" /> + </mx:Application> \ No newline at end of file diff --git a/examples/mxroyale/ControlsExample/src/main/royale/components/StackItem.mxml b/examples/mxroyale/ControlsExample/src/main/royale/components/StackItem.mxml new file mode 100644 index 0000000..58e5170 --- /dev/null +++ b/examples/mxroyale/ControlsExample/src/main/royale/components/StackItem.mxml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:mx="library://ns.apache.org/royale/mx" + + width="100%" height="100%"> + + <mx:Label preinitialize="preInitialize(event)" initialize="onInitialize(event)" id="testLabel" left="0" right="0" text="{label}" creationComplete="labelComplete(event)"/> + + <mx:Label preinitialize="preInitialize(event)" initialize="onInitialize(event)" id="otherLabel" left="0" right="0" top="40" text="{label}" creationComplete="labelComplete(event)"/> + + <fx:Script><![CDATA[ + import mx.events.FlexEvent; + + + private function labelComplete(event:FlexEvent):void{ + trace(event.target.id,' creationComplete Internal:'+this.label) + } + + + private function preInitialize(event:FlexEvent):void { + trace(event.target.id,' preInitialize Internal:'+this.label) + } + + private function onInitialize(event:FlexEvent):void { + trace(event.target.id,' initialize Internal:'+this.label) + } + ]]></fx:Script> +</mx:Canvas> diff --git a/examples/mxroyale/ControlsExample/src/main/royale/components/TitleWindowPopupWindowWithViewStack.mxml b/examples/mxroyale/ControlsExample/src/main/royale/components/TitleWindowPopupWindowWithViewStack.mxml new file mode 100644 index 0000000..f7169f7 --- /dev/null +++ b/examples/mxroyale/ControlsExample/src/main/royale/components/TitleWindowPopupWindowWithViewStack.mxml @@ -0,0 +1,49 @@ +<?xml version="1.0"?> +<mx:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:mx="library://ns.apache.org/royale/mx" + layout="absolute" + creationComplete="onCreationComplete(event)" + showCloseButton="true" + width="850" + height="680"> + + <fx:Script><![CDATA[ + import mx.events.FlexEvent; + + public var childCreationPolicyTest:String = 'none'; + + private function viewStackChange(event:IndexChangedEvent):void { + + } + import mx.events.IndexChangedEvent; + + private function onCreationComplete(event:FlexEvent):void { + for (var i:uint=0;i<10;i++) { + var inst:Canvas = new StackItem(); + inst.creationPolicy = i >0 ? childCreationPolicyTest : 'all'; + inst.label = "Inst:"+i; + inst.addEventListener(FlexEvent.PREINITIALIZE, childEvent); + inst.addEventListener(FlexEvent.INITIALIZE, childEvent) + inst.addEventListener(FlexEvent.CREATION_COMPLETE, childEvent) + inst.addEventListener(FlexEvent.CONTENT_CREATION_COMPLETE, childEvent) + Properties_vs.addChild(inst); + } + + } + + + private function childEvent(event:Event):void{ + var target:StackItem = event.target as StackItem; + trace(event.type, target.label); + } + + ]]> + </fx:Script> + <mx:Canvas width="223" left="0" top="0" bottom="0" horizontalScrollPolicy="off" id="linkBarCanvas"> + <mx:LinkBar id="Properties_lbar" width="215" direction="vertical" dataProvider="Properties_vs" left="0" top="0" bottom="0"/> + </mx:Canvas> + <mx:VRule x="223" top="0" bottom="0" id="propertiesVRule"/> + <mx:ViewStack id="Properties_vs" change="viewStackChange(event)" top="0" bottom="0" right="0" left="225"/> + + +</mx:TitleWindow>
