ruby on rails - Type Coercion failed: cannot convert flash.net::FileReference@34f1d99 to org.restfulx.utils.RxFileReference -


i'm learning working restfulx model attachments following link http://dima.github.com/2009/03/19/working-with-restfulx-model-attachments.html

but got error when clicked attach file.

typeerror: error #1034: type coercion failed: cannot convert flash.net::filereference@34f1d99 org.restfulx.utils.rxfilereference. @ rxmodelattachments.components.generated::contactbox/fileselected()[c:\data\workspace\rx_model_attachments\src\rxmodelattachments\components\generated\contactbox.mxml:88] @ rxmodelattachments.components.generated::contactbox/selectfile()[c:\data\workspace\rx_model_attachments\src\rxmodelattachments\components\generated\contactbox.mxml:80]

i think because of rxfilereference on these lines of code

private var file:rxfilereference; private function choosefile():void { file = new rxfilereference("avatar"); file.reference.addeventlistener(ioerrorevent.io_error, ioerrorhandler, false, 0, true); file.reference.addeventlistener(event.select, selectfile, false, 0, true); file.reference.addeventlistener(event.cancel, cancelbrowse, false, 0, true); file.reference.browse(); }

p.s. link see use file.addeventlistener impossible. cos rxfilereference doesn't have method addeventlistener. need use .reference allow me use addeventlistener method. how solve problem. thank you.

i think dont have updated choosefile function

you using

file.reference.addeventlistener(..); 

while link have

file.addeventlistener(..); 

complete function link provided in question

private function choosefile():void {       file = new rxfilereference("avatar");       file.addeventlistener(ioerrorevent.io_error, ioerrorhandler, false, 0, true);       file.addeventlistener(event.select, selectfile, false, 0, true);       file.addeventlistener(event.cancel, cancelbrowse, false, 0, true);       file.browse();     } 

hopes helps


Comments