[FLASH 8] zooming an mc at specific mouse _X and _Y

  • rtank
  • Newbie
  • Newbie
  • rtank
  • Posts: 6

Post 3+ Months Ago

Hi everybody,

I need help with this issue:

I got an mc that I want to zoom.
Problem is, I want the zoom to happen accordingly to the exact spot clicked by the mouse pointer.

I'd like it to fit with the following exhsisting code:
Code: [ Select ]
function zoom (mc, start, end, time)
{
    type = mx.transitions.easing.Strong.easeOut;
    zoomx = new mx.transitions.Tween(mc, "_xscale", type, start, end, time, true);
    zoomy = new mx.transitions.Tween(mc, "_yscale", type, start, end, time, true);
} // End of the function
  1. function zoom (mc, start, end, time)
  2. {
  3.     type = mx.transitions.easing.Strong.easeOut;
  4.     zoomx = new mx.transitions.Tween(mc, "_xscale", type, start, end, time, true);
  5.     zoomy = new mx.transitions.Tween(mc, "_yscale", type, start, end, time, true);
  6. } // End of the function

Can you help me?

Thank you so much in advance
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

what do you mean happen at the spot a mouse click occurs? your zoom is really just making the mc larger. Do you want the mc to center where your mouse clicked?
  • rtank
  • Newbie
  • Newbie
  • rtank
  • Posts: 6

Post 3+ Months Ago

graphixboy wrote:
Do you want the mc to center where your mouse clicked?


Exactly! :multi:

first click = zoom in (to say, 50% enhancement) where mouse is clicked;

second click = zoom out (reset to the original mc size);

Something like this

But it seems like I'm reaching for the stars :cry:
  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Posts: 1828
  • Loc: In the Great White North

Post 3+ Months Ago

ok you can modify your function like this. (Assuming that the registration point is in the center of your movieclip

Code: [ Select ]
function zoom (mc, start, end, time)
{
type = mx.transitions.easing.Strong.easeOut;
zoomx = new mx.transitions.Tween(mc, "_xscale", type, start, end, time, true);
zoomy = new mx.transitions.Tween(mc, "_yscale", type, start, end, time, true);
movex = new mx.transitions.Tween(mc, "_x", type, mc._x, _root._xmouse, time, true);
movey = new mx.transitions.Tween(mc, "_y", type, mc._y, _root._ymouse, time, true);
} // End of the function
  1. function zoom (mc, start, end, time)
  2. {
  3. type = mx.transitions.easing.Strong.easeOut;
  4. zoomx = new mx.transitions.Tween(mc, "_xscale", type, start, end, time, true);
  5. zoomy = new mx.transitions.Tween(mc, "_yscale", type, start, end, time, true);
  6. movex = new mx.transitions.Tween(mc, "_x", type, mc._x, _root._xmouse, time, true);
  7. movey = new mx.transitions.Tween(mc, "_y", type, mc._y, _root._ymouse, time, true);
  8. } // End of the function
  • rtank
  • Newbie
  • Newbie
  • rtank
  • Posts: 6

Post 3+ Months Ago

Thank you again for posting, pal...

It took me the last 2 days to test the code you kindly sent me through this board, and even though the .swf seems like zooming accordingly to an ever changing mouse position...it feels like it's not zooming in the exact spot where the mouse is...kinda like a "reverse" zooming... :(

I've posted the results for you to check and (hopefully) for you to give me a little bit more of...hope. :cry:

Thanks for now and If you wanna give up, no problem...I'll be samely grateful to you. :wink:
  • munni
  • Born
  • Born
  • munni
  • Posts: 3

Post 3+ Months Ago

hello sir,

I want Dynamic photo gallery with flash useing XML.


Thank,s
  • derekcfoley1
  • Born
  • Born
  • derekcfoley1
  • Posts: 2

Post 3+ Months Ago

Code: [ Select ]
function zoom (mc, start, end, time)
{
type = mx.transitions.easing.Strong.easeOut;
zoomx = new mx.transitions.Tween(mc, "_xscale", type, start, end, time, true);
zoomy = new mx.transitions.Tween(mc, "_yscale", type, start, end, time, true);
movex = new mx.transitions.Tween(mc, "_x", type, mc._x, _root._xmouse, time, true);
movey = new mx.transitions.Tween(mc, "_y", type, mc._y, _root._ymouse, time, true);
} // End of the function
  1. function zoom (mc, start, end, time)
  2. {
  3. type = mx.transitions.easing.Strong.easeOut;
  4. zoomx = new mx.transitions.Tween(mc, "_xscale", type, start, end, time, true);
  5. zoomy = new mx.transitions.Tween(mc, "_yscale", type, start, end, time, true);
  6. movex = new mx.transitions.Tween(mc, "_x", type, mc._x, _root._xmouse, time, true);
  7. movey = new mx.transitions.Tween(mc, "_y", type, mc._y, _root._ymouse, time, true);
  8. } // End of the function
[/quote]

Great bit of code graphixboy - very useful... I have just one question, how can you "cancel" the transition "mid flow" as it is going (e.g. what you'd need to do to cancel it if you push a button or want to drag while its still moving)
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

Tween.Stop() - so zoomX.Stop() etc.
  • derekcfoley1
  • Born
  • Born
  • derekcfoley1
  • Posts: 2

Post 3+ Months Ago

cheers UPSGuy!

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: No registered users and 6 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.