Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Type Error #1009

New Here ,
Sep 05, 2018 Sep 05, 2018

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

TOPICS
ActionScript
221
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Sep 06, 2018 Sep 06, 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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 06, 2018 Sep 06, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 06, 2018 Sep 06, 2018
LATEST

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines