Estou fora de casa, mas como o Mario falou, vc deve receber o conteudo atraves do eventResult. Por exemplo, no eventResult coloque: myArray = event.result as array(); Bom, se não resolver avise!
Enviado de meu iPod Em 27/12/2008, às 08:32, Carvalhar <[email protected]> escreveu: > > ops...deixa eu corrigir: > > public function onInit():void { > var myarr1:Array = new Array(); > remoteMultiLanguage.getWordlist(); // tinha omitido > } > > > On 27 dez, 07:29, Carvalhar <[email protected]> wrote: >> hehehhe como assim callback?? conscientemente, nao defini nenhum >> callback nao :) >> o que é pra fazer mais detalhamente? >> >> eu estou usando o amfphp como modulo no drupal, algumas configuraç >> ões >> jah vem pre definidas. >> eu acho que o amfphp está funcionando ok, pq qdo definido no remote >> object uma função pro result e outra pro fault, ele encaminha >> corretamente. >> >> eu coloquei um event init() para chamar o "myRemote.myMethod();" >> >> enfim, meu codigo está abaixo: >> >> PHP MultiLanguageOne.php >> class MultiLanguageOne >> { >> >> public function getWordlist($myLang) >> { >> >> $link = mysql_connect('localhost', 'root', 'mysql'); >> if (!$link) { >> die('Não foi possível conectar: ' . mysql_erro >> r()); >> } >> mysql_select_db("drupal"); >> mysql_set_charset("utf8",$link); //default encoding >> of a php-MySQL >> connection is latin1 >> $numass=MYSQL_BOTH; >> >> $got = array(); >> $result = mysql_query("SELECT term, $myLang FROM >> international"); >> $keys=array_keys(mysql_fetch_array($result, >> $numass)); >> mysql_data_seek($result, 0); >> while ($row = mysql_fetch_array($result, $numass)) { >> $got[$row['term']]=$row[$myLang]; >> } >> mysql_free_result($result); >> mysql_close($link); >> >> return $got; >> } >> >> } >> >> MXML: >> <?xml version="1.0" encoding="utf-8"?> >> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >> layout="absolute" >> xmlns:flexlib="http://code.google.com/p/flexlib/" >> xmlns:local="*" >> xmlns:componente="componente.*" >> creationComplete="onInit();"> >> >> <mx:RemoteObject id="remoteMultiLanguage" endpoint="http://localhost/ >> drupal/services/amfphp" source="MultiLanguageOne" >> destination="amfphp" showBusyCursor="true"> >> <mx:method name="getWordlist" result="resultHandler(event)" >> fault="fault(event)"> >> <mx:arguments><myLang>{minhaLang}</myLang></mx:arguments> >> </mx:method> >> </mx:RemoteObject> >> >> <mx:Script> >> <![CDATA[ >> import mx.rpc.AsyncToken; >> import flash.net.sendToURL; >> import mx.collections.ArrayCollection; >> import mx.utils.ArrayUtil; >> import mx.controls.Alert; >> import mx.rpc.events.ResultEvent; >> import mx.rpc.events.FaultEvent; >> >> [Bindable] >> public var meuArray:Array; >> >> [Bindable] >> public var minhaLang:String = "br"; >> >> public function onInit():void >> { >> var myarr1:Array = new Array(); >> >> } >> public function >> resultHandler(evt:ResultEvent):void{ >> var myarr:Array = new Array(); >> myarr = evt.result as Array; >> trace("evt: " + myarr); >> Alert.show("Ueba","OK"); >> } >> public function fault(evt:FaultEvent):void{ >> >> Alert.show(evt.fault.toString(),"Erro na tradução"); >> } >> ]]> >> </mx:Script> >> >> <flexlib:HAccordion id="accordion" width="100%" >> height="100%" >> x="0" y="0" headerRenderer="componente.header_acordeon"> >> <componente:ArcodeonItem >> title="{meuArray[minhaLang] >> ['menu_home']}" width="100%" height="100%" id="menu_home"/> >> <componente:ArcodeonItem2 >> title="{meuArray[minhaLang] >> ['menu_portfolio']}" width="100%" height="100%" id="menu_portfolio"/ >> >> <componente:ArcodeonItem2 >> title="{meuArray[minhaLang] >> ['menu_blog']}" width="100%" height="100%" id="menu_blog"/> >> <componente:ArcodeonItem2 >> title="{meuArray[minhaLang] >> ['menu_foto']}" width="100%" height="100%" id="menu_foto"/> >> <componente:ArcodeonItem2 >> title="{meuArray[minhaLang] >> ['menu_sobre']}" width="100%" height="100%" id="menu_sobre"/> >> <componente:ArcodeonItem2 >> title="{meuArray[minhaLang] >> ['menu_contato']}" width="100%" height="100%" id="menu_contato"/ >> >> </flexlib:HAccordion> >> >> <componente:ExplorerDock width="100%" id="meuHeader"/> >> >> </mx:Application> >> >> On 26 dez, 23:31, "Mário Júnior" <[email protected]> wrote: >> >>> como vc definiu os callbacks? >> >>> 2008/12/26 Carvalhar <[email protected]> >> >>>> Olá, >> >>>> Quero mandar um array do php mas chega como AsyncToken no flex. >> >>>> meu array no php retorna ok, no estilo $meuArray['key'] = value >> >>>> pórem quando tento obtelo no flex, ele vem como AsyncToken qu >>>> e não >>>> converte nem como "as Array" >> >>>> no flex, chamo a função php assim: myRemote.myMethod(); >> >>>> porém quando o trace é que vejo que retorna como AsyncToken, j >>>> á tentei >>>> varias, mas no maximo consigo fazer retornar como null. >> >>>> o que pode estar dando errrado? >> >>>> valeu, >>>> Carlos >> >>> -- >>> Mário de Souza Júnior >>> Programador Java / Adobe Flexhttp://blog.mariojunior.com > > --~--~---------~--~----~------------~-------~--~----~ Você recebeu esta mensagem porque está inscrito na lista "flexdev" Para enviar uma mensagem, envie um e-mail para [email protected] Para sair da lista, envie um email em branco para [email protected] Mais opções estão disponíveis em http://groups.google.com/group/flexdev -~----------~----~----~----~------~----~------~--~---
