Thanks DUDE!!! The issue was in
DC.name = "dataCard" + i;
Didn't know the name property.
Thanks
On Sat, Mar 15, 2008 at 7:46 PM, Rich Shupe <[EMAIL PROTECTED]> wrote:
> Your code does what you're asking but I suspect you're having trouble with
> the positioning, or something similar. Since DC has no initial y, all
> instances will end up at 30, using the code below.
>
> Here's an adaptation that shows two visual results: position and trace,
> using the instance name request you mentioned. Note that, when adding an
> instance name programmatically, you can't refer that instance by name the
> same way you can when creating the instance name in the IDE. You must use
> getChildByName() instead.
>
> var dataLength:int = 5;
>
> for(var i = 0; i<dataLength; i++) {
> var DC:DataCard = new DataCard();
> DC.x = Math.random()*550;
> DC.y = Math.random()*400;
> DC.name = "dataCard" + i;
> addChild(DC);
> trace(getChildByName("dataCard"+i).name);
> }
>
> Rich
>
> > In AS3 I tried the follwoing
> >
> > for(var i = 0; i<dataLength; i++) {
> > var DC:DataCard = new DataCard();
> > DC.y += 30;
> > }
> >
> > What comes up is an only one instance of the movieClip as in one
> replaces
> > the one before.
> >
> > Is there another way to achieve this? How can I add instance name to the
> > MovieClip using the i from the loop?
>
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
--
Omar M. Fouad - Digital Emotions
http://www.omarfouad.net
This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders