Because guys like Gordon are here, I'll also say that Instantiate is the 
correct word; instead of initialize. :)

-TH

--- In flexcoders@yahoogroups.com, "turbo_vb" <timh...@...> wrote:
>
> Man, I always forget at least one thing.   You also need to initialize
> the second ArrayCollection().
> 
> 
> [Bindable] public var dataRight:ArrayCollection= new ArrayCollection();
> 
> 
> 
> 
> Might want to give the itemRenderer a background, so that the double
> clicks will be triggered on the entire area.
> 
> 
> 
> 
> 
> -TH
> 
> 
> 
> --- In flexcoders@yahoogroups.com, "turbo_vb" <TimHoff@> wrote:
> >
> >
> > Hey Sal,
> > minor tweaks:
> >
> > public function addButton():void
> >
> > {
> >
> > dataRight.addItem( rightTiles.selectedItem );
> >
> > }
> >
> >
> >
> >
> > and:
> >
> >
> >
> >
> >
> >
> > <mx:HTTPService id="btnSrv"
> >
> > url="buttonData.xml"
> >
> > useProxy="false"
> >
> > result="handleQueryResult(event)"
> >
> > showBusyCursor="true"
> >
> > resultFormat="object"/>
> >
> >
> >
> >
> > -TH
> >
> >
> >
> > --- In flexcoders@yahoogroups.com, "s_hernandez01" s_hernandez01@
> > wrote:
> > >
> > > I am having trouble understanding the addItem method in AS3 with
> Flex.
> > I'm trying to simply add the item renderer with all it's data from
> > tilelist to tilelist.  I'm using two arraycollections to do the
> transfer
> > and the data is being populated through an xml file.  I know it's just
> > maybe 2 or 3 lines of code that I probably need, but can someone help
> > me, please?  Thanks
> > >
> > >
> > > // SAMPLE XML FILE
> > >
> > > <buttonData>
> > >     <product id="1">
> > >         <image>btnSkins/action_btn.png</image>
> > >         <price>10</price>
> > >     </product>
> > >     <product id="2">
> > >         <image>btnSkins/awards_btn.png</image>
> > >      <price>15</price>
> > >     </product>
> > >     <product id="3">
> > >         <image>btnSkins/beer_btn.png</image>
> > >      <price>20</price>
> > >     </product>
> > >     <product id="4">
> > >         <image>btnSkins/blog_btn.png</image>
> > >      <price>25</price>
> > >     </product>
> > > </buttonData>
> > >
> > >
> > > // MAIN FILE
> > >
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > layout="horizontal" creationComplete="btnSrv.send()">
> > >
> > >  <mx:Script>
> > >   <![CDATA[
> > >    import mx.collections.ArrayCollection;
> > >    import mx.rpc.events.ResultEvent;
> > >
> > >    [Bindable] public var dataLeft:ArrayCollection;
> > >    [Bindable] public var dataRight:ArrayCollection;
> > >
> > >    public function handleQueryResult(event:ResultEvent):void{
> > >     dataLeft = btnSrv.lastResult.buttonData.product;
> > >    }
> > >
> > >    public function addButton():void{
> > >     var item:Object = new Object();
> > >     dataRight.addItem(item);
> > >    }
> > >   ]]>
> > >  </mx:Script>
> > >
> > >  <mx:HTTPService id="btnSrv" url="buttonData.xml" useProxy="false"
> > >   result="handleQueryResult(event)" showBusyCursor="true"/>
> > >
> > >  <mx:TileList id="rightTiles" width="100%" height="50%"
> > dataProvider="{dataLeft}" itemRenderer="ipodThumb" columnWidth="94"
> > rowHeight="80"
> > >   doubleClickEnabled="true" doubleClick="addButton()"/>
> > >
> > >  <mx:TileList id="leftTiles" width="100%" height="50%"
> > dataProvider="{dataRight}" itemRenderer="ipodThumb" columnWidth="94"
> > rowHeight="80"/>
> > > </mx:Application>
> > >
> > >
> > > // ITEM RENDERER
> > >
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; width="108"
> > height="83">
> > >
> > >  <mx:Image source="{data.image}" verticalAlign="middle"
> > horizontalAlign="center" right="5" bottom="0" left="5" top="0"/>
> > >
> > > </mx:Canvas>
> > >
> >
>


Reply via email to