[flashpro] Help with timeline controller (simple maths?)

Jonathan E eastonjon at yahoo.com
Sat Oct 29 04:56:33 EDT 2005


hey santinilox,

i'm not too good at maths also, but here's something.
i think you can just "Math.round" the value of
(percent*totalIntervals), then add 1 to the result.

so if say you have 3 checkpoints like this:

|------------|------------|
0            1            2

This makes for 2 intervals. if the user clicks at 20%,
calculate it like this:

Math.round(percent*2)

which will return 0.4, which will be rounded to 0 by
Flash, and to which you would add 1, bringing you to
frame 1.

and if we try another scenario, and the user clicks at
40%, Math.round(percent*2) will return 0.8, which will
be rounded to 1 by Flash, to which you would add 1,
bringing you to frame 2.

so the code would be:

gotoAndStop (Math.round(percent*totalIntervals)+1);

totalIntervals being the number of checkpoints minus
1. This is kind of simplistic, but i hope it helps!
(and i hope it still works if you "scale the thing
up")

jonathan.

--- elusive <elu at elusive.de> wrote:

> hi santinilox,
> 
> you say you can measure the position of the user's
> click by percent.
> and you got the number of frames, right?
> Math.round(percent/(100/frames))+1
> something like that shoud do the job but it's
> untested.
> 
> e
> 
> santinilox wrote:
> 
> >Hi all!
> >
> >I have a little bar for the _root timeline (such as
> the one you can find in
> >any kind of audio/video player). Eg:
> >
> >|----o--------------------|
> >
> >If, for example, I have three frames in the _root
> movie, it would be three
> >"checkpoints". Eg:
> >
> >|------------|------------|
> >
> >When the user clicks in the 40% of the bar:
> >
> >|---------x--|------------|
> >
> >I would like the little-ball go to the second
> "checkpoint" (ie, the second
> >frame in the _root movie):
> >
> >|------------o------------|
> >
> >If the user clicks in the 20%:
> >
> >|---x--------|------------|
> >
> >The ball (and also the _root movie) would travel to
> the first "checkpoint":
> >
> >o-------------------------|
> >
> >Actually, I know all the values. Eg:
> >
> >User clicked at = 40%
> >_root's _totalframes = 3
> >
> >I know this is a very stupid question, but I've
> spent 3 hours with this
> >issue. When all works fine with my 3-frames test
> movie, it won't work with
> >my 7-frames test movie, and so on...
> >
> >Help, please ;-)
> >
> >
> >~s
> >
> >
> >
> >		
> >______________________________________________ 
> >Renovamos el Correo Yahoo! 
> >Nuevos servicios, más seguridad 
> >http://correo.yahoo.es
>
>------------------------------------------------------------------
> >send message to the list:              
> mailto:flashpro at muinar.org
> >[FlashPro] list info, subscribe, archive:  
> http://flash-list.com/
> >There's also a WebPro mailing list:    
> http://webdesign-list.com/
> >cutting-edge sounds for flash:           
> http://flash-sounds.com/
> >
> >
> >  
> >
> 
> 
>
------------------------------------------------------------------
> send message to the list:              
> mailto:flashpro at muinar.org
> [FlashPro] list info, subscribe, archive:  
> http://flash-list.com/
> There's also a WebPro mailing list:    
> http://webdesign-list.com/
> cutting-edge sounds for flash:           
> http://flash-sounds.com/
> 



		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com


More information about the FlashPro mailing list