I need to apologize for my ignorance, I am really new to all of this. I really need help with this!
I have a bunch of movie clips which I am adding to my stage using addChild, I need each clip to “fade in” when it is added. I made it work for one movie clip using this function on the movie clip itself
this.alpha = 0;
function imgAlpha(e:Event):void {
this.alpha += .08;
if (this.alpha >= 1) {
this.removeEventListener(Event.ENTER_FRAME, imgAlpha);
}
}
This works great, I could copy this into all 100 or so movie clips that need it but I would REALLY like to be able to change things like this.alpha += .08; in ONE place and have it affect every single movie clip.
My noob brain thinks that something like a “global function” sounds logical. I’d love to put the above function on Frame One of the parent and just call it from each movie clip. Then I could make a change on only that function to change all the movie clips at once.
The problem is I don’t know if such a thing exists. I’ve done a bunch of searching and I keep seeing things like “public function”, “package” and “public class”. I read a bunch of this and my brain started smoking. I think that since I don’t know the basic underlying concepts for those things that I am just not getting it.
Can I make a Global Function and call it from children added using addChild? Please help!!