PDA

View Full Version : catching the event: "imgURL returns no image data in view.setSource(imgURL)"


MBachstein
01-12-2009, 02:26 AM
Hello,

I have an imageView, which source becomes set by mainView.setSource(imgURL).

As the images to display are quite large I do


mainView.setProxyPolicy(function (url) {return false;});


on init of the mainView. This was an advice in forum post http://forum.openlaszlo.org/showthread.php?t=12315 .

Now my question is how I can find out, if the imgURL does not return an image but xml.

Without setProxyPolicy(...) I could use the handler "onerror", but unfortunately this handler does not work with it.

Does anybody have an idea what I can do?

Here is an example code:

<canvas>
<node name="myNode"/>

<button height="30" width="150">Load Image
<handler name="onclick">
// imgurl returns no image Data
var imgurl = myNode;
parent.mainView.setSource(imgurl,"none");
</handler>
</button>
<view name="mainView" y="50" height="500" width="500" bgcolor="0xEEEEEE">
<handler name="onerror">
Debug.write("in onerror");
</handler>

<handler name="oninit" >
this.setProxyPolicy(function (url) {return false;});
</handler>
</view>
</canvas>


Kind Regards,
Marc