2 Replies Latest reply on Dec 12, 2008 6:38 AM by Newsgroup_User

    Why my function can not get proper varaible value

    crystalChen
      Hi.
      I write a MXML file like this.
      <?xml version="1.0" encoding="utf-8"?>
      <mx:WindowedApplication xmlns:mx=" http://www.adobe.com/2006/mxml" invoke="setint()"
      creationComplete="getint()">

      <mx:Script>
      <![CDATA[
      import mx.utils.StringUtil;
      import mx.controls.Alert;

      public var number:int = 100;
      private function setint():void{
      number = 200;
      Alert.show("" + number);
      }

      private function getint():void{
      Alert.show("" + number);
      }
      ]]>
      </mx:Script>

      </mx:WindowedApplication>

      I define a varaible in ActionScrip. one function is to set its value, another is to get its value. why function getint() always get value 100. this varaible can not be set. the two function are trigger in invoke event and creationComplete.