Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
New Contributor
vidyasekar
Posts: 7
Registered: ‎10-22-2010
My Device: Not Specified
Accepted Solution

Blackberry Playbook sprite removechild and display objects

hi friends..

 

i m using sprite object to display the items...

 

while deleteing objects using removeChild() method from a group of objects, the object is deleted which is created last...

 

i want to remove all the objects from the sprite...

 

anybody knows share here..

 

thanks

Please use plain text.
Developer
gluth
Posts: 192
Registered: ‎09-23-2009
My Device: 9860/PlayBook/Dev Alpha
My Carrier: Plus GSM

Re: Blackberry Playbook sprite removechild and display objects

Have you tried to put all controls (or fields) in one container (or sprite) to have only one item to remove? This seems more object oriented, but you may use numChildren property which will inform you how many childrens this object has (then just use removeChildAt counting from number of childs towards to one).

 

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObjectContai...

Found my post helpfull? Like it! It solves your trouble? Help others and accept it as solution. Search before asking.
My apps: Secret Cod3s | Should my tablet be banned?
--
Jakub Nietrzeba
PGS Software S.A.
Your reliable partner in Poland - IT Outsourcing - BlackBerry, iPhone, Web and Standalone applications
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Blackberry Playbook sprite removechild and display objects

Some containers have a removeAllChildren() method, otherwise, you will need to do what gluth suggested:

 

while( this.numChildren > 0 )
{
  this.removeChildAt( 0 );
}

 

Please use plain text.
New Contributor
vidyasekar
Posts: 7
Registered: ‎10-22-2010
My Device: Not Specified

Re: Blackberry Playbook sprite removechild and display objects

thanks my friend...

 

but that routine clear all the objects in the sprite or the display container...

 

i want to delete the objects except the last created...

 

i will try in stack concept...

 

tks...

Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Blackberry Playbook sprite removechild and display objects

In that case, you can do:

while( this.numChildren > 1 )
{
  this.removeChildAt( 0 );
}

 

Please use plain text.