3 Replies Latest reply on Jan 25, 2007 12:22 PM by ur_dtrain

    ActionScript not search element by id in the second Canvas in ViewStack.

    honza_ol42


      Hi all,

      i start with Flex2 and have this problem.
      ActionScript not search Label by id in the second Canvas in ViewStack.
      Application start with error TypeError: Error #1009: Cannot access a
      property or method of a null object reference.
      Id "labela" search OK, but "labelb" is for the function "invisible".
      What's wrong? My application:

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

      <mx:Script>
      <![CDATA[

      public function start():void
      {
      labela.text = "new text A";
      labelb.text = "new text B";
      }
      ]]>
      </mx:Script>

      <mx:TabBar height="30" width="200" id="tab_menu"
      dataProvider= "stack1" >
      </mx:TabBar>
      <mx:ViewStack x="0" y="40" width="250" height="100"
      borderStyle= "solid" id="stack1">
      <mx:Canvas label="aaa">
      <mx:Label width="200" id="labela" text="old text A"/>
      </mx:Canvas>
      <mx:Canvas label="bbb">
      <mx:Label width="200" id="labelb" text="old text B"/>
      </mx:Canvas>
      </mx:ViewStack>
      </mx:Application>

      Very thanks for help

      Honza