Jump to content
Search Community

AutoFitArea : Transforming a _MC to fit a child _mc

HaunGo test
Moderator Tag

Recommended Posts

Hello..

 

I'm hoping the AutoFitArea can conveniently handle this problem I've got.

 

I want to resize a movieclip so that a particular child element is actually shown to fit in an area. (the area is the screen)

 

For example: Imagine a movieclip named "CONTAINER_mc", and it has three areas of interest: "AREA1_mc", "AREA2_mc", "AREA3_mc", which are not the same size and are scattered around the stage. I want to be able to click on one of the child AREA#_mcs, and have its parent CONTAINER_mc re-size and position to show the selected AREA fully and proportionally on the screen.

 

I know this doesn't work because they don't share the same parent:

var autoArea:AutoFitArea = new AutoFitArea(this, 0, 0, stage.stageWidth, stage.stageHeight);
autoArea.attach(CONTAINER_mc.AREA1_mc, {scaleMode:ScaleMode.PROPORTIONAL_INSIDE});

 

I understand why that doesn't work, and it makes perfect sense.. .. .. but is there are a way? with certain parameters?

 

Does that make sense?

 

Any help is greatly appreciated.. THANKS!

Link to comment
Share on other sites

Holy Shnikeys! That exactly does what I want to do ! Perfect.. thank you! GREENSOCK once again comes through with ease and grace!

 

var autoArea:AutoFitArea = new AutoFitArea(this, 0, 0, stage.stageWidth, stage.stageHeight);
autoArea.attach(CONTAINER_mc, {scaleMode:ScaleMode.PROPORTIONAL_INSIDE, customBoundsTarget:CONTAINER_mc.AREA1_mc});

 

 

Cool 8-)

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