tracking mouse by _xmouse, _ymouse

This is a discussion on "tracking mouse by _xmouse, _ymouse" within the Flash & Multimedia Forum section. This forum, and the thread "tracking mouse by _xmouse, _ymouse are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Flash & Multimedia Forum

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jun 1st, 2004, 08:54
Reputable Member
Join Date: Aug 2003
Location: Singapore
Posts: 321
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to gwx03
tracking mouse by _xmouse, _ymouse

Hi all again..

need a/script help like before!

I wanted to track my mouse in a flash movie and display it into a dynamic textbox but the textbox does not show anything. I debugged the code and nothing seems wrong.

On the root timeline, this is my code :

Code: Select all
this.onMouseMove=function(){
	inputs_mc.xPos=Math.round(_xmouse);
	inputs_mc.yPos=Math.round(_ymouse);
	updateAfterEvent();
};
inputs_mc is my movie clip instance name, which houses two dynamic textfields, assigned the variables xPos and yPos. I have tried xPos and yPos without inputs_mc but it still does not work.

updateAfterEvent(); means whenever the mouse moves, the variable value would change

and Math.round means round it to a round number,not a floating point or fraction. I also tried Math.floor but didn't work either.

that's about the code and info I have, I don't see why things got wrong.

to sum it up :

xPos and yPos are variables
One dynamic textfield assigned to xPos and one assigned value of yPos
These two textfields are in a movie clip called inputs_mc
Code shown above is on movie main timeline ( the scene or root timeline or whatever you call it )

  #2 (permalink)  
Old Jun 1st, 2004, 09:44
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
If that code is on the main timeline then you are approaching this wrong.

onMouseMove applies to a movieclip, not the timeline. So you would have to put this code onto a movieclip for the code you have to work.

However, there is a better way to do this.
Code: Select all
someListener = new Object();
someListener.onMouseMove = function () { 
	inputs_mc_x = _xmouse
	inputs_mc_y = _ymouse
};
Mouse.addListener(someListener);
Where your textfields are inputs_mc_x and inputs_mc_y
This will go anywhere and always work.
  #3 (permalink)  
Old Jun 1st, 2004, 09:56
Reputable Member
Join Date: Aug 2003
Location: Singapore
Posts: 321
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to gwx03
thanks..

just wanted to know what is..

Code: Select all
 Mouse.addListener(someListener);
  #4 (permalink)  
Old Jun 1st, 2004, 14:40
Reputable Member
Join Date: Aug 2003
Location: Singapore
Posts: 321
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to gwx03
ok.. sirkent answered me over msn..

Mouse.addListener(someListener);

means you add a Listener which was created just now ( which goes by the name of someListener ) to Mouse, a built-in object.
Closed Thread

Tags
tracking, mouse, _xmouse, _ymouse

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for a bug tracking system hermanjoe ASP.NET Forum 1 Dec 8th, 2007 08:13
tracking referrals? Paulos77 Starting Out 4 Apr 8th, 2007 06:32
Download tracking Ross Web Page Design 3 Feb 28th, 2007 14:11
Tracking program SDUK PHP Forum 5 Sep 16th, 2006 20:22
mouse tracking in firefox (mozilla5) Psiryan JavaScript Forum 2 Aug 10th, 2006 07:49


All times are GMT. The time now is 22:33.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

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 35 36 37 38 39 40 41 42 43