0 Replies Latest reply: Mar 1, 2008 5:50 PM by sneakyimp RSS

    namespace, static method questions

    sneakyimp Community Member
      The really useful script here is Sephiroth's Actionscript 3 PHP Unserializer. I have used the old AS2 version many times and it's totally rad. With it you can create really complex data objects in php, serialize() them, and then unserialize them with this code in Flash. It dramatically reduces the amount of code you have to write to share complex data between PHP and Flash.

      The problem I'm having is that the new Actionscript 3 version was apparently written for Flex. When I try to use it in flash, I get an error: 1004: Namespace was not found or is not a compile-time constant.. This error refers to this line of code:
      use namespace mx_internal;
      I know next to nothing about namespaces in Flash, but best I can tell, that namespace constant is apparently to be found in mx.core.

      At any rate, if I remove all references to mx_internal namespace and mx.core, I can get the script working. This brings me to my first questions:
      QUESTION 1: What does the use of that namespace stuff accomplish?
      QUESTION 2: Am I likely to suffer any unpredictable consequences by removing that namespace stuff?

      Also, I get an error (1061: Call to a possibly undefined method serialize through a reference with static type org.sepy.io:Serializer.) when I try to call the static methods of the Serialize class by instantiating it and calling the methods via the instance like this:
      var oSerializer:Serializer = new Serializer();
      var str = oSerializer.serialize(obj);

      That's my third question:
      QUESTION 3: Is it impossible to call a static method of a class from an instance of the class? Do we have to reference the class name instead?

      Any help would be much appreciated