Copy link to clipboard
Copied
Hi, I created a movie that has six movie clip symbols on the stage, three of them are animated controlled by ActionScript. I am trying to created a class file that uses the transition manager to control the remaining movie clip symbols. When I test the movie I get this error.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at fl.transitions::TransitionManager$/start()
at math_Exchange()
I can't figure out what's wrong. Here is the class file.
package {
import flash.display.MovieClip;
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.events.Event;
import flash.events.MouseEvent;
public class math_Exchange extends MovieClip {
public function math_Exchange() {
// constructor code
TransitionManager.start(lion1,{type:Fly, direction:Transition.IN, duration:6, easing:Strong.easeOut});
TransitionManager.start(lion2,{type:Fly, direction:Transition.IN, duration:4, easing:Strong.easeOut});
TransitionManager.start(lion3,{type:Fly, direction:Transition.IN, duration:2, easing:Strong.easeOut});
}
}
}
Any help is appreciated
Copy link to clipboard
Copied
This error means that there are some mc are not set before you run the function.
be sure to start anything after the constructor is created.
just add in your constructor addEventListener(Event.ADDED_TO_STAGE,myFunction);
Copy link to clipboard
Copied
Hi.
Adding to what Robert said, the error is saying that some of the instances you're targeting (lion1, lion2, and lion 3) are not available when the class initializes.
I run a test here and it worked OK. All of my instances are in the first frame and I set your class as the document class.
Regards,
Jc
Copy link to clipboard
Copied
Ok that makes sense. Right now the mc symbols lion1, lion2, and lion3 are not in frame 1 they are in frame 2. Is there a way to rewrite it so the class initializes in frame 2?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now