Jump to content
Search Community

9-slice scaling and parameters

Chris G test
Moderator Tag

Recommended Posts

Hello all,

 

I've run into a curious issue when using TweenMax to tween the height of a panel in a current project.

 

Here's what I'm doing:

var panel:MovieClip = commonElementsPage.panelSwf.content.panelInstance;
var textHeight:int = transitioningPage.mainHeading.height + transitioningPage.bodyCopy.height;
TweenMax.to(panel, SiteSettings.BASIC_TIME_UNIT, {height:textHeight, onComplete:fadeInText});
...

the panel variable refers to a 9-slice scaling enabled MovieClip on the stage of a loaded swf.

 

If I do the following the panel scales using the 9-slice scaling as expected:

TweenMax.to(panel, SiteSettings.BASIC_TIME_UNIT, {height:400, onComplete:fadeInText});

 

but when I pass a reference instead of a value, the 9-slice scaling ceases working:

TweenMax.to(panel, SiteSettings.BASIC_TIME_UNIT, {height:textHeight, onComplete:fadeInText});

Has anyone come across this before?

 

Many Thanks

Link to comment
Share on other sites

Have you used trace() to verify that your "textHeight" value is what you're expecting? Trust me - TweenMax doesn't care where the value came from. It doesn't handle things differently based on whether you used a variable to pass the value or just did it directly. I suspect there's just an issue with the code that sets your variable value in the first place.

 

If you still think there's a problem with TweenMax, please post an FLA that demonstrates the issue and we'll take a peek.

Link to comment
Share on other sites

Thanks for the speedy reply, the reference traced as expected.

 

Turns out that the original 9-sliced MovieClip was created at 200px as it needed a large area to stay unscaled at the bottom of the panel. Therefore the scaling broke when passed a value of less than 200px. My test values were greater than 200px so there was no problem with them.

 

My apologies for casting doubt over the mighty TweenMax - it's never let me down yet!

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