Jump to content
Search Community

Declaring object variable shows errors?

JoeWillmott test
Moderator Tag

Recommended Posts

I have a bunch of TweenLite stuff working wonderfully by adding the AS3 code on the timeline. Now I am trying to add a MovieClip dynamically with: 

 

var blackfadeMC:blackFade = new blackFade();

addChild(blackFadeMC);

 

Inside the blackFade.as class I have some TweenLite stuff going on that works fine if I just drag and drop the MovieClip to the stage, but when I add it dynamically with the code above, I get these errors:

 

 

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at blackFade/fadeOut()[/users/joe/Documents/Work/Kim's Castle/blackFade.as:20]
at com.greensock.core::TweenCore/complete()[/users/joe/Documents/Work/Kim's Castle/com/greensock/core/TweenCore.as:178]
at com.greensock::TweenLite/renderTime()[/users/joe/Documents/Work/Kim's Castle/com/greensock/TweenLite.as:477]
at com.greensock.core::SimpleTimeline/renderTime()[/users/joe/Documents/Work/Kim's Castle/com/greensock/core/SimpleTimeline.as:93]
at com.greensock::TweenLite$/updateAll()[/users/joe/Documents/Work/Kim's Castle/com/greensock/TweenLite.as:642]
 
 
I have noticed it's the first line, where I declare the object variable, that is causing the problems. If I comment my two lines of code out then there's no errors, but if I just uncomment that line beginning with "var" then it spazzes out again.
 
New to TweenLite so if it's something obvious I do apologise! Thanks for the help :)
Link to comment
Share on other sites

Hi and welcome to the GreenSock forums. Seems to be just a simple capitalization error in the code you posted:

 

var blackfadeMC:blackFade = new blackFade();
addChild(blackFadeMC);
 
Don't worry about it. It happens 100 times to everyone.
 
Happy Tweening
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...