PDA

View Full Version : HTTPRequest with {boundVar}


elastic
09-18-2009, 10:52 PM
I am setting up three variables to dynamically push content to an httpRequest (i hope). But I am hitting the brick wall.

Here's what I want to do - push a bound variable to the url="" section of the http request. I check in the debugger, and the contents of the variable are correct. yet this will not come through.

<mx:Script>
<![CDATA[
import mx.collections.ItemResponder;
import mx.events.ListEvent;

import mx.rpc.events.ResultEvent;


import mx.events.MenuEvent;
import mx.controls.Alert;
import mx.controls.Menu;

import mx.rpc.events.FaultEvent;




import mx.collections.ArrayCollection;


private var myProdPost:ArrayCollection;

private function myResultHandler(event:ResultEvent):void
{

myProdPost = event.result.response.data.row;

}


[Bindable]
public var grabStringPart1 = "http://mywebsite/test_site/bin-debug/Products.php?filter=";

[Bindable]
public var grabStringPart3 = "&method=FindAll";

[Bindable]
public var goString = "0000644";

[Bindable]
public var pushValues = grabStringPart1 + goString + grabStringPart3;



]]>
</mx:Script>

[B]<mx:HTTPService id="prodList" url="{pushValues}" result="myResultHandler(event)" showBusyCursor="true" makeObjectsBindable="true" />

<mx:Text id="testText" text="{pushValues}" x="10" y="477"/>


<mx:DataGrid id="myGrid" dataProvider="{myProdPost}" x="10" y="503" width="814" height="258" alpha=".6" editable="false" enabled="true" selectedIndex="0">
<mx:columns>
<mx:DataGridColumn dataField="products_model" headerText="Item Number" width="200"/>
<mx:DataGridColumn dataField="products_name" headerText="Item Name"/>
</mx:columns>
</mx:DataGrid>

maybe I am approaching this wrong? any suggestions on a better way to do this?

elastic
09-19-2009, 08:13 PM
This is actually solved, and the reason it was not working was because:

1. the ampersand character - in this case was a decimal value.
2. by itself, as the httpService performed inside the url string as text, it worked
3. when i included it as part of the variable, it broke