Advertisement

04.21.2008 at 02:36PM PDT, ID: 23341192
[x]
Attachment Details

Zoom an image with the mousewheel in AS3

Asked by illion20 in Macromedia Flash

Hello,

I have an image and I want to zoom in and out. I can easily zoom in and out by using the tweener class but I dont want the image to stay in (0,0) and only expand its width and height. How can I make the image depend on where I have the mouse and center the zoom around that or if the mouse is not on the image it should center the zoom to the stage.

The attach code is what I use right now, but it doesnt really work well because I tried to experiment with moving the x and y coordinates with the scale calculations. Though in my head this should still work, have totally no idea why its not.

Well I will appreciate your help, thanks.

/Robert

Start Free Trial
1:
Tweener.addTween(m_Mc, { x: m_Mc.x+(m_Mc.width-(m_Mc.scaleX+e.delta/mod)*m_Mc.width)*0.5, y: m_Mc.y+(m_Mc.height-(m_Mc.scaleY+e.delta/mod)*m_Mc.height)*0.5, scaleX: m_Mc.scaleX+e.delta/mod,scaleY: m_Mc.scaleY+e.delta/mod, time:0.2, transition: "linear"} );
 
 
Loading Advertisement...
 
[+][-]04.21.2008 at 10:27PM PDT, ID: 21408271

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Macromedia Flash
Sign Up Now!
Solution Provided By: aneeshchopra
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04.21.2008 at 10:39PM PDT, ID: 21408312

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 10:00AM PDT, ID: 21413122

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628