can you explain me why you are using
parentApplication.closing.mainPanel.subCanvas.....

can't you use
        subCanvas.createChild(...);

here is the sample application


<?xml version="1.0"?>
<mx:Application
xmlns:mx="http://www.macromedia.com/2003/mxml">
   <mx:Script>
      <![CDATA[
         function getData1():Array {
            var r:Array = new Array();
             var vA:Array = new Array();
            vA.push("a");
            vA.push("b");
            var vB:Array = new Array();
            vB.push("c");
            vB.push("d");
            r.push("text A")
            r.push(vA);
            r.push("text B")
            r.push(vB);
            return(r)
         }
  
         function isArray(myVal)
         {
            if(myVal.currentItem instanceof Array){
               b1.createChild(mx.controls.ComboBox,
undefined,
               {dataProvider:myVal.currentItem})
            } else{
                
b1.createChild(mx.controls.TextInput, undefined,
                  {text:myVal.currentItem});
            }
         }
      ]]>
   </mx:Script>

   <mx:Box id="b1" direction="vertical"
borderStyle="solid" marginTop="10"
      marginBottom="10" marginLeft="10"
marginRight="10" >
         <mx:Repeater id="r1"
dataProvider="{getData1()}"
            repeat="isArray(event.target)"/>
   </mx:Box>

</mx:Application>



--- Jeremy Rottman <[EMAIL PROTECTED]> wrote:

> opps didnt fully explain my last post.
>
> I removed the for loop in my function,  and tried
> testing with this.  I
> am trying to create the label on the subCanvas,
> which is where all my
> display happens. And I still get nothing.
>
>                   var newLabel =

>
parentApplication.closing.mainPanel.subCanvas.createChildren(mx.controls\
> .Label, undefined );
>                     newLabel.text = 'test';
>                     newLabel.x = 10;
>                     newLabel.y = 300;
>
>
> --- In flexcoders@yahoogroups.com, "Jeremy Rottman"
> <[EMAIL PROTECTED]>
> wrote:
> >
> > I have tried that, and still doesnt work. I have
> tried testing with
> > just this.
> >
> >      var newLabel =
> >
>
parentApplication.closing.mainPanel.subCanvas.createChildren(mx.controls\
> .Label,
> > undefined );
> >      newLabel.text = 'test';
> >      newLabel.x = 10;
> >      newLabel.y = 300;
> >
> > --- In flexcoders@yahoogroups.com, Suresh Akula
> suresha143@ wrote:
> > >
> > > try it out this
> > >
> > >
>
parentApplication.closing.createChild(mx.containers.Grid,
> > > undefined,{id = "grid"+i});
> > >
> > > --Suresh
> > >
> > > --- Jeremy Rottman rottmanj@ wrote:
> > >
> > > > Well I tried what you said Suresh, and it is
> still a
> > > > no go. Here is my
> > > > updated code.
> > > >
> > > >                      for ( var
> > > > i:Number=0;i<result.length;i++){
> > > >
> > > >                      var newGrid =
> > > >
> > >
>
parentApplication.closing.createChild(mx.containers.Grid,
> > > > undefined);
> > > >                              newGrid.id =
> "grid" +
> > > > i;
> > > >                              newGrid.x = 10;
> > > >                              newGrid.y =
> > > > parentApplication.closing.mainGrid.y + 20;
> > > >                              newGrid.width =
> '90%';
> > > >                      var newGridRow =
> > > >
> > >
>
parentApplication.closing.newGrid.createChild(mx.containers.GridRow,
> > > > undefined);
> > > >                              newGridRow.id =
> > > > "gridRow" + i;
> > > >                      var newGridItem =
> > > >
> > >
> >
>
parentApplication.closing.newGrid.newGridRow.createChild(mx.containers.G\
> \
> > > > ridItem, undefined);
> > > >                              newGridItem.width
> =
> > > > 445;
> > > >                              newGridItem.id =
> > > > "gridItem" + i;
> > > >                      var newCanvas =
> > > >
> > >
> >
>
parentApplication.closing.newGrid.newGridRow.newGridItem.createChild(mx.\
> \
> > > > containers.Canvas);
> > > >                              newCanvas.width
> > > > ='100%';
> > > >                              newCanvas.heigth
> > > > ='100%';
> > > >                              newCanvas.id =
> "canvas"
> > > > + i;
> > > >                      var newLabel
> > > >
> > >
> >
>
=parentApplication.closing.newGrid.newGridRow.newGridItem.newCanvas.crea\
> \
> > > > teChild(mx.controls.Label, undefined);
> > > >                              newLabel.id =
> "name" +
> > > > i;
> > > >                              newLabel.text =
> "TEST";
> > > >                      }
> > > > --- In flexcoders@yahoogroups.com, Suresh
> Akula
> > > > <suresha143@> wrote:
> > > > >
> > > > > Hello Rottman,
> > > > >
> > > > >     You already created the newGrid and
> assigned a
> > > > > dynamic id to that. Why can't you use the
> same
> > > > intance
> > > > > variable name in the rest of the code.
> > > > > i.e.
> > > > > var newGridRow =
> > > > >
> > > >
> > >
>
parentApplication.closing.newGrid.createChild(mx.containers.GridRow,
> > > > > undefined);
> > > > >
> > > > > --Suresh Akula.
> > > > >
> > > > >
> > > > >
> > > > > --- Jeremy Rottman rottmanj@ wrote:
> > > > >
> > > > > > I am still working on this. And I have run
> into
> > > > an
> > > > > > issue.  When I create
> > > > > > a child, I need to give that child a
> unique id.
> > > > I
> > > > > > tried 'grid' & i to
> > > > > > make it unique, but that doesnt work.
> > > > > >
> > > > > > Here is hte code I am trying
> > > > > >
> > > > > >
> > > > > >      for ( var
> i:Number=0;i<result.length;i++){
> > > > > >
> > > > > >          var newGrid =
> > > > > >
> > > > >
> > > >
> > >
>
parentApplication.closing.createChild(mx.containers.Grid,
> > > > > > undefined);
> > > > > >              newGrid.id = 'grid' & i;
> > > > > >              newGrid.x = 10;
> > > > > >              newGrid.y = mainGrid.y + 20;
> > > > > >              newGrid.width = 90%;
> > > > > >          var newGridRow =
> > > > > > parentApplication.closing.'grid' &
> > > > > > i.createChild(mx.containers.GridRow,
> undefined);
> > > > > >              newGridRow = 'gridRow' & i;
> > > > > >          var newGridItem =
> > > > > > parentApplication.closing.'grid' &
> i.'gridRow'
> > > > > > & i.createChild(mx.containers.GridItem,
> > > > undefined);
> > > > > >              newGridItem.width = 445;
> > > > > >              newGridItem.id = 'gridItem' &
> i;
> > > > > >          var newCanvas =
> > > > > > parentApplication.closing.'grid' &
> i.'gridRow' &
> > > > > > i.'gridItem' &
> > > > i.createChild(mx.containers.Canvas);
> > > > > >              newCanvas.width = 100%;
> > > > > >              newCanvas.heigth = 100%;
> > > > > >              newCanvas.id = 'canvas' & i;
> > > > > >          var newLabel = var newLabel
> > > > > > =parentApplication.closing.'grid' &
> > > > > > i.'gridRow' & i.'gridItem' & i.'canvas'
> > > > > > i.createChild(mx.controls.Label,
> > > > > > undefined);
> > > > > >              newLabel.id = 'name' i
> > > > > >              newLabel.test = 'TEST'
> > > > > >              }
> > > > > >
> > > > > >
> > > > > >
> > > > > > --- In flexcoders@yahoogroups.com, "Jeremy
> > > > Rottman"
>
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to