Jump to content
Search Community

#1006 & #1009 errors TweenLite

heartwood printing test
Moderator Tag

Recommended Posts

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??

Link to comment
Share on other sites

nothing jumps out at me for being the definitive cause of the error.

 

 

I would suggest removing all the button code except for one button and then run a few traces on the objects that are being tweened:

 

trace(cs)

trace(cw) etc

 

and try to detect which object is the null object.

 

 

 

when you gotoAndPlay(1) all that initialization code is being executed again. (yes the tweens shouldn't be running as you stated) I don't know what is happening in frame 2. perhaps something is being removed.

 

In general I would just recommend not jumping back and forth between frames. It everything is on stage in frame 1, there is no need to go to frame 2 for anything, just show/hide the relevant clips. You can also grab the credits assets from the library when needed and remove them when you are done.

 

---

 

if your errors persists, feel free to attach a zip of your fla that contains minimal code and assets to re-produce the errors

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...