I am creating an application in AS3 for a museum. I'm starting with a main menu file that has 5 buttons which call other .swf's. I'm using TweenLite to scale and move the buttons and fade the background. It worked great when it was a single frame, I've added a 2nd frame for a Credits Listing for everyone involved. When I return from this frame to the first frame through a gotoAndPlay(1); command I start pulling up all kinds of errors. I have the first error once, the #1006 error 12 times and then the #1009 error.
Error: Cannot tween a null object.
at com.greensock::TweenLite()
at com.greensock::TweenLite$/to()
at ADmain_fla::MainTimeline/gowwi()
TypeError: Error #1006: value is not a function.
at com.greensock::TweenLite/renderTime()
at com.greensock.core::SimpleTimeline/renderTime()
at com.greensock::TweenLite$/updateAll()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.greensock::TweenLite/init()
at com.greensock::TweenLite/renderTime()
at com.greensock.core::SimpleTimeline/renderTime()
at com.greensock::TweenLite$/updateAll()
Here's the setup code I'm using to initialize things and a sample of each function (note, each function and the addEventListener are repeated 4 more times for the other 4 buttons I'm using, with different instance names of course)
import com.greensock.*;
import flash.display.Sprite;
import flash.filters.GlowFilter;
import flash.filters.DropShadowFilter;
import flash.filters.BlurFilter;
import flash.media.SoundMixer;
import flash.events.MouseEvent;
import flash.net.SharedObject;
import flash.display.MovieClip;
fscommand("fullscreen", "true");
try {
new LocalConnection().connect('foo');
new LocalConnection().connect('foo');
} catch (e:*) {}
var timer:Timer = new Timer(30000);
function onTimer(evt:TimerEvent):void{
gotoAndPlay(1);}
stop();
function gocivilBtn(event:MouseEvent):void{
TweenLite.to(cw, 1, {x:35, y:39, scaleX:0.75, scaleY:0.75});
TweenLite.to(sw, 1, {x:8, y:171, scaleX:0.75, scaleY:0.75});
TweenLite.to(w1, 1, {x:32, y:330, scaleX:0.75, scaleY:0.75});
TweenLite.to(w2, 1, {x:24, y:460, scaleX:0.75, scaleY:0.75});
TweenLite.to(cw2, 1, {x:45, y:597, scaleX:0.75, scaleY:0.75});
TweenLite.to(credits, 1, {alpha:0});
TweenLite.to(bkgrnd, 1.5, {x:0, y:0, alpha:0, onComplete:CivilWar});
}
function CivilWar():void{
var myLoader:Loader = new Loader();
addChild(myLoader);
var url:URLRequest = new URLRequest("Civil War.swf");
myLoader.load(url);
}
cw.addEventListener(MouseEvent.CLICK,gocivilBtn);
NOTE: the first error says it cannot tween a null object. From what I can tell (still a noob at the whole AS3 thing) I shouldn't be doing anything with any of my objects just by going back into the first frame - nothing is tweened until a button is pressed, there should only be inactive functions at this point??