Posts Tagged “viewstack”

Don’t ever try too hard to set a LinkBar’s selectedIndex. It is impossible unless you do following:

  • Customised the LinkBar control yourself
  • Use it with a ViewStack and set the selectedIndex with the ViewStack(but whatever for?!)
Bug Report here >>

Comments Comments

I keep getting this error when attempting to addChild to a component that is second container in a viewstack and at the same time selecting the selectedChild of the viewstack to the second component.

TypeError: Error #1009: Cannot access a property or method of a null object reference.

The problem

When we set the selectedChild of the viewstack, the children of the component selected will start to create the children. However, i wanted to add children display objects into one of the child display objects in the component. So the errror is thrown.

My quick solution is to play around with the creationEvents in Flex(Reference below). The idea is to call creationComplete once the display object to update has been created. And another function on the component to update the children again. I needed to remove the child display objects and then add new ones to it. Ok i might not be clear but i wonder who reads this.

The update function will then be called again. There will be an extra check:

if (this.[id of displayObject] == null ) { do nothing } else { update the display object }

Reference

  • http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=containers_intro_063_12.html

Comments Comments