views:

88

answers:

1

I am trying to place API variables on ONE class file or mxml file and call these variables in other random class or mxml files... any suggestions?

+2  A: 

I just create a file in any package and called it api.as. Inside there, there's just static member variables.

public static var foo:String = "Bar";
public static var bar:Number = "100";

...

Then you just include import <package_path>.api.as in any files that want to use it.

EDIT: Already accepted, but answering the question:

package com.foo    {
    public class Api {
        public static const FOOBAR:String = "foobar";
    }
}
Glenn
i have tried this but i get the bellow error.<code>1012: The static attribute may be used only on definitions inside a class.</code>
medoix
@medoix: yes, you need to place the variables in a class. just call it Config, or so.
back2dos