PDA

View Full Version : timer functions, runtime creation questions


TomChiverton
10-07-2004, 12:50 AM
A few questions that weren't covered by the stuff I've seen so far:

1) setTimeout()
- in JavaScript, this runs a function every N milliseconds - is there an equiv in LZX ?

2) runtime creation
- can you create views (or add tree nodes, or append to text) at run time, like JavaScript can by document.write()'ing a div tag or using innerHTML (say) ?

3) parmeters
- how can I get url, form or other parameters into the code ? Such as an item ID to display.
- how do I get things out of the Flash and back into the server - say a 'username' text box and 'submit' button.

4) Skin and style
Can these be changed at runtime easily ? I.e. for one user have things based on green, and another user gets the red version - see the first part of 3 above :-)

TomChiverton
10-08-2004, 12:19 AM
Anyone ?

whisperstorm
10-08-2004, 12:37 AM
here's an example I created that uses Laszlo's version of setTimeout:

http://mylaszlo.com/lps-2.1.2/whisperstorm/clock/clock.lzx?lzt=html

heres the source:
http://mylaszlo.com/lps-2.1.2/whisperstorm/clock/clock.lzx?lzt=source

whisperstorm
10-08-2004, 12:43 AM
Here's a link to something that will help you alot:

http://www.laszlosystems.com/lps-2.2/docs/guide/





2) runtime creation
- can you create views (or add tree nodes, or append to text) at run time, like JavaScript can by document.write()'ing a div tag or using innerHTML (say) ?


It doesnt work in the same way, but yes, you can create dynamic views. I have a game that does this here:

http://mylaszlo.com/lps-2.0/whisperstorm/tinyworld/tinyworld.lzx?lzt=html

You can play with the source here:

http://mylaszlo.com/lps-2.0/lz_utils/viewer/viewer.jsp?file=/whisperstorm/tinyworld/tinyworld.lzx





3) parmeters
- how can I get url, form or other parameters into the code ? Such as an item ID to display.


You can fetch XML from the server which can contain that information


- how do I get things out of the Flash and back into the server - say a 'username' text box and 'submit' button.

try looking at this sample app:
http://www.laszlosystems.com/lps/sample-apps/weather/weather.lzx



4) Skin and style
Can these be changed at runtime easily ? I.e. for one user have things based on green, and another user gets the red version - see the first part of 3 above :-)

yes, try looking at this thread:

http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=1117

TomChiverton
10-08-2004, 01:05 AM
Thanks to you both !
I can now set about proucing a replacement in lzx for some of our DHTML controls to show to other people here - they are already very excited about the Laszlo product.

The setTimeout()-type example appear to be hanging atm though.