操作脚本 3 - 在 flex 4 中获取视图状态的选定子项 ID 时出现问题



我正在将flex 3应用程序转换为flex 4。flex 3应用程序中有可用的AS代码:

var myCurrentSelectedChild:String = myViewStack.selectedChild.id;

现在,在flash生成器和flex 4.5中,它抛出错误-"-1119:通过静态类型mx.core:INavigatorContent的引用访问可能未定义的属性id"

尝试将myViewStack.selectedChild强制转换为某些UI对象类型。core:INavigatorContent没有ID属性。

所以使用:

(myViewStack.selectedChild as Container).id

以下链接可能会有所帮助:

  • http://jksnu.blogspot.com/2011/06/view-state-difference-between-flex3-and.html
  • http://jksnu.blogspot.com/2011/06/view-state-difference-between-flex3-and_24.html
var myCurrentSelectedChild:String = myViewStack.selectedChild.getChildAt(0).id;

最新更新