I'm learning about Working with RestfulX Model Attachments by following this link http://dima.github.com/2009/03/19/working-with-restfulx-model-attachments.html
But I got the error when I clicked to attach a file.
TypeError: Error #1034: Type Coercion failed: cannot convert flash.net::FileReference@34f1d99 to org.restfulx.utils.RxFileReference. at rxmodelattachments.components.generated::ContactBox/fileSelected()[C:\Data\Workspace\rx_model_attachments\src\rxmodelattachments\components\generated\ContactBox.mxml:88] at 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. from the link you will see they use file.addEventListener which is impossible. Cos RxFileReference doesn't have method addEventListener. So I need to use .reference to allow me to use addEventListener method. How to solve this problem. Thank you.