Professional Web Applications Themes

How to get an XML value into a local variable after loading using Connector. - Macromedia Flash Data Integration

I have loaded the XML data into flash using connector, and can bind it to a component. Is there a way to assign a specific value to a local flash variable? I want to use the text from the xml string as a visual element and the TextArea component limits that. Thanks for any help. Jason...

  1. #1

    Default How to get an XML value into a local variable after loading using Connector.

    I have loaded the XML data into flash using connector, and can bind it to a
    component.

    Is there a way to assign a specific value to a local flash variable?

    I want to use the text from the xml string as a visual element and the
    TextArea component limits that.

    Thanks for any help.

    Jason


    Jason Huff Guest

  2. #2

    Default Re: How to get an XML value into a local variable afterloading using Connector.

    Hello,

    let's see if I understood your question:

    You are using XMLCon, right? That means you are also using a DataSet (binding
    them through the dataProvider property). So, once you have a DataSet binded,
    you can access anything in it by ActionScript using the following code:

    myString = myDataSet.dataProvider.getItemAt(index).userName;

    Two things: first, use index to access rows; second, in the above example, I
    am saving a user name (userName = name of the column) into the myString
    variable.

    I hope this will help,

    Simon.

    SimonTheSwift Guest

  3. #3

    Default Re: How to get an XML value into a local variable afterloading using Connector.

    Simon,

    Nice post. Any chance you could reference some 'good' reading material on
    the dataSet component? I'm having some real issues using it when I'm not using
    it with a dataGrid. Your example is good, but when I use it in my script the
    trace displayes it as 'undefined.'

    Originally posted by: SimonTheSwift
    Hello,

    let's see if I understood your question:

    You are using XMLCon, right? That means you are also using a DataSet (binding
    them through the dataProvider property). So, once you have a DataSet binded,
    you can access anything in it by ActionScript using the following code:

    myString = myDataSet.dataProvider.getItemAt(index).userName;

    Two things: first, use index to access rows; second, in the above example, I
    am saving a user name (userName = name of the column) into the myString
    variable.

    I hope this will help,

    Simon.



    andersonsidney Guest

  4. #4

    Default Re: How to get an XML value into a local variable afterloading using Connector.

    I am sorry for taking some time before replying - work, but Flash work, which
    is ok.

    Concerning working with a DataSet on its own - dragged onto the stage, given
    instance name and provided data using myDataSet.items = someArray; - the way to
    access data in it is by using DataSet class methods and properties, such as
    currentItem.somePropertyName, next(), hasNext(), etc. (see Using Components:
    Components Dictionary - DataSet component (Flash Professional only).
    Communication with a DataSet in this way does not require defining a schema.

    To make use of the DataProvider API, you will have to first define your
    attributes (relational DBs terminology) = component properties (Flash
    terminology) in the Schema tab of your DataSet (using the Component Inspector).
    For some strange reason (someone might tell me why) I could access the data in
    my DataSet using the DataProvider API methods only after binding the DataSet to
    a DataGrid. It did not matter whether I deleted the DataGrid afterwards. But
    just like that, it really gives "undefined". The manual says that this output
    appears when the index provided for the method
    myDataSet.dataProvider.getItemAt(index).someProper tyName is out of range. I
    don't know if that's the answer.

    Anyway, the second way to access data in a DataSet using ActionScript is
    through the methods (and one property) of the DataProvider API.

    Readings: One - the doent I mentioned above (Using Components: Components
    Dictionary) for both classes DataSet and DataProvider API. Two - very clear
    reading on DataSets can be also found in Using Flash: Data Integration.

    I hope this will help,

    Simon.

    SimonTheSwift Guest

Similar Threads

  1. Issues when loading Flash Player from Local Domain
    By thegoblin in forum Macromedia Flash Flashcom
    Replies: 2
    Last Post: April 6th, 02:25 AM
  2. Cross-domain loading module to local application
    By Bzyku in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: March 7th, 09:48 PM
  3. Loading local XML file
    By NoNickNeeded in forum Macromedia Flash Data Integration
    Replies: 5
    Last Post: January 22nd, 06:52 PM
  4. XML Connector URL set to variable?
    By redtiger in forum Macromedia Flash Data Integration
    Replies: 3
    Last Post: June 8th, 05:41 PM
  5. Need to Access a Local Variable
    By MajorH in forum Macromedia Flash Data Integration
    Replies: 10
    Last Post: February 22nd, 03:26 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139