Access of undefined method/property through reference with a static type Class
I get the following error: (it's not word for word but you get the idea)
Error: Access of undefined method getStatus through reference with a static type Class.
Here's what's happening in the code. I'm trying to create a User class that is instantiated at the start of my app. I want the User class to have properties like mainStatus, with helper methods like setStatus etc. Pretty simple.
so on my HardDisk I have my flash_working folder with all my flash projects. I created my class file/package under the directory com.mypackage
----------------------------------------------------------
package com.mypackage
{
import flash.display.*;
public class User extends Sprite
{
public var mainStatus:int;
public function User()
{
trace("User Created!");
mainStatus = 0;
}
public function setStatus(status:int):void
{
mainStatus = status;
}
public function getStatus():int
{
return mainStatus;
}
}
}
--------------------------------------------------------
Ok, so far so good.
now I created a new .fla file under the root of /flash_working/. The class file is in /com/mypackage/User.as
in my .fla file I have:
-------------------------------------
import com.mypackage.User;
var myUser:User = new User();
var i = User.getStatus();
trace(i);
-------------------------------------
That's all the code I have. Could someone please explain why it's giving me that error?
If I try to access the public var mainStatus through user.mainStatus that gives a similar error saying:
Error: Access of undefined property mainStatus through reference with a static type Class.
Thanks for any help!
jef3189