我有一个继承自 NetConnection 的类,具有以下功能:
override public function connect(command:String, ... arguments):void
{
addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
super.connect(command, arguments);
}
我想要做的实际上是这样的:
override public function connect(command:String, ... arguments):void
{
m_iTries = 0;
m_strCommand = command;
m_arguments = arguments;
addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
super.connect(command, arguments);
}
private function onNetStatus(pEvent:NetStatusEvent):void
{
if (/* some logic involving the code and the value of m_iTries */)
{
super.connect(m_strCommand, m_arguments);
}
else
{
// do something different
}
}
这在 AS3 中可能吗?如果是这样,怎么做?我将如何声明变量、设置变量、将其传递给函数等?谢谢!