1

Hi I am new to flex, I wanted to use flex line chart for displaying data stored in mysql table. Can anyone suggest me on how do I do this with flex as UI and mysql as db, I am not sure how to call .php file in flex to query from mysql. I wanted to show some data of time v/s temperature

I wrote a php file to query data from mysql, but my flex program is not able to connect to mysql, is there any configuration I need to update. I am using XAMPP

1

1 Answer 1

1

Generally speaking theres no extra configuration you need to make this work as hering said in the comment an HTTPService will serve your purposes. Here's what you need to do:

private var myCollection:ArrayCollection;

public function creationComplete(event:Event):void
{
    var myService:HTTPService = new HTTPService();
    myService.url = "myscript.php"
    myService.method = "POST";
    myService.addEventListener(ResultEvent.RESULT, resultHandler);
    myService.send();
}

public function resultHandler(event:ResultEvent):void
{
    if(event.result..entries is ArrayCollection)
        myCollection = event.result..entries;
    else if(event.result..entries is Object)
        myCollection = new ArrayCollection(event.result..entries)
}

I'm assuming you're adding a listener to whatever control this service call lives in for creation complete that calls the creation complete function. I also assume you have (php generate) an xml structure like:

<entry>
    <entries>1</entries>
    <entries>2</entries>
</entry>
Sign up to request clarification or add additional context in comments.

1 Comment

To note if you see nothing add a listener to the HTTPService for the FaultEvent.FAULT string and you'll get messages if you get something other than an ok message from the server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.