开发者

Adobe Flex Builder 3 : Cannot add any method/function to any class of an existing project?

I'm totally new to Adobe Flex Builder 3. I've been assigned a fully functional project but when I want to add the simplest function to any class, I always got the same error :

Call to a possibly undefined method through a reference with static type

For example, in some random class there is a function defined like this :

public function GetID() :String     { return m_strID; }

If I try to define a new one like below :

public function GetIDFoo() :String      { return m_strID; }

And then I try to call both of them like this :

trace ("This line is ok : " + oPhysicalScreen.GetID());
trace ("This line gives me an error : " + oPhysicalScreen.GetIDFoo());

Any clue?

Regards, Michel

PS: full code where I do the call :

public function UpdatePhysicalScreenData(oScreenNode:XML):void 
{
    if (m_vPhysicalScreens == null)
    {
        return;
    }

    var oScreenList:CMultyList = m_rBasicScreen.GetPhysicalScreensPanel().GetScreenList();

    var oPhysicalScreen:CPhysicalScreen = FindPhysicalScreen(oScreenNode.@id);

    if (oPhysicalScreen == null)
    {
        oPhysicalScreen = new CPhysicalScreen();
        {
            oPhysicalScreen.Initialize(oScreenNode.@id);
            oPhysicalScreen.SetInfo(oScreenNode.@info);

            var eList:uint = oScreenNode.@list;

            if (eList < SCREENS_LIST_TITLES.length)
            {
                oScreenList.SelectCurrentList(eList);
            }
            else
            {
                oScreenList.SelectCurrentList(2);//Test
            }
            var oNewEntry:CEntry = oScreenList.CreateEntryInCurrentList(oPhysicalScreen.GetID() + " " + oPhysicalScreen.GetInfo(), oPhysicalScreen);
            //var oNewEntry:CEntry = oScreenList.CreateEntryInCurrentList(oPhysicalScreen.GetDisplayName(), oPhysicalScreen);

            oNewEntry.ChangeTextColor(CPanelPhysicalScreens.STATE_COLORS[oPhysicalScreen.GetState()]);
        }

        m_vPhysicalScreens.AddAtEnd(oPhysicalScreen);
    } 

    if (oPhysicalScreen != null)
    {
        //should never be null but ...
        trace ("UpdatePhysicalScreenData : " + oPhysicalScreen.GetID() + " " + oPhysicalScreen.GetInfo() + " State : "+ oPhysicalScreen.GetState());
        trace ("UpdatePhysicalScreenData : " + oPhysicalScreen.GetIDFoo() + " " + oPhysicalScreen.GetInfo() + " State : "+ oPhysicalScreen.GetState());
    }
    oPhysicalScreen.SetDiffusionCode(oScreenNode.@diffusionCode);
    oPhysical开发者_运维知识库Screen.SetCurrentSequence((int)(oScreenNode.@currentSequence));
    oPhysicalScreen.SetIsAlive(oScreenNode.@alive == "true");
}

Start of class definition :

public class CPhysicalScreen
{
public static var STATE_UNUSED          :uint = 0;
public static var STATE_SYNC            :uint = 1;
public static var STATE_UNSYNC          :uint = 2;
public static var STATE_KO              :uint = 3;

public static var STATE_MAX_WAIT_TIME   :uint = 5000;


private var m_strID             :String;
private var m_eState            :uint;
private var m_strInfo           :String;
private var m_strDiffusionCode  :String;
private var m_uiCurrentSequence :int;
private var m_bIsAlive          :Boolean;


public function CPhysicalScreen()
{
    super();

    m_strID             = null;
    m_eState            = STATE_UNUSED;
    m_strInfo           = "";
    m_strDiffusionCode  = "";
    m_uiCurrentSequence = 0;
    m_bIsAlive          = false;
}


public function GetID()                             :String     { return m_strID; }
public function GetIDFoo()                              :String     { return m_strID; }

...


The class CPhysicalScreen that you posted does not contain a closing }
Also you may have to wrap it in a package.


I've found the solution, thanks to @jeremy.mooer and @frankhermes :-)

In project properties : ActionScript Build Path : Library path tab.

There were existing project librairies.

A "lib" folder with some swc files in it. Theses swc come from another project wich is needed.

I added a new project (Add project button), then I selected wich project were building needed swc files.

Now when I make changes in these other projects, they are made available to my main project.

I think these got unlinked when the project was given to me...

Thanks to people who helped :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜