|
-
The sequence of numbers needs to be rounded off. Please help...
Hello,
I have a project, and a little bit about it: it's Arduino prototyping board and I have implemented it through XML Socket into flash. And I'm using this example. The device is the same as well. So everything is pretty good, but I came up with one problem. That LDR device is not so sensitive as I expected, so my challenge is to make that number sequence to be rounded off. So if I have a movieclip and I want to move it according to that sequence, it would be much more smoother.
http://mweb.lt/files/sequence.png
Actionscript Code:
createSocket (); function createSocket () { serialServer = new XMLSocket(); trace("made it" + serialServer); serialServer.connect("127.0.0.1", 9001);
serialServer.onData = function (data) { mcpos = data/2; scalePos = data/6; var myTween:TweenMax = new TweenMax(mc_ghost, 1, {_x:mcpos, _xscale:scalePos, _yscale:scalePos, ease:Quad.easeOut}); myTween.play(); }
So mcpos and scalePos is the sequence of numbers and in some interval (for example every 0.05 seconds) they change depending on my movement (as I attached the image at the top). But as I said, that device is not so sensitive and in some period of time it jumps to the very high number which I don't need. Could somebody tell me how can I use this round off technique to round these numbers in the sequence?
Thanks in advance...
Tags for this Thread
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
|