Jump to content
Search Community

Issue with AutoFitArea

roelbeckers test
Moderator Tag

Recommended Posts

Dear GreenSock and forum-members,

 

I'm building a site using the AutoFitArea feature of GreenSock.

Let me quickly explain the setting.

 

I have an swf with the menu's - let's call this one the framework.swf.

In this swf I a movieclip which will contain the content to be shown on childIndex(0) and a movieclip with two menu's (one left, one right) at childIndex(1).

Clicking an item from the menu's needs to change the content of the lower movieclip (sounds logical :)).

 

So, when a menu-item is clicked, an external swf - let's call this one content.swf - is loaded into the framework content movieclip.

This content movieclip in the framework.swf is attached to an AutoFitArea which has the same dimensions as the stage.

The content.swf has two custom made movieclips in the library which are exported for AS; one with the background and one with the content.

Within content.swf I add both custom made movielcips with addChild. Also in this swf I create another AutoFitArea for the content.

The result is that the background is perfectly adapting itself with PROPORTIONAL_OUTSIDE whenever the screen is resized. This works perfectly.

The problem is the content movievlip in content.swf. The dimensions set during init are 720x550, and when attached the movieclip I specify that the minimum size is 720x550 and no limitations for maximum size.

720 is the widht of my stage minus the width of both menus. Align mode is set two times to CENTER, and during init of the AutoFitArea I set x to stageWidth / 2 and y to stageHeight / 2.

 

When running the framework.swf and clicking the menu-item, content.swf is shown with a perfect working background, but the content itself is always messing up.

The x and y values are not always correct with the result the movieclip is never centered in my stage and background.

The size of the content is smaller than specified (i.e.: 550x410) while the movieclip has exact the same aspect ratio.

 

When running content.swf stand-alone it works fine, so I think maybe there's a conflict as I have a AutoFitArea in framework.swf and content.swf.

 

I've been playing with this already all day, without much positive results, so any tips/help are highly appreciated!

 

Hoping for some inspiring tips :)

 

Thanks in advance...

 

Cheers,

Roel

Link to comment
Share on other sites

GreenSock,

 

Thanks for your reply.

The files are ready for download at https://www.yousendit.com/download/K0JR ... ME5jR0E9PQ.

 

It all starts at inprocess > framework.fla.

When clicking the menu-item 'internal' of the left-hand menu, the file inprocess > pages > test.fla will load and this is the file where I have the issue with.

 

Thanks in advance for your help!

 

Cheers,

Roel

Link to comment
Share on other sites

It's just a logic issue, not a problem with AutoFitArea. Remember, when you scale a container MovieClip, its internal/local coordinate system doesn't change. Like if I have a "child" MovieClip that's 100x100 and it's inside a "parent" MovieClip and then I scale the parent do be 10% of its normal size, the child's width/height properties will STILL be 100x100. They will visually appear to be only 10x10 on the stage because the parent was scaled. Same for the coordinates. It sounds like you were expecting the AutoFitArea inside your child to automatically adjust its size/coordinates based on any of its ancestor's transform matrix changes.

Link to comment
Share on other sites

GreenSock,

 

Thanks again for taking the time to reply.

I was pretty sure the problem was somewhere related to me and not to the AutoFitArea functionality :o)

 

Your comments and the LiquidStage documentation (which I can play with now as we became Club member - woehoe!) gave me the correct insights and I found my error.

It's fixed now...

 

Thanks and cheers,

R.

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