1 Reply Latest reply on May 1, 2011 10:49 PM by Shongrunden

    MobileApplication.myVar doesn't work

    pol2095 Level 1

      Hello,

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:MobileApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark" firstView="My_firstView">
      <fx:Script>
              <![CDATA[
                  public var myVar:String="test";
              ]]>

          </fx:Script>
      <fx:Declarations>
      <!-- Place non-visual elements (e.g., services, value objects) here -->
      </fx:Declarations>
      </s:MobileApplication>

      <?xml version="1.0" encoding="utf-8"?>
      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" title="Test" initialize="comp(event)">
          <fx:Script>
              <![CDATA[
          public function comp(e:Event):void {
              are.text=MobileApplication.myVar;
          }
          ]]>
          </fx:Script>
          <s:TextArea width="400" id="are"/>
      </s:View>

       

      MobileApplication.myVar doesn't work.

      How  to access myVar in a view ?

       

      Thanks.