So I’m trying to learn to create a public class, and this is what is in my class file:
class com.RCN.Menu.Menu{
public var title:String;
public var menuItems:Array;
public function createMenu(title:String, menuItems:Array) {
return title;
}
function createTitleBar(title:String):Void {
}
}
and in a seperate SWF I use the code:
import com.RCN.Menu.Menu;
var Accountability:Menu = createMenu("hello",[a,b,c,d]);
trace(Accountability);
yet Accountability traces as undefined, can anyone tell my why this is?
You have to use the new keyword to make an instance of your class.
Try this:
And then to create your instance:
Cheers