12-23-2010 10:47 AM
Okay, so with my app, I'm able to update the htmlText values of TextFields as the app is being used, and I update an image that is placed on the stage, however I don't exactly know if its just a new image being placed over top over and over again....
..so is there a way I can check how many instances of my image there are after running a few tests in my app (that would have produced a new version of the image a few times)
12-23-2010 11:13 AM
You could do something like this, inside your container:
for(var i:int = 0; i < numChildren; i++){
trace(getChildAt(i));
}
Better to just go look at your code and make sure you're using the same image instance, don't create a new one each time.
12-23-2010 11:15 AM
You could profile it.
12-23-2010 11:45 AM
Specifically for images, try:
var display_obj : DisplayObject;
var i : int;
for( i=0; i < this.numChildren; i++ )
{
display_obj = this.getChildAt( i );
if( display_obj is Image )
{
// is image
}
}
12-23-2010 02:30 PM - edited 12-23-2010 02:30 PM
"this."? We're not in javascript here ![]()
Kidding... just been doing lots of JS lately, and it's nice to not have to do that **bleep** in AS3 ..
12-23-2010 02:57 PM
'this' predates JS many years (early C++) and is good OO practice. But we can all code the way that is most comfortable.