Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

**Rabid Lemming****Guest**

Hey ya all,

Ok I am a director programmer and I am stuck on a maths problem. i need to take the width of an object (I will call this time line).

I then need to take the time elapsed of a sound clip that can vary

I then need to take the total time of a sound clip that can vary

i then need to set an object location based so it moves with in the confides of width of the object time line

You see I am trying to make a play head that moves from the left of the time line to the right as the sound is playing. as the sound duration and total time changes i do not know how to say this..

Take the total time and elapsed time of the sound and set the location of the play head to the far left of the time line and movie right as far as much time has elapsed. I want it so when the play head reaches the end of the time line the sound has finished. I did have this:

Set the locH of sprite 3 to the locH of sprite 2 + the movietime of sprite 1 * the width of sprite 2 / the duration of member memberName

But it moves the play head beyond the width of the time line.

So how do I take the width of a time line and work out from that how far to move my play head based on the time elapsed and total time to play

An example of the time format is : 3260 total time = 54 seconds , played time 0

Yes to make it harder director doesnt do time in a standard format I think its something like 1000 = 1 second

So can any one please give me a formula that will take a variable for the total time and elapsed time and use that to work out how far along the time line to move the play head.

The constrains are the play head must not go beyond 640 but be grater than 350

Any help would be very much appreciated

Cheers

Rabid Lemming

**Rabid Lemming****Guest**

Hey all,

Never mind sorry I worked it out my self seams there was a computing code error and not so much a sum error. For some reason the formula I used was leaving a difference of ten so I used:

set the locH of sprite 3 to the locH of sprite 2 + (the width of sprite 2 - 10) * the movietime of sprite 1 / the duration of sprite 1

To minus the difference left over

Dam director lingo I much prefer flash

Cheers

Rabid Lemming

**MathsIsFun****Administrator**- Registered: 2005-01-21
- Posts: 7,631

Oh, darn, you solved it yourself ... not fair.

BTW if you have any maths-related flash or director you think could help the visitors, let me know.

"The physicists defer only to mathematicians, and the mathematicians defer only to God ..." - Leon M. Lederman

Offline

Pages: **1**