lib.lzx
<library>
<class name="upload_buton" extends="button" text="Browse">
<passthrough>
import flash.net.*;
</passthrough>
<handler name="onclick">
canvas.fr.addListener(this);
this.browse();
</handler>
<handler name="oninit" args="invoker">
<![CDATA[
if (typeof canvas.fr == 'undefined')
{
canvas.fr = new flash.net.FileReference();
}
]]>
</handler>
<method name="browse">
<![CDATA[
canvas.fr.browse();
]]>
</method>
<method name="getName">
<![CDATA[
return canvas.fr.name;
]]>
</method>
<method name="upload">
<![CDATA[
if (typeof canvas.file_upload_w == 'undefined')
{
canvas.file_upload_w = new lz.file_upload(canvas, {});
}
canvas.file_upload_w.setText(this.getName());
file_upload_.progressBar.setValue(0);
canvas.file_upload_w.open();
canvas.fr.upload('cgi-bin/vlp_cgi.cgi?' + this.querystring);
]]>
</method>
<method name="onComplete" args="fr">
<![CDATA[
canvas.file_upload_w.setValue(100);
canvas.file_upload_w.close();
canvas.fr.removeListener(this);
canvas.upgrade_confirm_w.upgrade();
]]>
</method>
<method name="onProgress" args="fr, bytesLoaded, bytesTotal">
<![CDATA[
canvas.file_upload_w.setValue(bytesLoaded * 100 / bytesTotal);
]]>
</method>
<method name="onSelect" args="fr">
<![CDATA[
this.edittext.setAttribute('text', this.getName());
]]>
</method>
<method name="onCancel" args="fr">
canvas.fr.removeListener(this);
</method>
</class>
<upload_buton/>
</library>
main.lzx
<canvas>
<include href=”lib.lzx”/>
</canvas>
swf9 canvas.fr.browse() not working