var bitmap:Bitmap = new Bitmap();
bitmap = spritesArray[selectedIndex].getChildAt(0) as Bitmap; //first child is the loaded Bitmap
trace("NUMBER BEFORE: " + spritesArray[selectedIndex].numChildren);
imageHolder.addChild(bitmap);
trace("NUMBER AFTER: " + spritesArray[selectedIndex].numChildren);
---------
OUTPUT:
NUMBER BEFORE: 1
NUMBER AFTER: 0
---------
Why?
I'm trying to use spritesArray as container of Sprites, on which I put loaded Bitmaps - as box of photos in a frame.
When I want to add the Bitmap to imageHolder, it obviously gets deleted from spritesArray. Isn't that only a reference. I get it that any Object can only be a child of oneObject (if they are visible), but spritesArray is not added as child anywhere - so Bitmaps inside it are not visible anywhere else. Or am I missing something big?
What is a solution, to copy it back after it is switched? To duplicate it? Bummer, really.
Thanks for help in advance.
bitmap = spritesArray[selectedIndex].getChildAt(0) as Bitmap; //first child is the loaded Bitmap
trace("NUMBER BEFORE: " + spritesArray[selectedIndex].numChildren);
imageHolder.addChild(bitmap);
trace("NUMBER AFTER: " + spritesArray[selectedIndex].numChildren);
---------
OUTPUT:
NUMBER BEFORE: 1
NUMBER AFTER: 0
---------
Why?
I'm trying to use spritesArray as container of Sprites, on which I put loaded Bitmaps - as box of photos in a frame.
When I want to add the Bitmap to imageHolder, it obviously gets deleted from spritesArray. Isn't that only a reference. I get it that any Object can only be a child of oneObject (if they are visible), but spritesArray is not added as child anywhere - so Bitmaps inside it are not visible anywhere else. Or am I missing something big?
What is a solution, to copy it back after it is switched? To duplicate it? Bummer, really.
Thanks for help in advance.