---------------------------------------------------------------------------------------------------------
https://www.kirupa.com/forum/showthread.php?367929-Flash-8-mouse-over-specific-word-in-Dynamic-external-text-show-button-over-text
---------------------------------------------------------------------------------------------------------
cap._visible=false;
b1.onRollOver = function() {
captionFN(true,"New Developer",this);
this.onRollOut = function() {
captionFN(false);
};
};
b2.onRollOver = function() {
captionFN(true,"Tool Expert",this);
this.onRollOut = function() {
captionFN(false);
};
};
b3.onRollOver = function() {
captionFN(true,"Developing Expert",this);
this.onRollOut = function() {
captionFN(false);
};
};
b4.onRollOver = function() {
captionFN(true,"Design Expert",this);
this.onRollOut = function() {
captionFN(false);
};
};
captionFN = function (showCaption, captionText, bName) {
if (showCaption) {
_root.createEmptyMovieClip("hoverCaption",this.getNextHighestDepth());
cap.desc.text = captionText;
cap._width = 11*cap.desc.text.length;
cap._alpha = 70;
if ((bName._width+bName._x+cap._width)>Stage.width) {
xo = -10-cap._width;
yo = -40;
} else {
xo = -10;
yo = -40;
}
hoverCaption.onEnterFrame = function() {
cap._x = _root._xmouse+xo;
cap._y = _root._ymouse+yo;
cap._visible = true;
};
} else {
delete hoverCaption.onEnterFrame;
cap._visible = false;
}
};
---------------------------------------------------------------------------------------------------------
READ MORE:
http://evolve.reintroducing.com/2009/02/03/as2-to-as3/as2-%E2%86%92-as3-using-mouse-events/
---------------------------------------------------------------------------------------------------------
var mListener:Object = new Object();
mListener.onMouseDown = function():Void{
trace("MOUSE DOWN!");
};
mListener.onMouseUp = function():Void{
trace("MOUSE UP!");
};
mListener.onMouseMove = function():Void{
trace("MOUSE MOVING!");
};
---------------------------------------------------------------------------------------------------------
Mouse.addListener(mListener);
stage.addEventListener(MouseEvent.MOUSE_DOWN, doMouseDown, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, doMouseUp, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_MOVE, doMouseMove, false, 0, true);
function doMouseDown($evt:MouseEvent):void{
trace("MOUSE DOWN!");
}
function doMouseUp($evt:MouseEvent):void{
trace("MOUSE UP!");
}
function doMouseMove($evt:MouseEvent):void{
trace("MOUSE IS MOVING!");
}
---------------------------------------------------------------------------------------------------------
READ MORE:
https://maohao.wordpress.com/2007/07/14/getting-mouse-coordinates-on-stage/
stage.addEventListener(MouseEvent.CLICK,func);
function func(e:MouseEvent):void{
trace(e.target.stage.mouseX);
trace(e.target.stage.mouseY);
}
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.geom.Point;
//var _foo:TextField;
function onMouseMove(evt:MouseEvent){
//trace(evt.target.mouseY);
var target:* = evt.target;
//_foo.text = target.mouseY;
//_foo.text = evt.localY.toString();
var location:Point = new Point(target.mouseX, target.mouseY);
location = target.localToGlobal(location);
_foo.text = target.mouseY + ": "+ location.y;}
//root.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
---------------------------------------------------------------------------------------------------------function func(e:MouseEvent):void{
trace(e.target.stage.mouseX);
trace(e.target.stage.mouseY);
}
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.geom.Point;
//var _foo:TextField;
function onMouseMove(evt:MouseEvent){
//trace(evt.target.mouseY);
var target:* = evt.target;
//_foo.text = target.mouseY;
//_foo.text = evt.localY.toString();
var location:Point = new Point(target.mouseX, target.mouseY);
location = target.localToGlobal(location);
_foo.text = target.mouseY + ": "+ location.y;}
//root.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
READ MORE:
https://www.kirupa.com/developer/mx/captions2.htm
---------------------------------------------------------------------------------------------------------
EmoticonEmoticon