Skip navigation
Currently Being Moderated

I'm confused on how to get started here...??

Jul 2, 2008 2:55 AM

I'm trying to create a very simple Flex app that simply returns the eBay official time using their web services. I already have PHP scripts setup to do this and a page that simply prints the eBay time after grabbing it from their API.

If I understand correctly I should be able to simply create a button in Flex and make it so that when you click that button it calls this PHP page and displays the response in a text element or a grid in my Flex app..??

What I don't get is how do I make the button actually do that? I've got a Flex app created and I'm in design mode with a button and a Text field dragged onto the design...and now I have no idea what to do next.

If I can get a quick jump start on how to attach this button to the PHP and display back in the text area I think it'll help me understand a lot better how to move on with Flex.

Any information would be greatly appreciated. I just can't seem to find a simple sample like this anywhere. Thanks!!
 
Replies
  • Currently Being Moderated
    Jul 2, 2008 3:22 AM   in reply to Angell EYE
    Hi,

    Please visit the URL below for details on how to invoke a PHP from Flex application.

    http://livedocs.adobe.com/flex/3/html/data_access_2.html#193905

    You can also access web service directly from the Flex application. Please visit the URL below for more details.

    http://livedocs.adobe.com/flex/3/html/data_access_1.html#110674

    Hope this helps.
     
    |
    Mark as:
  • Currently Being Moderated
    Jul 2, 2008 10:23 AM   in reply to Sujit Reddy G
    In this code, change the url of HTTPService to that for your PHP script. Also, change the value of resultFormat to e4x if your PHP script is returning XML. Other changes might be necessary, of course.
     
    |
    Mark as:
  • Currently Being Moderated
    Jul 2, 2008 4:30 PM   in reply to Angell EYE
    Yeah, for this kind of stuff you need to know some things.

    The fact that you are unfamiliar with the <Script> tag, or at least the CDATA section within it, tells me you need to read at least these FB3 help section, and all its sub-sections:

    Flex Programming Elements

    If you do that most of your questions will be answered. I never use design view, so I can't speak to those questions.

    I'll answer some of your questions now.

    The language in the <Script> tag is ActionScript 3. It needs to be wrapped in a CDATA section because otherwise stuff like < & > etc. will be intepreted as bad XML. Remember, the MXML file is an XML file.

    You will know what to import either because you have learned the ActionScript you need to do what you are trying to do, or because you will get errors and then you know you need to import. Sometimes the import statement will be added automatically.

    I always hand code my Flex apps, and never use design mode, because once you get used to it, its not hard, and if you will be coding AS (ActionScript) you will be there anyway. Being able to code AS is where the $$$ will come as Flex grows in popularity. I believe there will be a ton of cash for people good at AS over the next 5 years.

    Read Essential ActionScript and you'll be all set.

    Be aware that events for things like HTTPService are a bit different than events for things like buttons, etc. because they do not get dispatched based on user input. And they are dispatched asynchronously, meaning you call the HTTPService send() method, and you can't depend on the data being available right away. That's why we use the result event.

    Go through the "Flex Programming Elements" and all its sub-sections, and over time, go through the entire FB3 help system, and you will reach Nirvana. I went through most of the FB 2.0.1 help system twice, compiling all the sample programs, a little each day over a four or five month period, and I learned a lot.


     
    |
    Mark as:
  • Currently Being Moderated
    Jul 13, 2008 10:35 PM   in reply to Angell EYE
    Yeah, Flex is really kool, but AIR is where mucho cash will be in the next 5 - 10 years.
     
    |
    Mark as:
  • Currently Being Moderated
    Jan 10, 2011 7:48 AM   in reply to Angell EYE

    Not in all mobiles...  it mean iOS is excluded, i mean flash player.

     

    about air...  its apps can be runned on Android and

    iOS, but dont know if blackberry yet has had AIR runtime released... it should

     

    on symbian/windows i dont think there is any AIR runtime available

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points