我查看了this,this,this和this等问题,但这些问题似乎都没有描述我的问题?
我宣布这些变量:
<fx:Script>
<![CDATA[
import assets.Page;
public var oneTwo:Page = new Page("...");
public var oneThree:Page = new Page("...");
protected var oneFour:Page = new Page("...");
protected var oneFive:Page = new Page("...");
protected var oneSix:Page = new Page("...");
...正在引用确实存在的对象,Flex可以使用这些项目的构造函数。接下来,我尝试设置这些对象的其他属性:
oneThree.next = oneFour;
oneThree.prev = oneTwo;
oneFour.next = oneFive;
oneFour.prev = oneThree;
oneFive.next = oneSix;
oneFive.prev = oneFour;
等。现在,当我单击其中的每一个时,Flex会在每个实例中突出显示变量,并在编码期间将所有变量识别为有效。但汇编给出了:
-1120: Access of undefined property oneThree.
-1120: Access of undefined property oneFour.
-1120: Access of undefined property oneFour.
-1120: Access of undefined property oneFive.
等等,每次使用一个变量(在这种情况下为十二次)。你可以看到我做了一些公开和一些保护,这似乎没有什么区别。
答案 0 :(得分:0)
[这] [1]问题引导我解决问题。
第二个代码块中的变量需要在自己的函数中编辑,得到:
<fx:Script>
<![CDATA[
import assets.Page;
public var oneTwo:Page = new Page("...");
public var oneThree:Page = new Page("...");
protected var oneFour:Page = new Page("...");
protected var oneFive:Page = new Page("...");
protected var oneSix:Page = new Page("...");
oneThree.next = oneFour;
oneThree.prev = oneTwo;
oneFour.next = oneFive;
oneFour.prev = oneThree;
oneFive.next = oneSix;
oneFive.prev = oneFour;
]]>
</fx:Script>
而不是:
<fx:Script>
<![CDATA[
import assets.Page;
public var oneTwo:Page = new Page("...");
public var oneThree:Page = new Page("...");
protected var oneFour:Page = new Page("...");
protected var oneFive:Page = new Page("...");
protected var oneSix:Page = new Page("...");
protected function _init():void
{
oneThree.next = oneFour;
oneThree.prev = oneTwo;
oneFour.next = oneFive;
oneFour.prev = oneThree;
oneFive.next = oneSix;
oneFive.prev = oneFour;
}
]]>
</fx:Script>
为我处理错误。希望这有助于其他人!!