home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 161
/
MOBICLIC161.ISO
/
pc
/
DATA
/
DSS161
/
DSS161_00
/
DSS161_00.swf
/
scripts
/
dss161
/
engineaddons
/
gamesprotos
/
actors
/
cursor
/
Cursor.as
Wrap
Text File
|
2014-01-15
|
4KB
|
152 lines
package dss161.engineaddons.gamesprotos.actors.cursor
{
import flash.display.DisplayObjectContainer;
import flash.display.MovieClip;
import flash.events.TimerEvent;
import flash.ui.Mouse;
import flash.utils.Timer;
public dynamic class Cursor
{
private var _parent:DisplayObjectContainer;
private var _cursorLib:MovieClip;
private var _cursorName:String = "fleche";
private var _timer:Timer;
private var _lock:Boolean = false;
private var _mouseVisible:Boolean = true;
public function Cursor(param1:MovieClip = null, param2:DisplayObjectContainer = null)
{
super();
this._cursorLib = param1;
this._cursorLib.mouseChildren = false;
this._cursorLib.mouseEnabled = false;
this._cursorLib.enabled = false;
this._parent = param2;
if(param1 != null)
{
}
this._timer = new Timer(1,0);
this._timer.addEventListener(TimerEvent.TIMER,this.timerHandler);
}
public function change(param1:String) : void
{
this._cursorName = param1;
switch(param1)
{
case "fleche":
case "doigt":
this._cursorLib.visible = false;
if(this._cursorLib.parent === this._parent)
{
this._cursorLib.parent.removeChild(this._cursorLib);
}
this._timer.stop();
this.mouseVisible = true;
break;
default:
this.mouseVisible = false;
this._cursorLib.gotoAndStop(this._cursorName);
if(this._cursorLib.parent !== this._parent)
{
this._parent.addChild(this._cursorLib);
}
this._cursorLib.x = this._cursorLib.stage.mouseX;
this._cursorLib.y = this._cursorLib.stage.mouseY;
if(this._lock == false)
{
this._timer.start();
}
this._cursorLib.visible = true;
}
}
private function timerHandler(param1:TimerEvent) : void
{
this._cursorLib.x = this._cursorLib.stage.mouseX;
this._cursorLib.y = this._cursorLib.stage.mouseY;
param1.updateAfterEvent();
}
public function destroy() : void
{
this._timer.removeEventListener(TimerEvent.TIMER,this.timerHandler);
}
public function get x() : Number
{
return this._cursorLib.x;
}
public function set x(param1:Number) : void
{
this._cursorLib.x = param1;
}
public function get y() : Number
{
return this._cursorLib.y;
}
public function set y(param1:Number) : void
{
this._cursorLib.y = param1;
}
public function get lock() : Boolean
{
return this._lock;
}
public function set lock(param1:Boolean) : void
{
if(this._lock == param1)
{
return;
}
this._lock = param1;
switch(this._cursorName)
{
case "fleche":
case "doigt":
break;
default:
if(this._lock == true)
{
this._timer.stop();
}
else
{
this._timer.start();
}
}
}
public function set mouseVisible(param1:Boolean) : void
{
this._mouseVisible = param1;
if(this._mouseVisible)
{
Mouse.show();
}
else
{
Mouse.hide();
}
}
public function get mouseVisible() : Boolean
{
return this._mouseVisible;
}
}
}