You are on page 1of 2

package aslib { import import import import flash.display.MovieClip; flash.events.MouseEvent; flash.events.Event; flash.geom.

Point;

public class mcHUD extends MovieClip { public function mcHUD() { //excecute "onAddedToStage" function when this is create d addEventListener(Event.ADDED_TO_STAGE, onAddedToStage); } private function onAddedToStage(e:Event):void {

addEventListener(MouseEvent.CLICK, onClick); addEventListener(Event.ENTER_FRAME, onEnterFrame); addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFrom Stage); addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheel); stage.addEventListener(Event.MOUSE_LEAVE, mouseLeave); stage.addEventListener(MouseEvent.MOUSE_OVER, mouseEnter ); } private function onRemovedFromStage(e:Event) { //remove existing event listeners removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage ); removeEventListener(Event.ENTER_FRAME, onEnterFrame); removeEventListener(MouseEvent.CLICK, onClick); trace(this + " removed from stage"); stage.addEventListener(MouseEvent.MOUSE_WHEEL, mouseWhee l); stage.removeEventListener(Event.MOUSE_LEAVE, mouseLeave) ; stage.removeEventListener(MouseEvent.MOUSE_OVER, mouseEn ter); } private function mouseLeave(e:Event) { } private function mouseEnter(e:MouseEvent) { } private function onEnterFrame(e:Event)

{ circle_filter.x = stage.mouseX; circle_filter.y = stage.mouseY; circle_mask.x = stage.mouseX; circle_mask.y = stage.mouseY; var jump:int = 15 trace(mcRoom.x); if (stage.mouseX > (stage.stageWidth - (stage.stageWidth / 15))) { if (mcRoom.x - jump > -(mcRoom.width - stage.sta geWidth)) { mcRoom.x -= jump; } else { mcRoom.x = -(mcRoom.width - stage.stageW idth); } } if (stage.mouseX < (stage.stageWidth / 15)) { if (mcRoom.x + jump < 0) { mcRoom.x += jump; } else { mcRoom.x = 0; } } } //this function will adjust an object that falls outside of the stage boundaries private function checkBoundaries() { } private function onClick(e:MouseEvent) { } //the mousewheel handles the zooming private function mouseWheel(sVelocity:MouseEvent) { } } }