我是Adobe Flex Builder 3的新手。 我已经被分配了一个功能齐全的项目但是当我想将最简单的函数添加到任何类时,我总是得到同样的错误:
通过静态类型
的引用调用可能未定义的方法
例如,在某些随机类中有一个定义如下的函数:
public function GetID() :String { return m_strID; }
如果我尝试定义一个新的,如下所示:
public function GetIDFoo() :String { return m_strID; }
然后我试着像这样打电话给他们两个人:
trace ("This line is ok : " + oPhysicalScreen.GetID());
trace ("This line gives me an error : " + oPhysicalScreen.GetIDFoo());
有任何线索吗?
此致 米歇尔
PS:我打电话的完整代码:
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);
oPhysicalScreen.SetCurrentSequence((int)(oScreenNode.@currentSequence));
oPhysicalScreen.SetIsAlive(oScreenNode.@alive == "true");
}
课程定义的开始:
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; }
...
答案 0 :(得分:0)
您发布的CPhysicalScreen类不包含结束}
此外,您可能需要将其包装在一个包中。
答案 1 :(得分:0)
我找到了解决方案,感谢@ jeremy.mooer和@frankhermes: - )
在项目属性中:ActionScript构建路径:库路径选项卡。
现有项目图书馆。
包含一些swc文件的“lib”文件夹。这些swc来自另一个需要的项目。
我添加了一个新项目(添加项目按钮),然后我选择了哪个项目正在构建所需的swc文件。
现在,当我在这些其他项目中进行更改时,它们可供我的主项目使用。
我认为当项目交给我时,这些都没有关联......
感谢帮助过的人: - )