1

So I'm having a very frustrating problem in CS5, where I am simply unable to get as3 to recognize movie clips! If the symbol I'm trying to reference is a button everything works fine, but the second I turn it into a movie clip it spits the following error out at me:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at PheV3_fla::MainTimeline/frame184()

Even though the object is clearly there because as soon as I turn it back into a button instead of movie clip it works fine. Anyone have any ideas? Here's an example of the code I'm working with, just a simple web page link:

Testing.addEventListener(MouseEvent.CLICK,goThere);
function goThere(e:MouseEvent){
    var request:URLRequest = new URLRequest("http://www.adobe.com/");
    navigateToURL(request);
}

1 Answers1

0

In AS3 movie clips do not act like buttons just because they have listeners, you have to tell them that they are buttons. Add the following line of code before the call to the addEventListener() method:

Testing.buttonMode = true;

And make sure that Testing object actually exists and is accessible from the place where it's called from.

If the object is in the scene make sure it's name is set correctly. If it's created dynamically make sure you actually created it calling the new operator.

http://blogs.adobe.com/pdehaan/2006/07/creating_clickable_movie_clips.html

Kolyunya
  • 5,973
  • 7
  • 46
  • 81