A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: [RESOLVED] onMouseNOTMove=function?

Threaded View

  1. #1
    Senior Member
    Join Date
    Oct 2005
    Posts
    198

    resolved [RESOLVED] onMouseNOTMove=function?

    hi,
    (nevermind I got it)

    I created a simple program where a a mc follows the mouse within a limited area--However, I would like when the mouse is not moving for the mc to go back to center, in this case x=121.4 and y=48.3--Is there such a call? Do I need an event listener? Here is the code:

    Code:
    onClipEvent (load) {
    	_x = 121.5;
    	_y = 48.3;
    	speed = 80;
    }
    onClipEvent (enterFrame) {
    	this.onMouseMove = function() {
    	endX = this._xmouse;
    	endY = this._ymouse;
    	if (this._x<110.6) {
    		this._x = 110.6;
    	}
    	if (this._x>136.6) {
    		this._x = 136.6;
    	}
    	_x += (endX-_x)/speed;
    
    	if (this._y>50.3) {
    		this._y = 50.3;
    	}
    	if (this._y<44.3) {
    		this._y = 44.3;
    	}
    	_y += (endY-_y)/speed;
    	
    }
    	endX = 121.5;
    	endY = 48.3;
    	speed = 20;
    	_x += (endX-_x)/speed;
    	_y += (endY-_y)/speed;
    }
    Thanks,
    Yvette
    Last edited by yvillicana; 01-11-2008 at 02:44 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center