A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: dataBinding and atributes

  1. #1
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429

    [Flex] dataBinding and atributes

    yep, me again.

    I'm following the tutorial here.

    It's working fine for me, but I need to extend it a little and I can't seem to find any documentation on it.

    Basically, my PHP is sending back an xml string like this:
    <results>
    <row>
    <artist>artist1</artist>
    <song>song1</song>
    <price cost='99'>clickme.swf</price>
    </row>
    </results>

    I have the HTTPService's result tag call a function named bsResultHandler() shown here:
    Code:
            private function bsResultHandler(event:ResultEvent):void{
                // Save a reference to the list of bloggers
                resultsCol = event.result.results.row;
                trace(resultsCol.toString());
                // Hide the busy cursor
                CursorManager.removeBusyCursor();
            }
    My DataGrid's dataProvider is resultsCol.

    How can I get one of the DataGridColumns to show the value of cost?
    right now I have:
    <mx:DataGridColumn headerText="Preview" dataField="cost"/>
    Last edited by jAQUAN; 08-25-2006 at 08:05 PM.

  2. #2
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    K, I pretty much got that figured out. Seems you can pass simple url vars to the itemRenderer.
    So I just had the php send back an xml tag that looked like this:
    <buyBtn>buynow.swf?price="99"&id="12345"</buyBtn>

    and inside the swf I just used:
    price_txt.text = "$0."+price;

    So I can have loaded .swf's communicate with loaded vars, that's cool. But now my question is, how do I reference vars inside a flex <mx:Script> tag?

    Say I had a script tag as follows:
    Code:
       <mx:Script>
       	<![CDATA[
       		public var playState:Boolean = true;
       	]]>
       </mx:Script>
    how would I trace playState from an .swf loaded into a cell of a dataGrid?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center