Public Function Allegedly Doesn't Exist?

雨燕双飞 提交于 2019-12-04 05:16:24

问题


Okay, I am at the end of my rope.

I have a Flash Professional CS5.5, Adobe AIR, Actionscript 3 project. So far, I've never had this problem before...

I have a custom class called Prefs, that I wrote myself. This class has a number of functions. The ones I wrote a couple weeks ago, I can call in my code with no problem. But the ones in the SAME CLASS that I wrote today are throwing an error.

This one works:

public function UserFetch(ID:String):*
{

This one doesn't:

public function Set(setting:String, val:*):void
{

I call both the same way. In the document class "base":

package  {

    import flash.display.MovieClip;
    import trailcrest.prefs.prefs;

    public class base extends MovieClip {

        public static var Prefs:prefs = new prefs();
    }

}

In my timeline code.

base.Prefs.UserFetch("musictoggle");
base.Prefs.Set("musictoggle", true);

The first fires fine. The second gives this error:

Scene 1, Layer 'Layer 1', Frame 1, Line 4 1061: Call to a possibly undefined method Set through a reference with static type prefs.

What is going on? I can find absolutely no legitimate reason why this should be happening. Like I said, it has never happened before, and it not happening on any other class or function.


回答1:


After a bit of discussion in the chat, we found that flash was not picking up on the changes made in the prefs.as-file. Changing the name of the class fixed the issue (It may have been a weird compiler cache problem).



来源:https://stackoverflow.com/questions/9507999/public-function-allegedly-doesnt-exist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!