Well tracy, it is assinging the id perfectly fine. But when I try to set
the canvas width or height to 100% I get this error.

Implicit coercion of a value of type 'String' to an unrelated type

When I try to set it to 100% with out the ''

I get this error.
  Expecting primary _expression_ before semicolon


                         for ( var i:Number=0;i<result.length;i++){
                     var newLabel:Label = new Label();
                     newLabel.text = 'TEST';
                     newLabel.x = 10;
                     newLabel.y = 300;
                   
parentApplication.closing.mainBox.addChild(newLabel);
                     var newCanvas:Canvas = new Canvas();
                     newCanvas.id = 'canvas' + i;
                     newCanvas.width = '100%';
                     newCanvas.height = '100%';
                   
parentApplication.closing.mainBox.addChild(newCanvas);
                         }

--- In flexcoders@yahoogroups.com, "Jeremy Rottman" <[EMAIL PROTECTED]>
wrote:
>
> I finally got it figured out. BTw this is for F2B2 only.
>      var newLabel:Label = new Label();
>      newLabel.text = 'TEST';
>      newLabel.x = 10;
>      newLabel.y = 300;
>      parentApplication.closing.mainBox.addChild(newLabel);
>
>
> --- In flexcoders@yahoogroups.com, "Tracy Spratt" tspratt@ wrote:
> >
> > So the issue is not assigning an id, but rather that you are not
able to
> > successfully use createChild() at all?
> >
> > Could the problem be the reference chain?
> >
> > Can you do it in a sample app?
> >
> > Tracy
> >
> > -----Original Message-----
> > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On
> > Behalf Of Jeremy Rottman
> > Sent: Tuesday, April 25, 2006 5:00 PM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Re: Looping output
> >
> > 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" <rottmanj@>
> > 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"
> > > > > > > rottmanj@
> > > > > > > wrote:
> > > > > > > >
> > > > > > > > That is exactly what I was talking about karl.
> > > > > > > >
> > > > > > > > --- In flexcoders@yahoogroups.com, "Karl
> > > > > Johnson"
> > > > > > > karl.johnson@
> > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > When you say loop over components, do you
> > > > > mean
> > > > > > > loop over existing UI
> > > > > > > > > objects? Or do you mean create UI objects?
> > > > > > > > >
> > > > > > > > > If you are creating, then do something like
> > > > > the
> > > > > > > following to create
> > > > > > > a
> > > > > > > > > label and/or textbox control for each index
> > > > > of
> > > > > > > the array returned:
> > > > > > > > >
> > > > > > > > > For loop
> > > > > > > > > {
> > > > > > > > >  var newLabel =
> > > > > > > myVBox.createChild(mx.controls.Label,
> > > > > undefined);
> > > > > > > > >  newLabel.text = myArray[i];
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > Are we on the right path here or is this not
> > > > > > > what you are looking
> > > > > > > for?
> > > > > > > > >
> > > > > > > > > |<
> > > > > > > > >
> > > > > > > > > Karl Johnson
> > > > > > > > > Cynergy Systems, Inc.
> > > > > > > > > http://www.cynergysystems.com
> > > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: flexcoders@yahoogroups.com
> > > > > > > [mailto:[EMAIL PROTECTED]
> > > > > > > On
> > > > > > > > > Behalf Of Jeremy Rottman
> > > > > > > > > Sent: Tuesday, April 25, 2006 3:43 AM
> > > > > > > > > To: flexcoders@yahoogroups.com
> > > > > > > > > Subject: [flexcoders] Re: Looping output
> > > > > > > > >
> > > > > > > > > I am trying to loop over components. Like
> > > > > Labels
> > > > > > > and text. So
> > > > > > > depending
> > > > > > > > > on how many records I return it outputs that
> > > > > > > many sets of labels and
> > > > > > > > > text components.
> > > > > > > > > --- In flexcoders@yahoogroups.com, "Tracy
> > > > > > > Spratt" <tspratt@> wrote:
> > > > > > > > > >
> > > > > > > > > > Jeremy, have you looked at the for loops?
> > > > > > > > > >
> > > > > > > > > > for (var i:Number=0;i<myArray.length;i++)
> > > > > {
> > > > > > > > > >   oElement = myArray[i];
> > > > > > > > > > }
> > > > > > > > > >
> > > > > > > > > > Or
> > > > > > > > > >
> > > > > > > > > > for (var key in myObject) {
> > > > > > > > > >   oTemp = myObject[key];
> > > > > > > > > > }
> > > > > > > > > >
> > > > > > > > > > Tracy
> > > > > > > > > >
> > > > > > > > > > -----Original Message-----
> > > > > > > > > > From: flexcoders@yahoogroups.com
> > > > > > > [mailto:[EMAIL PROTECTED]
> > > > > > > > > On
> > > > > > > > > > Behalf Of Jeremy Rottman
> > > > > > > > > > Sent: Monday, April 24, 2006 4:50 PM
> > > > > > > > > > To: flexcoders@yahoogroups.com
> > > > > > > > > > Subject: [flexcoders] Looping output
> > > > > > > > > >
> > > > >
> > > > === 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
> >
>






--
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