# How to read a variable from a custom component

**URL:** <https://forum.kirupa.com/t/how-to-read-a-variable-from-a-custom-component/279878>\
**Category:** flash\
**Created:** [January 20, 2009, 9:34am UTC](https://forum.kirupa.com/t/how-to-read-a-variable-from-a-custom-component/279878 "2009-01-20T09:34:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryosaeb4](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@ryosaeb4](https://forum.kirupa.com/u/ryosaeb4)\
**Post date:** [January 20, 2009, 9:34am UTC](https://forum.kirupa.com/t/how-to-read-a-variable-from-a-custom-component/279878/1 "2009-01-20T09:34:34Z")

</div>

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

```auto

<?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 {
               &nbsp;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.

```auto
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

```auto
[Bindable]
public var id: String;

```

🔗
