Dear Friends
I’m new in the Flex world.
I’ve a problem with a my custom component.
I’ve make a TitleWindow with this code
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="300" height="250" title="PopUp Info"
showCloseButton="true" close="PopUpManager.removePopUp(this)" horizontalAlign="center" verticalAlign="middle">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
import flash.events.MouseEvent;
import mx.controls.dataGridClasses.DataGridColumn;
private function doLogin(e:MouseEvent):void {
PopUpManager.removePopUp(this);
}
//Procedura per leggere e formattare i tag XML dopo la chiamata webservices
override protected function childrenCreated():void{
super.childrenCreated()
var url:URLRequest = new URLRequest("http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=00WQKXFRETRXJMXW8682&Operation=ItemLookup&ResponseGroup=Reviews,Images,Large&ItemId=B000IJVETY");
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onData);
loader.load(url);
}
private function onData(e:Event):void{
var xdata:XML = XML(e.target.data);
var ns:Namespace = xdata.namespaceDeclarations()[0];
default xml namespace = ns;
dg.dataProvider = xdata..SimilarProduct;
default xml namespace = new Namespace("");
}
private function getNameSpaceData(itemh:Object, column:DataGridColumn):String{
var xdata:XML = XML(itemh);
var ns:Namespace = xdata.namespaceDeclarations()[0];
default xml namespace = ns;
var q:QName = new QName(ns, column.dataField);
var data:String = itemh[q];
default xml namespace = new Namespace("");
return data;
}
]]>
</mx:Script>
<mx:DataGrid id="dg" x="10" y="10" width="260" height="148">
<mx:columns >
<mx:DataGridColumn headerText="Title" labelFunction="getNameSpaceData" dataField="Title"/>
<mx:DataGridColumn headerText="Asin" labelFunction="getNameSpaceData" dataField="ASIN"/>
</mx:columns>
</mx:DataGrid>
<!-- <mx:Label id="labelUSER" text="{user}" x="10" y="182" width="133"/> -->
</mx:TitleWindow>
Now I wish pass a variable** id** to my string to make everytime a new UrlRequest like this.
URLRequest("http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=00WQKXFRETRXJMXW8682&Operation=ItemLookup&ResponseGroup=Reviews,Images,Large&ItemId="+id);
I’ve this id in a my service.as class that extend another class.
How I can read the value inside this id variable ?
I’ve make this too
[Bindable]
public var id: String;