tean Posted November 4, 2009 Share Posted November 4, 2009 i have 3 moviclips on the stage named q0,q1,q2. var arr:Array = [q0,q1,q2]; for (var k:int = 0; k < 5; k++) { trace(arr[k]); TweenLite.to( arr[k], 1, { y: 100 }); } last 2 will be undefined but it wont throw an error... this is meant to be? Link to comment Share on other sites More sharing options...
GreenSock Posted November 4, 2009 Share Posted November 4, 2009 Yep. It will throw an error when the tween actually renders, but remember that one of the goals of TweenLite is to remain very efficient and small, so I haven't added lots of conditional logic to remind people not to tween null objects, etc. Link to comment Share on other sites More sharing options...
tean Posted November 5, 2009 Author Share Posted November 5, 2009 but I am not getting any error if i try that. Link to comment Share on other sites More sharing options...
GreenSock Posted November 5, 2009 Share Posted November 5, 2009 Not sure what to tell you. This is weird - usually people want my help getting rid of errors, not producing them If you want to put together an FLA that demonstrates the problem, I'd be happy to take a peek. Link to comment Share on other sites More sharing options...
tean Posted November 5, 2009 Author Share Posted November 5, 2009 sure, it cant be any simpler... ofcourse, maybe i am missing something even if i write it like this i get nothing: import gs.TweenLite; var arr:Array = [q0,q1,q2]; for (var k:int = 0; k < 5; k++) { try { TweenLite.to( arr[k], 1, { y: 100 }); } catch (e:Error) { trace(e); } } Link to comment Share on other sites More sharing options...
GreenSock Posted November 5, 2009 Share Posted November 5, 2009 Yep, as expected, I got an error the first time the tween tried to render: 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() The constructor shouldn't throw an error anyway because you could conceivably create a tween with a null target if you wanted to just use an onComplete or something. Not that I'd recommend it, but it's certainly possible. By the way, I'd highly recommend upgrading to v11 by the way - looks like you're still using the old v10 or before. Link to comment Share on other sites More sharing options...
tean Posted November 5, 2009 Author Share Posted November 5, 2009 well, i am not getting an error, dont really know why, probably my flash cs3 is gone crazy... Link to comment Share on other sites More sharing options...
TronicVolta Posted November 5, 2009 Share Posted November 5, 2009 That behavior was changed once TweenCore was introduced in v11. If you want to see the 1009 error , try removing this from the TweenLite constructor: if ($target == null) { return } Link to comment Share on other sites More sharing options...
tean Posted November 5, 2009 Author Share Posted November 5, 2009 thank you for this, you are right, i thought something was wrong with my compiler btw, greensock could have done it like this: if ($target == null) { throw new Error("damn, these words are expensive :)"); return } Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now