Jump to content
Search Community

TimeLineMax with TweenMax

MrDevinB test
Moderator Tag

Recommended Posts

I am having some problems using TimeLineMax together with TweenMax. I just don't think that what I am trying to do is supported.

 

I am trying to using TweenMax.allTo within a TimeLineMax append. I want an array of items to move together. Here is a sample of what I have. I am a Really Green Member.

 

import com.greensock.plugins.*;

import fl.transitions.*;

import fl.transitions.easing.*;

import flash.geom.Point;

 

TweenPlugin.activate([TransformAroundPointPlugin]);

 

var trianlge_array:Array = [green_triangle,green_txt_mask,blue_triangle,blue_txt_mask];

var myTimeLine:TimelineMax = new TimelineMax();

 

myTimeLine.append(TweenMax.allTo(trianlge_array, 1, {transformAroundPoint:{point:new Point(-420,2090), rotation:50},ease:Linear.easeNone}));

 

 

I keep getting this error.

 

1067: Implicit coercion of a value of type Array to an unrelated type com.greensock.core:TweenCore.

Link to comment
Share on other sites

You're going to want to use appendMultiple which accepts an array, so your code would look like:

import com.greensock.plugins.*;
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.geom.Point;

TweenPlugin.activate([TransformAroundPointPlugin]);

var trianlge_array:Array = [green_triangle,green_txt_mask,blue_triangle,blue_txt_mask];
var myTimeLine:TimelineMax = new TimelineMax();

myTimeLine.appendMultiple([TweenMax.allTo(trianlge_array, 1, {transformAroundPoint:{point:new Point(-420,2090), rotation:50},ease:Linear.easeNone})]);

Link to comment
Share on other sites

Ok I got that going, but is there a way to use appendMultiple to add several TweenMax.allTo? Like this.

 

myTimeLine.appendMultiple([TweenMax.allTo(trianlge_array, 1, {transformAroundPoint:{point:new Point(-420,2090), rotation:50},ease:Linear.easeNone}),

TweenMax.allTo(blue_array, 1, {transformAroundPoint:{point:new Point(-420,2090), rotation:50},ease:Linear.easeNone})]);

 

 

Thanks

 

Devin

Link to comment
Share on other sites

The problem with your code is that you'd end up passing an array of arrays which won't work. You could, however, use array's concat() method to combine the results of the allTo() calls, like:

 

myTimeLine.appendMultiple(TweenMax.allTo(trianlge_array, 1, {transformAroundPoint:{point:new Point(-420,2090), rotation:50},ease:Linear.easeNone}).concat(TweenMax.allTo(blue_array, 1, {transformAroundPoint:{point:new Point(-420,2090), rotation:50},ease:Linear.easeNone})) );

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