Hi Cor, 
 
Right. I know all that. The question is why doesn't 
 
        stage.addChildAt(customCursor, stage.numChildren); 
 
trigger a RangeError? 

Regards, 

-Keith 
http://keithreinfeld.home.comcast.net
 


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Cor
> Sent: Friday, November 14, 2008 12:38 PM
> To: 'Flash Coders List'
> Subject: RE: [Flashcoders] ComboBox + Custom Cursor , AS3
> 
> It is not a bug.
> The displayList stores it objects in a Array, wich starts at 0.
> So Array["obj1","obj2","obj3","obj4"] has 4 children wich are located at
> position 0, 1, 2, 3.
> If you remove a child every other moves up 1 place.
> 
> So stage.numChildren is accordingly out of range.
> 
> HTH
> C
> 
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Keith
> Reinfeld
> Sent: vrijdag 14 november 2008 18:57
> To: 'Flash Coders List'
> Subject: RE: [Flashcoders] ComboBox + Custom Cursor , AS3
> 
> Joel,
> 
> Another good optimization point, Joel. If we assume that Karim's custom
> cursor is already a child of the stage, then setChildIndex() should be
> more
> efficient. So I guess it depends on the implementation.
> 
> Interestingly,
> 
> I get a RangeError with this:
> 
>       stage.setChildIndex(customCursor, stage.numChildren);
> 
> but this works:
> 
>       stage.setChildIndex(customCursor, stage.numChildren - 1);
> 
> However,
> 
>       stage.addChildAt(customCursor, stage.numChildren);
> 
> does not trigger the RangeError, and
> 
>       stage.addChildAt(customCursor, stage.numChildren - 1);
> 
> still produces the desired result.
> 
> If this is a bug then 'stage.numChildren - 1' would be the safe way to go.
> 
> Regards,
> 
> -Keith
> http://keithreinfeld.home.comcast.net
> 
> 
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:flashcoders-
> > [EMAIL PROTECTED] On Behalf Of Joel Stransky
> > Sent: Friday, November 14, 2008 10:25 AM
> > To: Flash Coders List
> > Subject: Re: [Flashcoders] ComboBox + Custom Cursor , AS3
> >
> > Very nice Keith. Wouldn't setChildIndex() work as well? Or is
> addChildAt()
> > better for ensuring that the cursor is added to the display list?
> >
> > On Fri, Nov 14, 2008 at 11:08 AM, Keith Reinfeld
> > <[EMAIL PROTECTED]>wrote:
> >
> 
> 
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.175 / Virus Database: 270.9.3/1788 - Release Date: 14-11-2008
> 13:36
> 
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to