2 Replies Latest reply on Apr 26, 2007 10:10 AM by maijakg

    named function fails inside of onEnterFrame

      EDIT: the following is ActionScript 2.0 in Flash 8 btw.

      I have created a custom class (FigureBubble extends MovieClip) that contains a function to add a text bubble to a movie clip (addBubble(myClip:MovieClip, myTarget:String)). I created another custom class to extend this class called FigurePopUp which calls addBubble from an onRelease event. This works. It also works in other class extensions I've made that call it onRollover and onPress. In this case I want the movieClip being clicked to trigger an animation movie clip to play and only when the animation is finished, call addBubble and attach the text bubble, preferrably to the movie clip itself (which I can do when addBubble is just in the onRelease call).

      Maybe there's a better way to do this, but inside the animation I created a Boolean variable on the first frame called "animDone" set to "false". When the animation gets to the last frame, animDone is set to "true". In my FigurePopUp script, I have the "on Release" and inside that trigger the animation and add an onEnterFrame event to the animation to check the variable animDone. When animDone is "true", addBubble should be called. Problem is, it doesn't work. I put a trace in the first line of addBubble and it's not being called at all.

      I know it must be a scoping problem, but I just can't see the way through.

      Any help would be appreciated.