antun
11-06-2003, 01:14 PM
If you use setSource() to set the art asset of a view at runtime, you should be aware that the LPS server has to make an HTTP request for that resource. This can be avoided by using the file: prefix in the URL. Naturally this will only work for images saved within the same webapp as the LPS:
<canvas debug="true">
<simplelayout axis="y" spacing="10" />
<view name="foo" />
<button>
<method event="onclick">
foo.setSource( "file:compass.png" );
</method>
</button>
</canvas>
The client will still make the request to the LPS at run-time, so the image can still be downloaded at run-time, but it saves the LPS the work of doing the second request, thus improving performance.
This can be done with dataset declarations too, and you can still call the doRequest() method, however only the flat XML file will be returned. (i.e. you can't call a JSP this way).
Enjoy!
Thanks to iconfactory (http://www.iconfactory.com/) for the resource.
<canvas debug="true">
<simplelayout axis="y" spacing="10" />
<view name="foo" />
<button>
<method event="onclick">
foo.setSource( "file:compass.png" );
</method>
</button>
</canvas>
The client will still make the request to the LPS at run-time, so the image can still be downloaded at run-time, but it saves the LPS the work of doing the second request, thus improving performance.
This can be done with dataset declarations too, and you can still call the doRequest() method, however only the flat XML file will be returned. (i.e. you can't call a JSP this way).
Enjoy!
Thanks to iconfactory (http://www.iconfactory.com/) for the resource.