PDA

View Full Version : Displaying loading Notification


antun
08-14-2003, 03:55 PM
If you're loading images at runtime, there's usually a delay while the image loads. It's helpful to give your user a visual indicator to let them know that something is loading. In this example there is a spinning clock .swf file that is to be displayed when loading commences, then removed, and the new image is visible.


<canvas>
<simplelayout spacing="2" />
<text>Click the area below...</text>

<view name="loader" bgcolor="0x000000" width="300" height="200"
clickable="true">

<view name="loadIndicator" resource="clock.swf" visible="false" />

<view name="image" width="300" height="200"
stretches="both">
<method event="onload">
this.parent.loadIndicator.setVisible( false );
</method>
</view>

<method event="onclick">
this.loadIndicator.setVisible( true );
var u = 'http:big_photo.jpg';
this.image.setSource( u );
</method>
</view>

</canvas>


Note: You need to supply your own photo (big_photo.jpg) for this tip. I took the biggest photo I had and put it on a remote server to make the delay as noticeable as possible. The client will usually cache it after that, so subsequent requests will be quicker.

Whatever event starts the loading of image should also make the loading indicator visible. The indicator is later hidden when the onload event of the view that holds the image is fired. The onload event is fired when that view attaches its resource.

Enjoy!

rollatwork
11-22-2004, 12:45 PM
Hi Antun,

Would this technique also lend itself to SWFs as well as images?

The issue I am having is that I would like to display a "loading" SWF as the resource, a SWF, is being loaded.

This SWF is a video converted into SWF format. What currently happens is that the SWF will begin playing and pause periodically as the resource is loaded.

My concern is that using this technique, will the "loading" image be display until the entire resource is loaded?

Thanks,
Roll

dheon09
12-06-2005, 03:08 AM
Hey Antun,

Can i Ask for the swf file....i can't download it on the site...can you please post it again..THANKS

zilent
12-08-2005, 04:22 AM
just a question... dosent the swf playing slow the laszlo app?

like, aint it better to start/stop the animation playing, instead of just making it not visible ?


play="false"
play="true"

k07032
12-28-2005, 08:25 AM
I have the same issue that the swf file will play and pause while the resources are loading. Sometime, it pauses too long that doesn't really give the user the idea of some loading. Instead, it gives out the impression of things being stuck. I've tried to use play and stop, but that doesn't seem to solve the problem.
Appreciate any helps or suggestions.