Na verdade Kraus, cabe a ele procurar aproveitar o material da forma mais construtiva, se ele vai copiar e colocar, se é urgente ou não, se vai procurar entender.
E sobre o código todo q envie...pensei q era ele q tinha pedido e naum vc! =D 2009/11/3 Eduardo Kraus <eduardokr...@gmail.com> > Na real quero que ele passe a função dele para eu passar aonde esta o > problema e assim ele aprender como fazer, e não apenas copiar uma solução > pronta. > > Dá uma procurada em FileFilter > var *imagens*:FileFilter = new FileFilter( "Imagens", > "*.jpg;*.png;*.jpeg;*.gif" ) > file = new FileReference(); > file.browse( [ *imagens *] ); > > * > Eduardo Kraus* > Desenvolvedor > eduardokr...@gmail.com > blog.mxml.com.br > www.twitter.com/EduardoKraus > > > 2009/11/2 Patrick Facchin <patrick.facc...@gmail.com> > > Intão pra mim é *ConSelect * >> >> fileRef.addEventListener(Event.SELECT, ConSelect) >> >> Pega o lance todo pode facilitar: >> >> >> >> ####################################################################################### >> <?xml version="1.0" encoding="utf-8"?> >> <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" title="Novo >> Arquivo" >> close="{PopUpManager.removePopUp(this)}" >> showCloseButton="true" >> creationComplete="init();"> >> <mx:Script> >> <![CDATA[ >> import componentes.winProgress; >> import mx.managers.PopUpManager; >> import mx.controls.Alert; >> import mx.rpc.events.ResultEvent; >> import imports.Utils; >> >> >> private var BO:String = "FilesBo"; >> [Bindable] >> public var IDFolderCorrente:String = null; >> [Bindable] >> private var _winProgress:winProgress; >> [Bindable] >> public var LABELFolderCorrente:String = null; >> >> private var msg:String = null; >> >> private var fileRef:FileReference = null; >> public var pontParent:Object = null; >> >> private function init():void{ >> PopUpManager.centerPopUp(this); >> } >> /*############## INICIO Metodos Gerais >> #######################################################*/ >> private function onGetResp(rs:ResultEvent):void{ >> switch(rs.result.flag as String){ >> default: >> >> msg = rs.result.info as String; >> enviar(rs.result.sys as String); >> >> //PopUpManager.removePopUp(this); >> break; >> >> } >> } >> private function defaultAcao(acao:String,data:Array = >> null):void{ >> >> Utils.sendData("Controller","pointer",this.onGetResp,BO,acao,data); >> } >> >> /*############## FIM Metodos Gerais >> ##########################################################*/ >> /*############## INICIO Salva Pasta >> ##################################################*/ >> private function SalvarArquivo():void{ >> var arrFlex:Array = new Array(); >> >> arrFlex['fol_id'] = IDFolderCorrente; >> arrFlex['fil_name'] = nomePasta.text; >> arrFlex['fil_type'] = "jpg"; >> >> defaultAcao("filesSalvar",arrFlex); >> } >> /*############## INICIO Salva Pasta >> ##################################################*/ >> public function localizar():void { >> >> fileRef = new FileReference(); >> >> fileRef.addEventListener(Event.SELECT, ConSelect); >> //Enquanto estiver fazendo o Upload.. >> >> fileRef.addEventListener(ProgressEvent.PROGRESS,onUploadProgress); >> //Ao Terminar o Upload..... >> fileRef.addEventListener(Event.COMPLETE, >> onUploadComplete); >> >> >> >> >> //utilizando filtro para upload somente de imagem >> var tipos:FileFilter = new FileFilter( >> "Arquivos de Imagem","*.jpg"); >> var tiposArray:Array = new Array(tipos); >> this.fileRef .browse(tiposArray); >> } >> private function onUploadComplete(event:Event):void { >> pontParent.BuscaFiles(); >> PopUpManager.removePopUp(_winProgress); >> PopUpManager.removePopUp(this); >> Alert.show("Upload efetuado com sucesso!", "Informação"); >> } >> >> private function ConSelect(event:Event):void { >> Clogo.text = fileRef.name; >> } >> >> private function onUploadCanceled(event:Event):void { >> PopUpManager.removePopUp(_winProgress); >> _winProgress == null; >> fileRef.cancel(); >> } >> public function onUploadProgress(event:ProgressEvent):void >> { >> var numPerc:Number = >> Math.round((Number(event.bytesLoaded) / Number(event.bytesTotal)) * 100); >> _winProgress.progBar.setProgress(numPerc, 100); >> _winProgress.progBar.label = numPerc + "%"; >> _winProgress.progBar.validateNow(); >> if (numPerc > 90) { >> _winProgress.btnCancel.enabled = false; >> } else { >> _winProgress.btnCancel.enabled = true; >> } >> } >> public function enviar(FileID:String):void { >> if (this.fileRef == null) return; >> >> _winProgress = winProgress(PopUpManager.createPopUp(this, >> winProgress, true)); >> _winProgress.btnCancel.addEventListener("click", >> onUploadCanceled); >> _winProgress.title = "Uploading de arquivo"; >> _winProgress.txtFile.text = fileRef.name; >> _winProgress.progBar.label = "0%"; >> PopUpManager.centerPopUp(_winProgress); >> >> >> var params:URLVariables = new URLVariables(); >> params.fil_id = FileID; >> params.fil_name = nomePasta.text; >> params.fil_type = fileRef.type; >> >> var request:URLRequest = new >> URLRequest("/FileUpload.php"); >> request.method = URLRequestMethod.POST; >> request.data = params; >> request.method = URLRequestMethod.POST; >> >> this.fileRef.upload(request, "nomeFile"); >> } >> >> ]]> >> </mx:Script> >> <mx:HBox width="100%" height="100%"> >> <mx:Form width="100%" height="100%"> >> <mx:FormItem label="Nome:" required="true"> >> <mx:TextInput id="nomePasta"/> >> </mx:FormItem> >> <mx:FormItem label="Arquivo:"> >> <mx:HBox id="FHClogo"> >> <mx:TextInput id="Clogo" enabled="false"/> >> <mx:Button label="Localizar..." >> click="localizar()"/> >> </mx:HBox> >> </mx:FormItem> >> <mx:FormItem label="Pasta Corrente:"> >> <mx:TextInput enabled="false" id="pastaCorrente" >> text="{LABELFolderCorrente}"/> >> </mx:FormItem> >> <mx:FormItem label="Nome:"> >> <mx:Button label="Salvar" click="SalvarArquivo()"/> >> </mx:FormItem> >> </mx:Form> >> </mx:HBox> >> </mx:TitleWindow> >> >> ######################################################################################## >> >> >> >> >> 2009/11/2 Eduardo Kraus <eduardokr...@gmail.com> >> >> Dae Chará >>> >>> Me passa a função *sel**ectHandler(event:Event)* * >>> Eduardo Kraus* >>> Desenvolvedor >>> eduardokr...@gmail.com >>> http://blog.mxml.com.br >>> http://twitter.com/EduardoKraus >>> >>> 2009/11/2 Eduardo Burko <eduardobu...@gmail.com> >>> >>>> Galera... >>>> >>>> Estou tentando fazer um simples upload de arquivo... >>>> >>>> Mas quando uso o método BROWSER, na minha telinha só ta rolando escolher >>>> JPG... não sei mais o que fazer... >>>> >>>> Alguém já passou por isso ?? >>>> >>>> import flash.net.FileReference; >>>> import flash.net.FileFilter; >>>> >>>> private var fileRef:FileReference; >>>> >>>> // Called to add file(s) for upload >>>> private function addFiles2():void { >>>> if(upload_eventos_btn.label == "Escolher"){ >>>> fileRef = new FileReference(); >>>> fileRef.addEventListener(Event.SELECT, selectHandler); >>>> fileRef.addEventListener(Event.COMPLETE, completeHandler); >>>> fileRef.browse(); >>>> }else{ >>>> doUpload(); >>>> } >>>> } >>>> >>>> Abraços >>>> >>>> Eduardo Burko >>>> >>>> >>>> >>> >>> >>> >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ Você recebeu esta mensagem porque está inscrito na lista "flexdev" Para enviar uma mensagem, envie um e-mail para flexdev@googlegroups.com Para sair da lista, envie um email em branco para flexdev-unsubscr...@googlegroups.com Mais opções estão disponíveis em http://groups.google.com/group/flexdev -~----------~----~----~----~------~----~------~--~---