Hi, found it, well, sort of...

Just to say, about this problem, the stateValue element is something
automatically managed by the history management facilities from Laszlo (if you
have http://.../mypagewithlzx.html#_lzstateValue=foo, you will automatically
have a stateValue attribute defined on the canvas (and correspondinc
onstateValue event), and it will have the value "foo", and that's what was
implemented in our solution.

Basically the problem still stands, we have no way (that I know of) of knowing
when the hash part of the page url will be parsed, and thus I have no defined
timeline for knowing when what is defined in my state variables is loaded in the
canvas.

I therefore tried to use some alternative approaches to make sure I have it even
if it is not defined (which is my biggest problem, if I have a #_lzstateValue
part, the event will get called, and most of the time before 100ms on before two
OnIdle loops, sometimes just a bit later, but when it is not defined, the canvas
won't have this attribute, and thus the event will not fire).

Using LzBrowser.callJS does not always do the trick due to a lack of queuing, a
new function is sometimes called before mine returns. Using regular
LzBrowser.loadJS on a function that will define the parameter in the canvas
using Lz.setCanvasAttribute does work, but not all the time, sometimes the JS
hooking does not seem responsive, so I finally found an alternative and working
way : URL parameters.

Just for info, the solution I found is:
- before making the URL for Lz.swfEmbed, i get the hash in JS, process to get my
parameter the same way the history management does, add it to a parameter in the
swf file path
- on init of my class, I can then only call LzBrowser.getInitArg('stateValue'),
gettig my value, set it in my canvas variable, and I get the event and
everything I wanted, and since I set the variable, I also get the events fired
when the value changes.

That's about it.

Cheers,
Julien


Selon "Julien LEPINE (Kiwi)" <[EMAIL PROTECTED]>:

> Hi all,
>
> I have a small question about managing stateValues on the canvas.
>
> Just to explain, we have an application using state management and history
> not
> via the LzHistory class but via canvas stateValue, and this value is used for
> managing back button even once we left the page and go back to it.
>
> The pont is that when the user comes back, he has to have exactly the same
> state
> than before.
>
> When the canvas is initialized (handler oninit referencing canvas), the
> stateValue attribute is not set, I also tried with having a method called
> onidle, does not change a thing, it is not set, the only way is to have a
> 100ms
> timer called, and in that case I have the values I want.
>
> When I have a handler onstateValue referencing canvas, it gets called, but
> the
> entire point is that I would like to start processing everything on my page
> just
> for what the user has, and not process the default page then notice I had a
> state and at that time reprocess the data to reflect what he has to see. Even
> more when there is no state, this event is not called.
>
> Is there any specific time where the stateValue is set on the canvas, or is
> it
> only on a "when I have the time" basis ?
>
> Any idea or light would be more than appreciated.
>
> Cheers,
> --
> Julien
>

Reply via email to