views:

73

answers:

1

I have some movieclips on my main timeline with a class to extend these movieclips

ClickableMovieClip.as:

package {
    import flash.display.MovieClip;
    import flash.events.*;
    public class ClickableMovieClip extends MovieClip {
        public function ClickableMovieClip():void {
            this.buttonMode = true;
            this.addEventListener(MouseEvent.MOUSE_UP, onReleaseHandler);
        }
        public function onReleaseHandler(myEvent:MouseEvent) {
            //trace(" > "+this.name);
            testing();
        }
    }
}

And on my maintime line I have this function testing();

function testing(){
     trace("hello world!");
}

But the I can't 'reach' the testing function. I get this error: "1061: Call to a possibly undefined method testing through a reference with static type flash.display:DisplayObjectContainer."

What am I doing wrong?

A: 

First of all, how are you connecting your AS3 class to the stage? Importing it in a frame or using it as the Document Class?

This may have to do with inheritance.

Second, you may need to call it using (root As MovieClip).testing() or something like that. The idea is that you need to call it as a method of the stage or root. I don't remember exactly how it works.

EDIT:

As you said MovieClip(parent).testing(); is the answer. I forgot the exact syntax before...

Moshe
Thanks for pointing me in the right direction!MovieClip(parent).testing(); was the trick for me
Edwinistrator
Ah, sounds right. Good going and Good Luck!
Moshe
If that fixed your problem then you should mark the answer as correct. Just a thought.
goliatone