Copy link to clipboard
Copied
hello there guys..,
i hope i make it cleat with the thread title, cause i'm kinda confused how to explain it in word..,
so anyway i'll describe what i mean and hope you guys can help me out..,
so here i am making a few object of action script..,
what special about this object is that in the contructor function of this object is that i make it to send a sprite parameter which will act as it's parent..,
var anObject:myObject = new myObject(parentSprite);
and in my main project i used those object and store it in an array after adding it to the stage..,
i do store it to an array cause i need to be able to refer back to it..,
everything was fine up until i need to call function inside that object which i already stored in an array..,
so how should i call the function in that object from an array that stored the object??
hope i make it clear..,
thanks in advance guys..,
Well, the error is telling you that removeChild() in destroy() function in the class Newsticker is having a problem because you are trying to remove a child doesn't belong to the parent. How does your destroy() function look like?
Copy link to clipboard
Copied
As long as the function is public, you can just call it from an Object stored in an Array, e.g.
array[0].somePublicFunction();
Copy link to clipboard
Copied
hello kennethkawamoto2
thanks for replying...,
sorry i forgot to tell you that i get this error when doing that
array[0].somePublicFunction();
this the error :
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at Newsticker/destroy()
at FlashBlocks/ClearScreen()
at FlashBlocks/exitButtonClicked()
Copy link to clipboard
Copied
Well, the error is telling you that removeChild() in destroy() function in the class Newsticker is having a problem because you are trying to remove a child doesn't belong to the parent. How does your destroy() function look like?
Copy link to clipboard
Copied
WOW!!!!
that really is the source of the problemm...,
i really do forget to use :
passedParentSprite.removeChild(displayObjectName);
instead i just write :
removeChild(displayObjectName);
thanks for pointing that out mate..,
Find more inspiration, events, and resources on the new Adobe Community
Explore Now