I have something similar working. Try something like this ..... private function fileBrowse():void { var imagesFilter:FileFilter = new FileFilter("Images", "*.jpg;*.jpeg"); configureListeners(imageFileRef); imageName.text = ""; imageFileRef.browse([imagesFilter]); }
private function configureListeners(dispatcher:IEventDispatcher):void { dispatcher.addEventListener(Event.COMPLETE, onComplete); dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler); dispatcher.addEventListener(Event.SELECT, onSelect); } |---------+-----------------------------> | | | | | "Shannon Hicks" | | | <[EMAIL PROTECTED]> | | | Sent by: | | | flexcoders@yahoogroups.com | | | 07/13/2006 01:00 PM | | | Please respond to | | | flexcoders | | | | |---------+-----------------------------> >-----------------------------------------------------------------------------------------------------------------------------| | | | To: <flexcoders@yahoogroups.com> | | cc: | | Subject: [flexcoders] File Upload problem? | >-----------------------------------------------------------------------------------------------------------------------------| Ok... I've been playing with the file upload stuff all morning, and am 80% of the way there. Here's a quick sample of what my Browse button fires: private function fileBrowse():void { var imagesFilter:FileFilter = new FileFilter("Images", "*.jpg;*.jpeg"); imageFileRef.addEventListener(Event.COMPLETE, onComplete); imageFileRef.addEventListener(ProgressEvent.PROGRESS, progressHandler); imageFileRef.addEventListener(Event.SELECT, onSelect); imageName.text = ""; imageFileRef.browse([imagesFilter]); } private function fileUpload():void { uploadProgressPopup = uploadProgressBar(PopUpManager.createPopUp(this, flexComponents.uploadProgressBar, true)); var urlVars:URLVariables = new URLVariables(); urlVars.userID = model.currentUser.userID; urlVars.mouseID = model.editMouse.mouseID; uploadTarget.data = urlVars; uploadTarget.method = URLRequestMethod.POST; for (var i:int=0; i < imageFileRef.fileList.length; i++){ imageFileRef.fileList[i].upload(uploadTarget); } } private function progressHandler(event:ProgressEvent):void { var percentLoaded:Number = Number((event.bytesLoaded / event.bytesTotal) * 100); uploadProgressPopup.doUpdateProgress(percentLoaded); Alert.show("The file is " + percentLoaded.toString() + "% loaded."); } private function onComplete(event:Event):void { Alert.show("Done."); PopUpManager.removePopUp(uploadProgressPopup); } Now, I can browse just fine, and my upload button fires off the upload, and the files make it safely to the server, where ColdFusion saves them to the filesystem. The only problem is that my progressHandler() and onComplete() methods never fire. Is there some trick? Do I need to have ColdFusion return something? Shan -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.9.10/387 - Release Date: 7/12/2006 --------------------------------------------------------------------------- This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender and erase this e-mail message immediately. --------------------------------------------------------------------------- ------------------------ Yahoo! Groups Sponsor --------------------~--> Yahoo! Groups gets a make over. See the new email design. http://us.click.yahoo.com/XISQkA/lOaOAA/yQLSAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
pic09961.gif
Description: GIF image