-
Multiplying mouseX value: possible?
Hello again,
I would like a bit of help with something I have been working on. I have this mc that responds to mouseX , only the mc is very short in frames, it's only 25 frames long. This way the mouseX is only the first 25 pixels of my stage, so it only responds to that. Is there any way I can multiply this value to, let's say, 20 times?
Thank you in advance.
-
You just need to scale the relationship.
Code:
var value:int = Math.floor(25*mouseX/stage.stageWidth);
The mouseX/stage.stageWidth gets you the mouse position as a percentage of the stage width. Then multiply that by 25 which is the number you want at 100%. Then take the floor of that so that you get an int rather than a Number. You could use round there.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|