0
votes

I'm trying to update a small Flex AS3 "project" consisting of one main file and an imported AS3 class. Unfortunately during compile I get the error 1120:Access of undefined property DEBUG. and the compilation fails. I've used mxmlc from Flex SDK 4.6 and Flash Builder 4.5 and get the same failure.

Flex isn't my strong suit so I hope someone can point out the error. From what I understand this source code compiled fine in 2011 using mxmlc.

Relevant code from the imported file:

package {
public class krpano_as3_interface   {
    public static var instance:krpano_as3_interface = null;
    .
    .
    static public const STARTDEBUGMODE : int = 0xFF;
    static public const DEBUG          : int = 0;       

And From the main AS3 file:

package {
.
import krpano_as3_interface;
public class soundinterface extends Sprite {
    static public var krpano : krpano_as3_interface = null;
    .
    public function soundinterface() {
        if (stage == null){
        }else{
            txt.htmlText =  "krpano " + DEBUG::version + "\n\n" +
                            "<b>soundinterface plugin</b>" +
                            "\n\n(build " + DEBUG::builddate + ")";
        }
    }

If I rename or move the imported file the compiler complains that it is missing. The class where the constant DEBUG is defined should be being imported so why isn't it working?

1

1 Answers

0
votes

The class where the constant DEBUG is defined should be being imported so why isn't it working?

Because they have nothing to do with each other.

DEBUG::version

and

static public const DEBUG          : int = 0;

Are two unrelated parts of your code.

There are two hints in the syntax:

  1. the :: name qualifier operator stands after a namespace, so whatever DEBUG is, it is a namespace, which the public static const is not (it's an int)
  2. A property version is accessed. The public static const does not have such a property.

What you are looking at is conditional compilation, which (among other things) allows you to specify values and pass them to the compiler to perform the compilation process.

You can also pass Strings and Numbers to the application and use them as inline constants

In your case, you want to define a version constant in the compiler arguments. Something like this:

-define+=DEBUG::version,"5"

This is probably because the version number is maintained by some build script (make, ant, whatever) and therefore passes this information to the compiler.

I highly recommend that you get in contact with the developer who worked on this project before to understand how the build process of this project is supposed to work.