0 Replies Latest reply on Sep 13, 2007 7:40 AM by dwwangrui

    Using ActionScript namespace

    dwwangrui
      I try to reference my own defined namepace in MXML , but runtime report error:ReferenceError: Error #1065 , myNamespace::myVar is not defined .I am very confusing for it .

      below is my source code

      myNamespace.as
      package
      {
      public namespace myNamespace;
      }

      MyClass.as
      package
      {
      public class MyClass{
      myNamespace var myVar:String = "test";

      myNamespace function wr():void{

      }
      }
      }

      Test.mxml
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" initialize="initializeHandler()">
      <mx:Script>
      <![CDATA[
      use namespace myNamespace;

      private function initializeHandler():void{
      myLabel.text = myNamespace::myVar;
      }
      ]]>
      </mx:Script>
      <mx:Label id="myLabel" />
      </mx:Application>

      Thanks for u response.