Flasher Archive
[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]
| Subject: | Floating point coordinate calculation bug |
| From: | AndyA |
| Date: | Tue, 06 Mar 2001 21:14:14 -0000 |
Hey Guys,
I'd like to find out if anyone else can duplicate an issue I'm seeing in an
animation I'm doing.
Basically, I animate a series of movieclips by setting the _x and _y values.
I was having a lot of difficulty and after lots of debugging came up with
this conundrum. I ended up setting up duplicate lines wherever the _x and _y
was changed and setting a variable goalX and goalY for the movie clips.
Then I used the following trace line:
trace (node._name + " has x coord: " + node._x + " and goalX: " + node.goalX
+ " (" + (node._x == node.goalX) + " )");
which should return (eg):
MenuItem1 has x coord: 210 and goalX: 210 (true)
What it actually kicked out in some cases was the following:
MenuItem1 has x coord: 256.95 and goalX: 256.95 (false )
!!!!!! the (node._x == node.goalX) compares the two values (which look
identical) and returns false!
In some other cases it returns the following:
MenuItem13 has x coord: 356.95 and goalX: 356.95 (true )
which is as it should be, but all
The manipulation of the _x and goalX values is all whole number stuff using
addition and subtraction. There is no division and no multiplication, so the
two decimal places should (and do) stay the same for all instances.
Unfortunately, if I can't compare the coordinates and get a return of
true... my programming is buggered. Any ideas as to what is going on?
Hope to hear from you
Andy
[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]

