Also, I note that in your prior "solution" you set the floatPrecision.  The 
floatPrecision is for display purposes and doesn't affect the internal 
precision.  Setting it to 1 or 10 doesn't affect the calculation, just the 
display of the results.

- Tab

At 02:55 PM 7/23/01 -0400, Jason Whiting wrote:
>I like that one even better. thanks alot.
>
>-Jason
>
>
>
>
>-----Original Message-----
>From: Tab Julius [mailto:[EMAIL PROTECTED]]
>Sent: Monday, July 23, 2001 2:14 PM
>To: [EMAIL PROTECTED]; '[EMAIL PROTECTED]'
>Subject: Re: <lingo-l> Problem with floaint points
>
>
>
>Since both operands are integers (that is, 1 is an integer, and the
>duration is an integer), Director will perform integer math on it, and the
>result will be an integer (in this case, 0).
>
>What you want to do is force it to do floating point math on it.  Since one
>of your divisors is a constant (1) you can do it easily like so:
>cpart = ctime * (1.0/sprite(2).duration)
>
>(note how I made the 1 to be 1.0)
>
>Alternatively you could do float(1), although this is unnecessary if you
>can just tack a .0 on the end - it makes more sense when bother are
>variables.
>
>Now, one of the operands is a floating point, and Director will perform
>floating point math instead of integer math.  Easy - just add .0!
>
>- Tab
>
>At 02:08 PM 7/23/01 -0400, Jason Whiting wrote:
> >Hopefully somone can help me with this one. I am working on a movie slider.
> >Here's the code to move the slider durring playback.
> >
> >
> >     ctime = sprite(2).currenttime
> >     -- 2 is the video sprite
> >     -- ctime is the current time code in ms
> >
> >     cpart = ctime * (1/sprite(2).duration)
> >     -- cpart computes the current segment
> >     -- currenttime * 1/duration in MS
> >
> >     cloc = sprite(149).width * cpart
> >     -- width of entire slider * segment
> >     -- products the approximate number of pixels to move
> >
> >     vcalc = integer(cloc)
> >     -- convert cloc to integer
> >
> >     sprite(150).loch = vcalc + sprite(149).loch - (sprite(149).width/2)
> >     -- move slider control correct number of pixels
> >     -- based on left edge of slider bar
> >
> >in the past I have hard coded:
> >
> >cpart = ctime * (1/sprite(2).duration)
> >
> >so it looked like:
> >
> >  cpart = ctime * .000003620564808
> >
> >but I would rather build this behavior to be drag and drop. My problem lies
> >in how Director is handle'n the math. In director 1/276200 = 0 where I need
> >it to = 3.62056480811006517016654598117306e-6. I read various technotes on
> >MM site but none seem to give any hint to a solution to this problem.
> >Reading about how Director handles floating point calculations it seems
>like
> >the issues are only when displaying numbers not the actual calculations but
> >the script doesn't function at all without hardcoding the number. This
>leads
> >me to belive that Director is using 0 as the solution to
> >(1/sprite(2).duration) .  Can anyone help here?
>
>
>[To remove yourself from this list, or to change to digest mode, go to
>http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
>email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
>Lingo-L is for learning and helping with programming Lingo.  Thanks!]
>
>[To remove yourself from this list, or to change to digest mode, go to
>http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
>email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
>Lingo-L is for learning and helping with programming Lingo.  Thanks!]


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to