Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flex > Flex 2, 3 & 4

Reply
 
Thread Tools Rate Thread Display Modes
Old 08-01-2012, 03:29 PM   #1
Burn86
Registered User
 
Join Date: Aug 2012
Posts: 1
Default HttpService Problem

Hello to all.
I'm trying to create a flex web application connected to a database with php.
-Main Application-
ActionScript Code:
<fx:Declarations>         <components:Com_Db_Users id="com_db_users"/>     </fx:Declarations>     <fx:Script>         <![CDATA[             protected function start():void             {                 txtarea_debug.text = com_db_users.getId();             }         ]]>     </fx:Script>     <s:states>         <s:State name="test"/>     </s:states>     <s:TextArea id="txtarea_debug" x="10" y="10" width="365" height="600"/>     <s:Button id="btn_start" x="419" y="513" label="Load" click="start()"/>

-Component-
ActionScript Code:
<fx:Declarations>         <s:HTTPService id="userRequest" url="database/test.php" useProxy="false" method="POST"                        result="resultHandler(event)" fault="faultHandler(event)"/>     </fx:Declarations>     <fx:Script>         <![CDATA[             // component core             import mx.controls.Alert;             import mx.rpc.events.FaultEvent;             import mx.rpc.events.ResultEvent;                         // db             [Bindable] protected var id:int = 0;             [Bindable] protected var get_id:Boolean = false;                         private function faultHandler(fe:FaultEvent):void             {                 Alert.show(fe.fault.message);             }                         private function resultHandler(re:ResultEvent):void             {                 //Alert.show(String(re.result.query));                 if (get_id)                 {                     get_id = false;                                         if (re.result.query == "loaded")                     {                         id = re.result.id;                     }                     else if (re.result.query == "empty")                     {                         id = 0;                     }                 }             }                         public function getId():Boolean             {                 var tmp_nick:String = val;                                 get_id = true;                                 var params:Object = {};                 params.get_id = get_id;                                 userRequest.send(params);                                 if (id > 0)                     return true;                 else                     return false;             }         ]]>     </fx:Script>

The problem is that i want that the function getId(), in the component, will return a value processed after the php file is readed, so i can pass it to the module/component/application that used it. But this will never happen because this part
codice:
ActionScript Code:
if (id > 0)         return true;     else         return false;

will always be read before that the php file will be readed. How can i do?is there a way to tell him to wait till the file is read and then continue?
Thanks in advice and sorry for my bad english.

Last edited by Burn86; 08-01-2012 at 03:29 PM. Reason: edit title
Burn86 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:38 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.