Skip to main content
Participant
September 6, 2018
Question

Type Error #1009

  • September 6, 2018
  • 3 replies
  • 248 views

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

This topic has been closed for replies.

3 replies

Participant
September 7, 2018

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?

JoãoCésar17023019
Community Expert
Community Expert
September 6, 2018

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

Robert Mc Dowell
Legend
September 6, 2018

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);