Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Zoom out until the original size of the document

New Here ,
Jul 14, 2015 Jul 14, 2015

Hi! I've got a problem with this code, because i need to zoom out for the original size. Please HELP ME in it! thanks

import flash.events.MouseEvent;

stage.addEventListener(MouseEvent.MOUSE_WHEEL, Zoom);

function Zoom(e:MouseEvent):void

{      

  var mod:Number = 20;

  kep2.scaleX += e.delta / mod;

    kep2.scaleY += e.delta / mod;

    kep2.x = ((2 * mouseX) - (2 * (e.localX * kep2.scaleX))) / 2;

  kep2.y = ((2 * mouseY) - (2 * (e.localY * kep2.scaleY))) / 2;

}

import flash.events.MouseEvent;

this.addEventListener(MouseEvent.MOUSE_DOWN, startDragging, true);

this.addEventListener(MouseEvent.MOUSE_UP, stopDragging, true);

function startDragging(e:MouseEvent) {

kep2.startDrag();

}

function stopDragging(e:MouseEvent) {

kep2.stopDrag();

}

TOPICS
ActionScript
235
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 14, 2015 Jul 14, 2015

use an if-statement to check if scaling is too small

import flash.events.MouseEvent;

stage.addEventListener(MouseEvent.MOUSE_WHEEL, Zoom);

function Zoom(e:MouseEvent):void

{     

  var mod:Number = 20;

  kep2.scaleX += e.delta / mod;

    kep2.scaleY += e.delta / mod;

if(kep2.scaleX<1){

kep2.scaleX=kep2.scaleY=1;

}

    kep2.x = ((2 * mouseX) - (2 * (e.localX * kep2.scaleX))) / 2;

  kep2.y = ((2 * mouseY) - (2 * (e.localY * kep2.scaleY))) / 2;

}

import flash.events.MouseEvent;

this.addEve

...
Translate
Community Expert ,
Jul 14, 2015 Jul 14, 2015
LATEST

use an if-statement to check if scaling is too small

import flash.events.MouseEvent;

stage.addEventListener(MouseEvent.MOUSE_WHEEL, Zoom);

function Zoom(e:MouseEvent):void

{     

  var mod:Number = 20;

  kep2.scaleX += e.delta / mod;

    kep2.scaleY += e.delta / mod;

if(kep2.scaleX<1){

kep2.scaleX=kep2.scaleY=1;

}

    kep2.x = ((2 * mouseX) - (2 * (e.localX * kep2.scaleX))) / 2;

  kep2.y = ((2 * mouseY) - (2 * (e.localY * kep2.scaleY))) / 2;

}

import flash.events.MouseEvent;

this.addEventListener(MouseEvent.MOUSE_DOWN, startDragging, true);

this.addEventListener(MouseEvent.MOUSE_UP, stopDragging, true);

function startDragging(e:MouseEvent) {

kep2.startDrag();

}

function stopDragging(e:MouseEvent) {

kep2.stopDrag();

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines