Results 1 to 6 of 6

Thread: Passing data to Flex

  1. #1
    Join Date
    Apr 2010
    Posts
    71

    Passing data to Flex

    It is very difficulty for me, but what exactly the data binding? Is it even useful? In short, absolutely. Chances are that you work with data in Flex. With data binding, a developer can automatically bind data from sources and targets. Still lost? Can anybody have any idea? Please help.

  2. #2
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Passing data to Flex

    You need to launch Flex Builder 3 and create a new project. Call it what you want, it will not affect the steps we will follow. Make sure to change the layout default of "absolute" to "vertical" to ensure that components are properly disposed. Go to the view mode source if needed and start by creating a tag script just under the tag application. It will contain ActionScript that we will write. Think <mx : Script> Flex as the beacon <script> his cousin, HTML.
    Code:
    <mx : Script>
        <! [CDATA [
        ]]>
    </mx : Script>
    You will notice that once the start-tag created everything else is automatically filled. Flex is as convenient as that. If you start typing a word (for example script) Flex always offer auto-completion for a tag. Enter the prefix "mx:" the tags become painful with large applications, so zap it!

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    Re: Passing data to Flex

    To work with a variable as given, we must now turn its binding. By adding the code [Bindable] on the line immediately before a variable, we declare as "liable". Create a variable "liable" called nomSelectionne type String and give it an initial value "person". Your code should look like this:

    Code:
    <mx : Script>
        <! [CDATA [
            [Bindable]
            private var nomSelectionne: String = "person";
        ]]>
    </mx : Script>
    Warning: the line [Bindable] is specific to each variable and must be declared each time. A line will not affect all the variable

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: Passing data to Flex

    You will write a basic function that will be used to display the contents of 'nomSelectionne' in a label that we will create later. It will be called 'changerNom' and will receive a parameter of type String 'changerPour' which will be assigned to the variable 'nomSelectionne'. I hope you get something that looks like this:

    Code:
    private function changerNom(changerPour:String):void
    (
        / / Replaces the name displayed by the new value
        nomSelectionne = changerPour;
    )
    After that, we're done with ActionScript. It remains only to create the components to run everything fine ActionScript.

  5. #5
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Passing data to Flex

    MXML makes it simple to load external files with tag HTTPService. Write the following code immediately below the tag application opening:

    Code:
    <mx:HTTPService url="assets / contenu.xml" id="donneesSite" resultFormat="E4X"/>
    You have created an HTTP service withid 'donneesSite' that points to the XML file in the directory 'assets'. The results are formatted in E4X, which allows us to navigate to the contents of the XML file. For this url is loaded, we must ask the application to send the request. We do this by adding the event 'creationComplete' to the tag application opening.

  6. #6
    Join Date
    Feb 2010
    Posts
    546

    Re: Passing data to Flex

    The XML data will need to be stored while waiting to be used. Add a tag script tag just below the application opening and declare the following variable:
    Code:
    <mx:Script>
        <! [CDATA [
        private var contenuSite: XMLList;
        ]]>
    </mx:Script>
    The type XMLList allows us to load XML data and work with. To demonstrate we will create a function that loads the XML data file and display them in labels.

Similar Threads

  1. Not able to remove "Flex Data Visualization Trial" watermark
    By GK knowledge in forum Windows Software
    Replies: 5
    Last Post: 13-07-2010, 06:36 AM
  2. Flex 3 or Flex 4 Training
    By Sindu in forum Portable Devices
    Replies: 6
    Last Post: 10-07-2010, 02:58 AM
  3. Flex 3.4 SDK in Flex Builder 3 plug-in
    By Vivan in forum Software Development
    Replies: 5
    Last Post: 09-07-2010, 11:59 PM
  4. Issue in Passing data between two webforms
    By FlayoFish in forum Software Development
    Replies: 2
    Last Post: 06-05-2009, 06:16 PM
  5. Problem Passing Data Dynamically in Java
    By Kushan in forum Software Development
    Replies: 3
    Last Post: 26-03-2009, 02:26 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,101,974.29122 seconds with 16 queries