1 Reply Latest reply on Feb 1, 2008 9:18 AM by Ratsnackbar

    double quotes to single quotes

    gerraIrkutsk-vtxlyW Level 1
      If I call state by click="currentState='myState'" then it works well but if I get name of state from ArrayCollection then it isn't work:

      <mx:ArrayCollection id="myAC">
      <mx:Object label="Описание" click="myState"/>
      <mx:Object label="Образцы" click="myState_white"/>
      </mx:ArrayCollection>
      <mx:VBox width="100%" height="100%">
      <mx:Repeater id="myRep" dataProvider="{myAC}" startingIndex="0">
      <mx:LinkButton label="{myRep.currentItem.label}" click="currentState=(myRep.currentItem.click)"/>
      <mx:Label text="{myRep.currentItem.click}"/>
      </mx:Repeater>
      </mx:VBox>

      I think it happens because of I get name of state from ArrayCollection as a string with double quotes: "myState"; "myState_white" and I must get it with single quotes: 'myState'; 'myState_white'. Is it true? And how I can do it?
        • 1. Re: double quotes to single quotes
          Ratsnackbar Level 2
          Try something like this:

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">

          <mx:Script>
          <![CDATA[

          import mx.collections.ArrayCollection;

          private var myStates:Array = new Array("myState", "myState_white");
          private var myAC:ArrayCollection = new ArrayCollection(myStates);

          private function doStateChange(event:MouseEvent):void{
          var myItem:String = String(event.currentTarget.getRepeaterItem());
          this.myLabel.text = "You Selected: "+myItem;
          }

          ]]>
          </mx:Script>

          <mx:VBox width="100%" height="100%">
          <mx:Repeater id="myRep" dataProvider="{this.myAC}" startingIndex="0">
          <mx:LinkButton id="myLinkButton" label="{myRep.currentItem.toString()}" click="doStateChange(event)" />
          </mx:Repeater>

          <mx:Label id="myLabel" />
          </mx:VBox>

          </mx:Application>