Jump to content
Search Community

Help casting Tween Type

retropunk test
Moderator Tag

Recommended Posts

Hi guys, check it out.

I am working on an animation and I need to declare the animation style in a global variable like this:

private var tweenStyle:Object = Quad.easeInOut;

 

setting tweenStyle as an Object doesn't seem right. It works but I get this warning in Flash:

"Warning: Filter will not render. The DisplayObject's filtered dimensions (53687120, 20132662) are too large to be drawn."

 

I tried setting it as a String, but that doesn't work.

private var tweenStyle:String = "Quad.easeInOut";

 

Any ideas?

Thanks!

- Patrick

Link to comment
Share on other sites

Yeah I'm not sure why I'm getting that warning.

 

What I'm trying to do is just to have a global variable with a tween type

private var tweenStyle:Object = Quad.easeInOut;

 

Because in this particular file there are about 60 animations all using the same tween type.

So instead of find and replace every time, I could use a variable.

 

I just don't know what to set as the type.

Make sense?

Link to comment
Share on other sites

There are 2 things you can do:

 

1: declare a defaultEase which all tweens will use unless otherwise specified

 

TweenLite.defaultEase = Quad.easeInOut;

TweenLite.to(mc, 1, {x:100}); //will use Quad.easeInOut;

 

2: declare a variable the refers to the easing function you want to use

 

var myEase:Function = Quad.easeInOut;

TweenLite.to(mc, 1, {x:100, ease:myEase}); // will use Quad.easeInOut

 

If there are multiple properties that are going to be common to multiple tweens you can assign a generic vars object that can be re-used

 

var myVars:Object = new Object();
myVars.x = 100;
myVars.y = 200;
myVars.alpha = .5;

TweenLite.to(mc, 1, myVars);
TweenLite.to(mc2, 1, myVars);

Link to comment
Share on other sites

"Warning: Filter will not render. The DisplayObject's filtered dimensions (53687120, 20132662) are too large to be drawn."

 

This error is definitely related to the article X10 linked you. Filters include blur, drop shadow, glow etc, and remember, filters are applied to the entire DisplayObject, not just the part you can see on the stage 'viewport'.

 

I would enable debugging (Publish Settings > Permit debugging?) to find the line and specific tween that is causing issues. This will essentially add line numbers to the flash errors that are output to trace. Very handy tweak, but don't forget to turn this off in production code.

Link to comment
Share on other sites

Jamie:

It seems that warning is a separate issue not related to my initial question. So thanks for making me look twice! I'll need to set aside time to look at these assets I've been given and see whats up. There might be som funky Illustrator stuff going on. Thank you!

 

Carl:

Thanks for the multiple solutions #2 is EXACTLY what I was looking for. I was originally using Object but I knew it was wrong.

Thanks a million!

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