4 Replies Latest reply on Aug 9, 2010 4:36 AM by Abhin S

    Could not resolve <s:states> to a component implementation.

    Abhin S

      i am getting this error.

      kindly help..

      following is my code:

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application

      xmlns:fx="http://ns.adobe.com/mxml/2009"

          xmlns:s="library://ns.adobe.com/flex/spark"

          xmlns:mx="library://ns.adobe.com/flex/mx" 

        creationComplete="init();">

       

       

       

        <fx:Script>

          <![CDATA[

            import mx.controls.Alert; 

            import mx.core.Container;

       

            private function init():void{

              checkChildren(this);

            }

       

            private function checkChildren(objToCheck:Object):void{

                      for each(var obj:Object in objToCheck.getChildren()){

                if(obj is Container){

                  mx.controls.Alert.show("Container:" + obj.toString());

                  checkChildren(obj);

                }else{

                  mx.controls.Alert.show("Not container:" + obj.toString());

                }

                      }

            }

            import spark.events.IndexChangeEvent;

       

              public function myLabelFunc(item:Object):String {

                   return item.firstName + " " + item.lastName;

              }

       

              public function myLabelToItemFunc(value:String):Object {

                   var tempObj:Object = new Object();

                   var spaceChar:int = value.indexOf(' ');

                   tempObj.firstName = value.substr(0, spaceChar);

                   tempObj.lastName = value.substr(spaceChar+1, value.length);

                   return tempObj;

                  }

       

              protected function myCB_changeHandler(event:IndexChangeEvent):void

                  {

       

                       if(myCB.selectedIndex == spark.components.ComboBox.CUSTOM_SELECTED_ITEM)

       

                           myCB.dataProvider.addItem(myCB.selectedItem);

                  }

       

       

       

       

       

       

          ]]>

        </fx:Script>

       

       

       

       

       

       

          <s:states >

          <s:State name="si"/>

          <s:State name="re"/>

          </s:states>

       

      <s:BorderContainer borderColor="#0b85b7"

          cornerRadius="8"

          borderWeight="4">

      <mx:VBox top="10" horizontalAlign="center" >

      <s:ComboBox id="myCB"

                  includeIn="si"

       

                  labelFunction="myLabelFunc"

      labelToItemFunction="myLabelToItemFunc"

      change="myCB_changeHandler(event);">

                 <s:dataProvider>

                 <mx:ArrayCollection>

                  <fx:Object firstName="Abhinav" lastName="Somal"/>

                  <fx:Object firstName="Adit" lastName="Kumar"/>

                  </mx:ArrayCollection>

                </s:dataProvider> 

              </s:ComboBox>

       

       

              <s:TextInput id="t1"

       

                  includeIn="re"           

                  />

       

                <mx:LinkButton label="show text box"

                      click="currentState = 're'" includeIn="si"/>

                <mx:LinkButton label="show combobox"

                      click="currentState = 'si'"

                      includeIn="re"/>   

       

       

       

              <s:TextArea id="t2"

              text="The selected item is: {myCB.selectedItem.firstName + ' '

              + myCB.selectedItem.lastName};"/> 

       

      <mx:Button id="b1" label="SEND"  >

      </mx:Button>

        

      </mx:VBox>

       

      </s:BorderContainer>

        

       

      </mx:Application>

       

      thnks.