PDA

View Full Version : Event and delegate problem?


maithinh
02-07-2007, 06:58 AM
Good day all

My question this time is about the loading mechanism of OpenLaszlo and the reliability of the code when run time.
I'm trying to load the swf resource (not compiled by OpenLaszlo). With the movie and audio, it's just fine. But with a swf clock, which I grab on the internet, I have to trigger another event to get it run. Initializing, I think this is the problem of not starting the movie to get it function, so I've put a function call tied to the event request to make it call 2 methods when the onclick event happen. Unfortunately, 2 methods are execute, but the clock simply not visible, I have to manually trigger the start button to make it run. I knew that is some limitation when invoking some flash have the action script, but this is quite unreasonable. Someone has experience with these problem, please help me out.


<canvas width="200" height="200" debug="true">

<simplelayout axis="y" spacing="4"/>

<view>
<simplelayout axis="x" spacing="2"/>
<text valign="middle">Type url:</text>
<edittext width="500" id="url">http:../resources/logo.gif</edittext>
</view>

<button id="butt">Make request

<!-- This is the way, OpenLaszlo need to have multiple event fire at the same time -->
<handler name="onclick" method="startMovie"/>
<handler name="onclick" method="doit"/>


<method name="startMovie">
Debug.write("Start the movie");
me.play();
</method>



<method name="doit">
<![CDATA[

// Determine caching from checkboxes
var caching = 'clientonly'
me.setSource(url.getText(), caching) ;
Debug.write("Load the resource");
me.stop();
me.play();
]]></method>


</button>
<button onclick="me.stop()"> Stop </button>
<button onclick="me.play()"> Play </button>
<view id="me" x="100" y="100" />



</canvas>

PS: I've also upload the clock for testing purpose.