Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
mika

AutoFitArea and PinPoints

Recommended Posts

Hi,

 

I'm unclear how to achieve this :

 

I'd like to position mcs in a displayObject via TransformManager, then when the displayObject is resized, having the mcs reposition themselves with DynamicPinPoints (ie theyr newly set center x/y after transfom operations)

 

From the logic I understood, that should imply autoFitArea and PinPoints, as LiquidStage seems to be bound with the stage, which I dont need at all.

 

Any pointers ?

Link to comment
Share on other sites

I'm lost - I don't quite understand what your goal is here. Could you explain it more specifically? Got any examples?

 

DynamicPinPoints are really only intended for use with LiquidStage.

Link to comment
Share on other sites

Yep, sorry for the clumsy explanation.

 

All the demos I tried failed miserabily, and I can't disclose my project url (pm would be ok tho)

 

I set up a sketch explanation which will hopefully make it clear :

 

http://blog.mikarama.fr/astest/pinAutoFit.html

 

Can Mc 'stick' in its relative position when displayObj is resized ?

Mc is positioned with transformManager, so its position isn't fixed.

 

It sounds to me I need a mix of autoFit and liquidArea, but I myself, get lost there...

 

EDIT : maybe the best way to put it is, is there a way to use liquidStage 'pins' without using stage, but a displayContainer as the resizing area ?

Link to comment
Share on other sites

Maybe what I intended is just bad practice. I'm having acceptable results using autoFitArea. I have severals mcs positioned via TM, nested in a container. i use autoFit on that container, prop_inside, center all.

For little variations of the container ratio, its ok. It get a bit nasty when switching from a square shape to a narrow rectangle (mcs become very tiny), but thats not an usual case.

 

so autoFit suits me quite ok after all. Would like to know if the above mentioned case is possible tho (liquidStage, without stage) ?

 

If I tickled your curiosity I'd gladly send you the project url and details in pm. Ow and I'm having troubles getting autoFit and TransformManager working together but ..; thats another story ;)

 

Regards

mika

Link to comment
Share on other sites

is there a way to use liquidStage 'pins' without using stage, but a displayContainer as the resizing area ?

 

Ah yes, I think I see what you're after. It's a tricky dilemma because when you say "relative" position, it really depends on what the position is relative to - lower left corner, middle, a certain amount of padding between the object and a particular edge, etc. There are all sorts of rules that you might want to apply to it, so it's not something that sounds like a simple "yeah, throw it into an AutoFitArea and you're done" situation. Don't get me wrong - it's definitely possible to do what you're asking, but it'd take some custom engineering on your end. I don't have a ready-made class for that.

 

And to answer your question, no, you cannot use LiquidStage pins without the stage :) They're wired into LiquidStage so that their positions are updated when the stage resizes and they have internal logic that makes them update in a very specific order so that nesting can be accommodated properly. It was a pretty tricky system actually.

 

Sorry, I wish I had a simple answer for you. I'd probably use globalToLocal(), localToGlobal(), and getBounds() along with some math to position your stuff where you need it.

Link to comment
Share on other sites

Thanks for Clearing it up Jack !

Link to comment
Share on other sites

I refrained to frenetically post a follow up to the autoFit and TM problem, and quite proudly figured it (so far) myself.

 

heres a preview of what it was all about :

http://blog.mikarama.fr/astest/autoFitTransform.swf

 

you can addChild, mc* get nested in mcHolder. TransformManager Bounds are set to autoFit area (preview=true), and area is also transformable.

 

Works quite well, exept I only mcs update bounds on button click. Gotta find how to update it on SCALE event.

I coded only the SCALE event btw, don't bother moving area around.

 

fla included, switch .swf

 

mika

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