Is this working fine on the click of other items in tilelist? if so
then write your setItemDefault function like this:


public function setItemDefault():void
                {
                        myTile.selectedIndex = 0
                        selectedProduct = myTile.selectedItem;
                        dispatchEvent(new Event("changeProduct"));
                }

and then call this method on creationComplete of the component i.e.
VBox in your case.

let me know if you have any problems.

HTH,

-Ravi
On Apr 30, 4:55 pm, jeroen <[email protected]> wrote:
> <?xml version="1.0" encoding="utf-8"?>
> <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"; xmlns="*">
>     <mx:Metadata>
>         [Event("changeProduct")]
>     </mx:Metadata>
>
>     <mx:Script>
>         <![CDATA[
>         import mx.events.ListEvent;
>                 import mx.collections.*;
>                 import model.Product;
>
>                 [Bindable]
>                 public var dataObject:ArrayCollection;
>
>                 public var selectedProduct:Product;
>                 private function doChangeHandler(event:Event):void
>                 {
>                         var selectedItem:Object = 
> TileList(event.target).selectedItem;
>                         selectedProduct = selectedItem as Product;
>                         dispatchEvent(new Event("changeProduct"));
>                         trace(TileList(event.target).selectedItem)
>                 }
>
>                 public function unselect(propagate:Boolean = false):void
>                 {
>                         myTile.selectedItem=null;
>                         if (propagate)
>                         {
>                                 // propage un event "change" qui remets à  
> null le selectedProduct
>                                 myTile.dispatchEvent(new ListEvent("change"));
>                         }
>                 }
>
>                 public function setItemDefault():void
>                 {
>                         myTile.selectedIndex = 0
>                 }
>
>         ]]>
>     </mx:Script>
>
>     <mx:TileList id="myTile" dataProvider="{dataObject}"
> itemRenderer="ProductThumbnail"
>         width="100%" height="100%" columnWidth="205" rowHeight="220"
>         change="doChangeHandler(event)"
>         activate="setItemDefault()"
>          useRollOver="false" selectionColor="#FFFFFF"/>
> </mx:VBox>
>
> On Apr 30, 1:38 pm, sheetal <[email protected]> wrote:
>
> > itemrenderer wont make any difference.Chk the vent on which ur
> > displaying the enlarged image.setting selected index wont trigger any
> > event.
>
> > On Apr 30, 4:26 pm, jeroen <[email protected]> wrote:
>
> > > Okay I have TileList of thumbnails. When the user clicks on a
> > > thumbnail, the larger version of the image is promptly displayed in a
> > > VBox on the left.
>
> > > What I need to do was display the first thumbnail’s “larger version”
> > > in the VBox by default.
>
> > > I would think this would suffice
>
> > > myTile.selectedIndex = 0;
>
> > > But this does not..I am using a Itemrenderer would that make any
> > > difference?
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to