jeudi 13 avril 2017

In flex 4.5 parentDocument did not working as in flex 4.0. How to call parentDocument in flex 4.5?

In flex 4.0 next code is work:

<s:WindowedApplication xmlns:fx="http://ift.tt/rYUnH9" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx" width="500" height="600">
<fx:Script>
    <![CDATA[
        import componentCanvas;

        import mx.containers.TitleWindow;
        import mx.controls.Alert;

        public function createChild():void{
            var c:componentCanvas = new componentCanvas;
            c.x = 20;
            c.y=20;
            toInclude.addChild(c);
        }
    ]]> 
</fx:Script>
<mx:Button click="createChild()"/>
<mx:Canvas id="toInclude"/>

--componentCanvas --

<mx:Canvas xmlns:fx="http://ift.tt/rYUnH9" 
       xmlns:s="library://ns.adobe.com/flex/spark" 
       xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">
<fx:Script>
    <![CDATA[
        import componentCanvas;
        import mx.containers.TitleWindow;
        import mx.controls.Alert;
        import mx.managers.PopUpManager;
        import popAll;

        public function oh():void{
            Alert.show("From titleWindow");
        }

        public function open():void{
            var pop:popAll = popAll(PopUpManager.createPopUp(this, popAll, true));

        }
    ]]>
</fx:Script>
<mx:Label text="Canvas" x="100" y="100"/>
<mx:Button click="open()"/>

-- popAll --

<s:TitleWindow xmlns:fx="http://ift.tt/rYUnH9" 
           xmlns:s="library://ns.adobe.com/flex/spark" 
           xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300" x="40" y="40" close="closePopUp()">
<fx:Script>
    <![CDATA[
        import mx.managers.PopUpManager;
        public function closePopUp():void{
            super.parentDocument.oh();
            PopUpManager.removePopUp(this);
        }
    ]]>
</fx:Script>
<mx:Button click="closePopUp()"/>

When I call parentDocument in titleWindow in flex 4 all is fine. The same code in 4.5 did not work. I trying to find answer one week but I cannot! Please help to implementhis in flex 4.5

Aucun commentaire:

Enregistrer un commentaire