help needed to send variables


hello guys,

 

i developing application has login system. login made through php in component.

everything ok, need send userid component main application..

 

when component checks login information ok, makes login component invisible , change main application currente state. cannot send variable component main application , use there. need t send user id other functions among main application need in order make proper querys php..

 

any ideas on how can make userid variable available use on main application?

 

this actionscript using component, validate login:

 

import mx.core.application;
import mx.rpc.events.resultevent;

 

// actionscript file

 


public function init():void{
   
}

 

public function dologin():void{
    if(username.text !="" && password.text !=""){
        mylogin.dologin();
    } else {
        mensagemerro.text ="preencha os campos para logar";
    }
}

 

public function resultdologin(e:resultevent):void{
    if(e.result.login =="ok"){
        application.application.telalogin.visible=false;
        application.application.currentstate='cel_cupons'
   
   
    } else {

 

        application.application.telalogin.visible=true;
        application.application.telalogin.mensagemerro.text = e.result.mensagem;
       
    }
}

 

and here login component:

 

 

<?xml version="1.0" encoding="utf-8"?>
<s:panel xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/mx" width="270" height="234" title="cadastro" fontfamily="verdana" fontweight="bold" fontsize="15" chromecolor="#ffffff" color="#c61919">

 

 

 

 

   
    <fx:script>
        <![cdata[

 

 

 

           
            protected function button1_clickhandler(event:mouseevent):void
            {
                application.application.currentstate='cel_cadastro_user';
            }

 

        ]]>
    </fx:script>

 

    <fx:script source="as/login.as"/>
    <fx:declarations>
        <s:remoteobject id="mylogin" destination="amfphp" source="login.login">
            <s:method name="dologin" result="resultdologin(event)">
                <s:arguments>
                    <username>{username.text}</username>
                    <password>{password.text}</password>
                </s:arguments>
            </s:method>
        </s:remoteobject>
    </fx:declarations>
    <s:label x="11" y="46" text="cpf" fontsize="15" color="#c61919"/>
    <s:label x="11" y="80" text="senha&#xd;" fontsize="15" color="#c61919"/>
    <s:label x="10" y="6" width="236" id="mensagemerro" color="#c61919" height="30" fontsize="12"/>
    <s:textinput x="71" y="41" width="175" id="username"/>
    <s:textinput x="71" y="75" width="175" id="password" displayaspassword="true"/>
    <s:button x="168" y="120" label="enviar" click="dologin()"  color="#c61919" chromecolor="#ffffff"/>
    <s:label x="22" y="150" text="ainda não é cadastrado?" fontsize="15" color="#c61919"/>
    <s:button x="37" y="172" label="crie seu cadastro!" chromecolor="#ffffff" focuscolor="#fababa" color="#c61919" click="button1_clickhandler(event)" skinclass="spark.skins.spark.buttonskin"/>
</s:panel>

 

 

 

thanks

you can't send variables unless have stamp attached them.  kidding , can either communicate through events , or , store userid in model/manager class .  must advise against using application.application architectural , readability reasons (how doing , thought flexglobals thing ? ).

 

sincerely,

  ubu



More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

CS5 Adobe Media Encoder: Encode failed because the source duration is nil.

cf_sql_integer vs cf_sql_bigint vs cf_sql_int??

localhost/joomla15/administrator doesnt work - Joomla! Forum - community, help and support