This may or may not help:

The following example uses FlexMDI (Now part of FlexLib -
http://code.google.com/p/flexlib/).

PopupExample.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical"
      creationComplete="onCreationComplete(event)">
     <mx:Script>
         <![CDATA[
             import mx.events.FlexEvent;
             import flexmdi.effects.effectsLib.MDIVistaEffects;
             import flexmdi.managers.MDIManager;

             private var myPopup:GridPopup;

             private function onCreationComplete(event:FlexEvent):void
             {
                 MDIManager.global.effects = new MDIVistaEffects();
             }

             private function createPopup():void
             {
                 myPopup = new GridPopup(uint(numGrids.text));
             }
         ]]>
     </mx:Script>
     <mx:TextInput id="numGrids"/>
     <mx:Button click="createPopup()" label="Create Popup"/>
</mx:Application>


GridPopup.as:
package
{
     import flexmdi.containers.MDIWindow;
     import flexmdi.events.MDIWindowEvent;
     import flexmdi.managers.MDIManager;
     import mx.containers.Grid;
     import mx.controls.Button;
     import mx.containers.GridItem;
     import mx.containers.GridRow;

     public class GridPopup extends MDIWindow
     {
         private var myGrid:Grid;
         private var myButton:Button;
         private var myGridRow:GridRow;

         public function GridPopup(numGrids:uint)
         {
             super();
             width = 500;
             height = 500;

             myGrid = new Grid();
             for(var i:int = 0 ; i < numGrids * numGrids; i++)
             {
                 var myGridItem:GridItem = new GridItem();
                 myButton = new Button();
                 myButton.label = "Button " + (i + 1).toString();
                 myGridItem.addChild(myButton);
                 if((i % numGrids) == 0 || i == 0)
                 {
                     if(i != 0)
                     {
                         myGrid.addChild(myGridRow);
                     }
                     myGridRow = new GridRow();
                 }
                 myGridRow.addChild(myGridItem);
             }
             myGrid.addChild(myGridRow);
             this.addChild(myGrid);

             MDIManager.global.add(this);
         }
     }
}

--- In [email protected], "pbrendanc" <[EMAIL PROTECTED]> wrote:
>
> I't trying to create a composite control (in AS) at run time and pass
> this to a popup (as an object) - the popup is responsible for the
> display and the contents vary based on a user input (e.g. 2*2 grid;
> 3*3 grid etc).
>
> My initial thought was to create a composite component and then pass
> this for display via the Popup Manager as part of the popup. However
> I'm not sure this will work as it appears that the composite control
> methods (createChildren etc) apply to the current form and do not
> support the creation of a package that can be rendered in a separate
> form/window.
>
> Maybe I need to have the popup form create the composite control
> directly instead?
>
> Any suggestions/comments?
>
> TIA,
> Patrick
>

Reply via email to