0 Replies Latest reply on Sep 23, 2009 7:22 AM by macdavid

    Viewstack issues inside Horizontallist

    macdavid Level 1

      I have a Horizontallist, which includes viewstacks that I use to show alternate images. The issue I am having is when I change to a alternate image for the first item in the Horizontallist, it changes other items in the Horizontallist  to the alternate image as well. The Viewstack ids are created as a part of the Horizontallist itemrenderer so they have the same ids, but should be a unique  instance. Anyone have any ideas how to correct this.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
      width="100%"
      height="100%"
      initialize="productService.send()" >
      <mx:Script>
      <![CDATA[
      import mx.collections.ArrayCollection;
      import mx.rpc.events.ResultEvent;

       

      [Bindable]
      private var myData:ArrayCollection;

       

      private function resultHandler(event:ResultEvent):void {
      myData = event.result.response.data.row;
      }
      ]]>
      </mx:Script>

       

      <mx:HTTPService id="productService" url="productView.php?method=FindAll" result="resultHandler(event)"/>

       

      <mx:TileList
      id="myList"
      dataProvider="{myData}
      itemRenderer=".productRenderer"
      height="100%"
      width="100%"
      columnCount="1"
      backgroundColor="white"
      selectable="false" />
      </mx:VBox>
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml
      width="800"
      height="200"
      horizontalScrollPolicy="off"
      verticalScrollPolicy="off">

       

      <mx:ViewStack id="productViewStack" horizontalGap="2"  width="100%" height="100%">
      <mx:HBox id="image1" label="image1"  verticalGap="0"  horizontalGap="0" horizontalScrollPolicy="off" verticalScrollPolicy="off">
      <mx:HBox width="320"  height="100%" verticalGap="0"  horizontalGap="0" verticalAlign="middle" horizontalScrollPolicy="off" verticalScrollPolicy="off"  horizontalAlign="center">
      <mx:Image source="images/product_images_sm/{data.image1}" />
      </mx:HBox>

       

      <mx:HBox width="100%" height="100%" verticalGap="0" horizontalGap="0" horizontalScrollPolicy="off" verticalScrollPolicy="off">
      <mx:VBox width="100%" height="100%" verticalGap="0" >
      <mx:Label text="{data.model}"
      textAlign="left"
      fontWeight="bold"
      fontSize="10"
      color="#030000"  width="200" />

       

      <mx:Label text="{data.name}"
      textAlign="left"
      fontWeight="bold"
      fontSize="10"
      color="#030000"  width="100%" />

       

      <mx:TextArea text="{data.description}"
      textAlign="left"
      fontWeight="normal"
      fontSize="10"
      editable="false"
      wordWrap="true"
      borderThickness="0"
      color="#000000" width="100%" height="141" horizontalScrollPolicy="off" verticalScrollPolicy="off"/>

       

      </mx:VBox>
      </mx:HBox>
      </mx:HBox>

       

      <mx:HBox id="image2" label="image2" verticalGap="0"  horizontalGap="0" horizontalScrollPolicy="off" verticalScrollPolicy="off">
      <mx:HBox width="640"  height="100%" verticalGap="0"  horizontalGap="0" verticalAlign="middle" horizontalScrollPolicy="off" verticalScrollPolicy="off>
      <mx:Image source="images/product_images_md/{data.image2}" />
      </mx:HBox>

       

      <mx:HBox width="100%"  verticalGap="0" horizontalGap="0" horizontalScrollPolicy="off" verticalScrollPolicy="off">
      <mx:VBox width="100%" height="100%" verticalGap="0" >
      <mx:Label text="{data.model}"
      textAlign="left"
      fontWeight="bold"
      fontSize="10"
      color="#030000"  width="200" />

       

      <mx:Label text="{data.name}"
      textAlign="left"
      fontWeight="bold"
      fontSize="10"
      color="#030000"  width="300" />

       

       

      </mx:VBox>
      </mx:HBox>
      </mx:HBox>
      </mx:ViewStack>
      <mx:LinkBar height="20" width="100%" dataProvider="{this.productViewStack}" fontSize="8" horizontalAlign="right"  backgroundAlpha="0.0"   y="175"/>
      <mx:HRule width="100%" y="196"/>
      </mx:Canvas>