开发者

Issue getting viewState's selected child's id in flex 4

I'm transitioning 开发者_如何学JAVAa flex 3 application to flex 4. There was AS code in the flex 3 app that worked:

var myCurrentSelectedChild:String = myViewStack.selectedChild.id;

Now, in flash builder and flex 4.5, it throws the error - "-1119: Access of possibly undefined property id through a reference with static type mx.core:INavigatorContent". I'm trying to get the viewStack's selected child's id.


Try to cast the myViewStack.selectedChild to some UI Object type. core:INavigatorContent has no ID property.

So use:

(myViewStack.selectedChild as Container).id


The following links may be helpful:

  • 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;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜