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 Function/http://adobe.com/AS3/2006/builtin::apply()
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