Volter
Volter

Reputation: 173

flex 4 php communication

i have new discovered Flex 4 and i think, that it is great, but i can't do simple things in it. for example, i want communication between flex/actionscript and php class, so i have created php class:

<?php
class main{
    public static function test_function(){
        return 'hello';
    }
}
?>

and i can't find out how to retrive 'hello' from that class in Actionscript

    <![CDATA[
        import mx.controls.Alert;

        function button1_click():void{
            Alert.show(test_function()); // this is mistake
        }
    ]]>

so i know that this is mistake, but i don't know how to do correct.

Upvotes: 0

Views: 282

Answers (2)

J_A_X
J_A_X

Reputation: 12847

Erm, you do know that PHP is a server side language right? You're missing the whole point of the client-server side communication protocol.

First, make sure you have a web server up being able to serve your php script. Second, you need to be able to go to your script and using a certain method (like GET/POST variables, REST, SOAP, etc), be able to call your function. From there, Flex should be able to ping that script through the web server.

But again, you're lacking a lot of knowledge around how web applications work and should read up on it.

Upvotes: 0

Maxime Pacary
Maxime Pacary

Reputation: 23081

This example of login dialog with Flex and PHP should help you.

Upvotes: 1

Related Questions