2 Replies Latest reply on Jul 8, 2007 7:08 AM by dresna

    Using viewstates with repeater ?

    dresna
      Im trying to loop a panel in defualt viewstate and then In a view state called advanced I want to remove the loop and show other content. But flexbuilder 2.01 keeps throwing me errors:

      Error: 1067: Implicit coercion of a value of type Array to an unrelated type flash.display:DisplayObject.

      I´ve tried setting includeInlayout to false and visible false for the repeater in viewstate advanced but that diden´t seem to work either.

      Bellow is my code please help.

      //////////////////////////////////////////
      // Code
      //////////////////////////////////////////

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" width="100%" height="100%" >
      <mx:states>
      <mx:State name="advanced">
      <mx:RemoveChild target="{panel1}"/>
      </mx:State>
      </mx:states>
      <mx:Script>
      <![CDATA[
      [Bindable]
      public var myArray:Array=[1,2,3,4];
      ]]>
      </mx:Script>
      <mx:Repeater id="myRep" dataProvider="{myArray}">
      <mx:Panel title="Repeater: emulating a for loop" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10" id="panel1">
      <mx:Label id="myLabel" text="This is loop #{myRep.currentIndex}"/>
      </mx:Panel>
      </mx:Repeater>
      </mx:Application>