Klik Di Sini untuk melihat hasilnya dulu.
Actionscript yang dituliskan pada frame :
import flash.events.MouseEvent;
import flash.events.Event;
var posX:int = peta.x;
var posY:int = peta.y;
//membuat fungsi zoomnya
function zoomnya(e:MouseEvent):void
{
var zoom:Number = .1;
peta.scaleX = peta.scaleX + e.delta * zoom;
peta.scaleY = peta.scaleY + e.delta * zoom;
}
//mengeksekusi fungsi jika mouse di scroll
stage.addEventListener(MouseEvent.MOUSE_WHEEL,zoomnya,false,0,true);
//;
stage.addEventListener(Event.ENTER_FRAME,main);
//;
function main(event:Event):void
{
var angka:int = int(Math.round(peta.scaleX));
Zoo.text = String(angka);
if (peta.scaleX < 1)
{
peta.scaleX = 1;
peta.scaleY = 1;
peta.x = posX;
peta.y = posY;
}
}
//buat fungsi drag;
function drage(event:MouseEvent):void
{
peta.startDrag();
}
function drope(event:MouseEvent):void
{
peta.stopDrag();
if (peta.scaleX < 1)
{
peta.x = posX;
peta.y = posY;
}
}
stage.addEventListener(MouseEvent.MOUSE_DOWN, drage);
stage.addEventListener(MouseEvent.MOUSE_UP, drope);