PDA

View Full Version : Timer parameters


psychospiller
10-15-2007, 01:06 PM
Can someone provide me with a detailed list of the parameters used in the timer command, eg.

timer+=1,2000,,functionA;

I understand that this will run functionA in two seconds, but what does the initial '1' mean and what can be placed between the ',,'

Also is it possible to use the timer command multiple times in a single function, but without calling more sub routines for example :

currently I have to do this


timer+=1,1000,,functionA;

functionA="
pano.zoom=3,1000;
timer+=1,1000,,functionB;
"


is it possible to do something like this:

timer+=1,1000,,functionA;
timer+=1,1000,,functionB;
timer+=1,1000,,functionC;


I can never seem to get the calls to functionB and C to work in this sample

fbii
10-15-2007, 02:37 PM
Can someone provide me with a detailed list of the parameters used in the timer command, eg.

psychospiller,
I wish that I could. But, it seems that the only use this timer is for is as a pause followed by a shift to a new function. I have searched the help files and can't come up with anything else. However, I just use 'timer=1,1000,,newfunction'. Doesn't seem to matter about the += or =.

I can never seem to get the calls to functionB and C to work in this sample

Open the html file 'hotspots.html' and search for "goTimer". It's under pano object parameters - onKeyPress. There he shows a number of functions he called sequentially by timer. Hope this helps a little.

fritz

ubiquity
07-31-2008, 05:19 AM
I'm wondering what can be placed between the double commas as well. There seems to be no documentation on it.

As for your other question, I believe the '1' is to activate or set the timer to 'true'. The documentation in the Hotspots tutorial says the default value of timer=0. Here is what it says:


timer is a variable linked to no one appearance object

Use it for your own needs, for example, to create pauses between actions:

onClick="scale=5; timer+=1,10000,,scaleBack" scaleBack="scale=1" (increase the scale of the object to 5 and scales it back to 1 after 10 seconds)

Default value is 0.


I've been told that you can cancel a timer by setting timer=0; but I have tried and it didn't work for me using the following code. I click the pano before the time has elapsed yet the pano completes the pan. Does anybody know how to actually kill the timer?


<global

onStart = "
timer+=1,1500,,global.panToHome
"
panToHome="
pano.pan=-10,1000,easyIn
"
>

<pano
onPress="timer=0"
/>

</global>

cheathamlane
07-31-2008, 02:27 PM
Hi there:

ubiquity, I responded to your commas question in your other post:
http://flashpanoramas.com/forum/showthread.php?t=1628

The timer function uses the same syntax as other tweens.

As for your onPress event not getting called -- I generally put that in the <global> element rather than in <pano>, and that works for me.

There's a short tutorial on making a simple auto-presentation (http://flashpanos.com/content/simple-panorama-auto-presentation) (which includes an explanation of the tween syntax); You might also look at the XML for the example on the front page of my site (http://cheathamlane.net), which has a more complex auto-presentation which involves use of the timer throughout. Search specifically for "goTimer" and/or "stopTimer".

HTH!

ubiquity
08-01-2008, 12:14 AM
Thanks again cheathamlane!

It turns out that all I needed to do was add 'global.' to kill the timer.

global.timer=0

Now I'm successfully canceling the timer!

As far as the ‘double comma’ question, I believe I see what you’re saying now. I’m testing with the line below:

timer+=1,1500,elastic,global.panToHome,global.time r=0

So, if I understand this correctly, when the timer is finished, the panToHome function will run. If user interaction , like a mouse click, occurs it will cancel the timer via global.timer=0.

I tested the code and it works; but I still don’t understand what can be done between those commas. Tweening can only be detected visually and wouldn’t be relevant in above line of code.

So I tried this:

onStart="
timer+=1,1500,bounce,global.panToHome,global.testF unction;
"
panToHome="
pano.pan=-10,1000,easyIn;
"
testFunction="
pano.tilt=90,1000;
"

I thought that maybe when the timer was interrupted and testFunction was activated, the bounce tween would be applied to the tilt animation of testFunction. That’s not what happened. It ran with the default tween.

Can you come up with a scenario where tweening could actually be used in a timer?

cheathamlane
08-01-2008, 12:50 AM
Woohoo!

You're welcome... :)

Yeah, I think you're absolutely right -- there's no real reason you'd want a tween on your timer since the timer isn't a visual thing (and it doesn't affect functions that follow). But, it's the syntax Denis is using.

If you look at the "Anatomy of a plugin" tutorial over at flashpanos.com, you'll see the "setAttribute" function. This function takes the tween syntax verbatim from the FPP XML, and must be the default function for handling calls from the FPP XML.

So, in the case of timer, Denis's setAttribute is probably just ignoring the tween aspect of it.


So, if I understand this correctly, when the timer is finished, the panToHome function will run. If user interaction , like a mouse click, occurs it will cancel the timer via global.timer=0.


Yes, but!... I have run into issues with having something like "global.timer=0" at the end of a tween/timer sequence.

So, rather than this:

timer+=1,1500,elastic,global.panToHome,global.time r=0

It's probably better to use something like (pseudo-code alert):


<spot id="myspot"

onclick="timer+=1,1500,,global.panToHome,myspot.myFunction"

myFunction="global.timer=0"

/>

Cheers,

Patrick

congregate
10-31-2008, 12:13 PM
Hi cheathamlane,

I have tried your solution:

<spot id="myspot"

onclick="timer+=1,1500,,global.panToHome,myspot.myFunction"

myFunction="global.timer=0"

/>

however, it doesnt reset the timer. Any idea why?