então..
eu fiz um echo com for each no php pra ter certeza se o array está
correto e sim, na parte do php tá tudo certo.
vendo pelo debug, não acehi a variavel ResultEvent, mas existe a
variavel evt.result = null

onde pode estar o erro?

valeu,
Carlos


On 27 dez, 11:08, "Mário Júnior" <[email protected]> wrote:
> Entao... callbacks são justamente o result e o fault, nesse caso.
> Faz muito tempo q nao programo php, mas acho q a montagem do array está
> estranha.
>
> De qualquer forma, alguma coisa deve chegar no flex serializado, coloque um
> break point na primeira linha do seu resultHandler e verifique na aba
> variables do fxbuilder (ou eclipse) qual o conteudo da variavel ResultEvent.
>
> Outra coisa, q pode ser feito antes disso, é criar um arquivo q vá usar sua
> classe e fazer um simples echo ou print do valor de retorno
> só para vc ter certeza que o seu método/classe está funcionando como
> esperado. Ou, ainda, usar o amfphp browser para testar seu método já no
> ambiente Flex.
>
> Qualquer coisa dá um alô pra gente.
>
> 2008/12/27 Carvalhar <[email protected]>
>
>
>
>
>
> > 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_error());
> > >                 }
> > >                 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 que 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
>
> --
> 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
-~----------~----~----~----~------~----~------~--~---

Responder a