Jump to content
Search Community

timeLineLite issues [SOLVED]

willwork test
Moderator Tag

Recommended Posts

I've got one timelineLite to work and one doesn't - even though they BOTH throw an error of:

Error #1009: Cannot access a property or method of a null object reference.

 

This one doesn't work at all:

var myTimeline:TimelineLite = new TimelineLite({tweens:[new TweenLite(enterMC, 0, {x:enterMC.parent.mouseX, y:enterMC.parent.mouseY}), TweenLite.to(enterMC, .3, {autoAlpha:1})], align:TweenAlign.SEQUENCE});

 

Even though this works fine:

TweenLite.to(enterMC,.2,{x:enterMC.parent.mouseX, y:enterMC.parent.mouseY, autoAlpha:1});

 

So I know the objects are there and declared, but I get the error. Could this be a v11 bug?

Link to comment
Share on other sites

There's one key difference between the tween that you said was broken and the one that wasn't - the duration. Remember, by default, a tween with a duration of 0 is rendered IMMEDIATELY. So if enterMC.parent isn't valid immediately, it'll throw an error. You can set immediateRender:false to prevent the tween from rendering right away and instead it'll get rendered on the following frame (when the timeline renders). Have you tried to trace(enterMC.parent.mouseX) right above where you create the timeline? Does it trace null?

Link to comment
Share on other sites

The timeLineLite is being executed on a delay, so the objects should be valid.

 

I somehow got one of them working, even though it still throws the null object error.

var myTimeline:TimelineLite = new TimelineLite({tweens:[new TweenLite(quote1, .3, {alpha:1}), TweenMax.to(quote1, 1, {x:380})], align:TweenAlign.SEQUENCE});

 

quote1 does fade up and move, but I'm getting a null object error. Is there something wrong with the above code? Am I not importing something?

Link to comment
Share on other sites

Very tough to say without seeing your FLA and the rest of your code. You're absolutely positive that quote1 exists when you're trying to reference them in the creation of your tweens? Try doing a trace(quote1) right above where you create your timeline. If it's null, that's your problem.

Link to comment
Share on other sites

I solved it and I apologize for being so imprecise with my code. I'm using Gaia, by the way, and I didn't comment out the import gs.* that comes built in with the class paths. SO, when I commented it out, everything works the way it should without errors. I believe the null object was the conflict that I was importing both v10 and v11. Hopefully, this will spare anyone else from the issues....

Thanks for listening, Greensock!

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