currentTime on spinner

Hi guys

I have an issue to get the currentTime in real time while playing an animation in a spinner.

I can easily get the CurrentTime in a spinner like this:

spn_CT.value = currentTime

but this way it's not in real time while playing an animation.

If anyone have an idea, thanks a lot :)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
SugaR's picture

No one in particular, just

No one in particular, just read it sometimes.
But I know you can do some very nice stuff with, I already give it a try, but it really hurt my brain :p
Since I don't have any good knowledge on programing, for know I prefered to focus on mxs.
I will also begin to learn C, but mostly I'm a 3D artist so I prefer to do 3D stuff than scripting ^^

thanks for the help anyway :)

miauu's picture

.

This will prints the curent frame number as it is shown in the time slider:

spn_Time.value = (slidertime as string)as integer

Or you can use this:

spn_Time.value = (slidertime.frame as integer)
SugaR's picture

Thanks for your

Thanks for your help.
Unfortunately, this is not what I want, and barigazi give me a great solution ^^

SugaR's picture

Hi barigazi, always here to

Hi barigazi, always here to help me :)

Thanks but it's not working (actually it's the way I defined the spinner).

Maybe you didn't understand what I mean, so i'll try to explain a bit better.

for example, if you use this:

fn time_p = print currentTime
registerTimeCallback time_p

you'll see in the listener that you print every frame while playing the animation, and this is what I want in my spinner.

unregisterTimeCallback time_p

=> to delete the callback if you try it :)

barigazy's picture

...

Are you vant to unregisterTimeCallback if you spinner value is greater then or lower then animation range?

bga

barigazy's picture

...

If Yes then

on spn_CT changed val do
(
	if val < animationRange.start.frame or val > animationRange.end.frame then 
	(
		unregisterTimeCallback time_p
	)
	else slidertime = val
 
)

bga

barigazy's picture

...

spn_CT.value = slidertime

bga

barigazy's picture

...

If you vant to get slider time in seconds then try like this

slidertime.frame/framerate

bga

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.