Jump to content
Search Community

Need Help Converting to Object Oriented Syntax

BullDurham test
Moderator Tag

Recommended Posts

I need to change this line to the object oriented syntax version:

TweenMax.allFrom(eforeaSpaArray, 1, {y:-29, autoAlpha:0, ease:Cubic.easeOut}, .05);

 

I have attempted many ways feeling like this is the closest but still received errors:

var orbTween:TweenMax = TweenMax.allFrom(eforeaSpaArray, 1, {y:-29, autoAlpha:0, ease:Cubic.easeOut}, .05);

 

returning the error:

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

 

I can get .to and .from to work fine when using a movieClip as the target but not when I use .allFrom or .allTo with an array as the target.

 

Any advice would be greatly appreciated!

Link to comment
Share on other sites

Hi Bull,

 

yeah, allFrom creates and returns an array of tweens, thus the error.

 

to make your code not throw errors you would do

 

var orbTweens:Array = TweenMax.allFrom(eforeaSpaArray, 1, {y:-29, autoAlpha:0, ease:Cubic.easeOut}, .05);

 

..but I don't know how useful that is.

 

if you need to be able to control your allFrom tweens via a common reference such as

 

orbTweens.play()

orbTweens.reverse();

 

you could use appendMultiple with TimelineLite/Max and then control the tweens via the timeline instance.

 

if you need more help let me know

 

Carl

Link to comment
Share on other sites

Hey Carl,

To give a little background I have an array of orbs that will tween down to a location on a map(the map also has zoom capabilities). This particular project is a reduced version of a much larger project, doing my best to reduce the amount of re-coding that might be required.

 

The issue is that when a user clicks to zoom the map and the orb tweens are not finished they stop and are then locked at the incorrect ending location. I'd like for the orbs to snap to their correct locations.

 

This undesired action only occurs when the map is clicked during/before the Orb tweens have been completed. The map MC is also the parent to each Orb MC( is this possible an overwrite happening?)

 

Well if you have any advice that would be greatly appreciated as always, and I look forward to your next as3 contest!

Link to comment
Share on other sites

hmmm. I don't understand why the orbs would stop tweening just because their parent (the map) is scaling. very odd.

 

here is how I would force my orbs to finish their tweens

 

var orbTimeline:TimelineMax = new TimelineMax({paused:true});

orbTimeline.appendMultiple(TweenMax.allFrom(eforeaSpaArray, 1, {y:-29, autoAlpha:0, ease:Cubic.easeOut}, .05));

 

at somepoint you will have to tell this timeline to play via orbTimeline.play();

 

to force the timeline and its tweens to finish do

 

orbTimeline.currentProgress=1;

 

---

 

i would much rather provide a solution to the tweens abruptly stopping than a crude work-around.

 

the orbs really should be tweening even if the map was spinning, scaling and fading in and out.

 

Overwrite issues as far as I'm aware only come into play when you are doing multiple tweens on the same object so I don't think that's what it is.

 

If you can somehow reproduce this undesired behavior in a simplified fla I'll definitely take a look at it.

 

Carl

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