1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
import gs.*;
import gs.easing.*;
import gs.TweenLite;
import fl.events.SliderEvent;
//The x & y coordinates of the top-left corner of the rectangle.
var my_x:int=stage.stageWidth-this.MC_map.width;
var my_y:int=stage.stageHeight-this.MC_map.height;
//The height and width of the rectangle.
var myWidth:int=0-my_x;var myHeight:int=0-my_y;
//Create a new instance of the rectangle class with the coordinates above.
var boundArea:Rectangle=new Rectangle(my_x, my_y, myWidth ,myHeight);
//Adds the mouse down and up event listeners to the sheep movie clip.
this.MC_map.addEventListener(MouseEvent.MOUSE_DOWN, drag);
this.MC_map.addEventListener(MouseEvent.MOUSE_UP, drop);
//This function drags the sheep but limits to the stage boundaries.
function drag(event:MouseEvent):void { this.MC_map.startDrag(false,boundArea); Mouse.cursor = flash.ui.MouseCursor.HAND;}
//This function releases the sheep object.
function drop(event:MouseEvent):void { this.MC_map.stopDrag(); Mouse.cursor = flash.ui.MouseCursor.AUTO;}
Slider_scale.addEventListener(SliderEvent.CHANGE, ScaleLevel);
function ScaleLevel (event:SliderEvent):void{
TweenLite.to(this.MC_map, 1, {scaleX:event.target.value/10, scaleY:event.target.value/10});
}; |
Partager