actionscript error: Call to a possibly undefined method
those files are in the 开发者_开发技巧same folder:
my .as file package {public function YAAY():int{return(3);}; }
my main .fla trace(YAAY());
but the compiler says 1180: Call to a possibly undefined method YAAY.
I think I made an obvious mistake, but I can't figure out. Thanks
I think you forgot to correctly define your class inside the .as file. It should look like:
package {
public class YAAYClass {
public static function YAAY():int {
return 3;
}
}
}
Have it called this way:
trace(YAAYClass.YAAY());
1: I should have named my .as file "YAAY.as" because this is the externally visible function in the file. 2: I should have type in my main .fla file that "import YAAY" thats it, problem solved, no classes needed
精彩评论