Hi there Folks

While trying to create a dynamic component into flex application then trying
to include others, why such thing doesn't work.

In the example bellow I create an PopUp titleWindow with children TextArea
Component. But when I create again the same titleWindow, the last TextArea
who is children of titleWindow is removed.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application creationComplete="createTextArea();" xmlns:mx="
http://www.adobe.com/2006/mxml"; layout="absolute">
   <mx:Script>
       <![CDATA[
           import mx.events.ChildExistenceChangedEvent;
           import mx.states.AddChild;
           import mx.controls.TextArea;
           import mx.managers.PopUpManager;
           import mx.containers.TitleWindow;
           import mx.core.IFlexDisplayObject;


           public var titleWindows:TitleWindow;
           public var MyTextArea:TextArea;
           public var i:Number = Math.random() *50;
           private function createTitleWindow():void
           {
               titleWindows = new TitleWindow();
               titleWindows.title = "Basic";
               titleWindows.width = 330;
               titleWindows.height = 200;
               titleWindows.showCloseButton = true;
               titleWindows.addChild(MyTextArea);
               mx.managers.PopUpManager.addPopUp
(titleWindows,this,false,null);
               titleWindows.creationPolicy ="all";
               titleWindows.createReferenceOnParentDocument(MyTextArea);
           }
           private function createTextArea():void
           {
               MyTextArea = new TextArea();
               MyTextArea.uid = 'textA';
               MyTextArea.width = 330;
               MyTextArea.height = 200;
               MyTextArea.text = "Example of Dynamic Text Content";
               MyTextArea.cacheAsBitmap = true;
               addChild(titleWindows);
           }
       ]]>
   </mx:Script>
   <mx:Button mouseDown="createTitleWindow()" label="Add dynamic Title
Window with content"/>
</mx:Application>


Regards.


--
----------------------------
Igor Costa
www.igorcosta.org
www.igorcosta.com
skype: igorpcosta

Reply via email to