I have created a custom component. It's been created (the
"I'm complete." trace has appeared), and I'm trying to set some
values in it by calling the my method setInventoryItem(item). At
this point I get a "cannot access a property or method of a null
object reference" error. Using the debugger, sure enough, both
itemName and longDescription are null.
No, it is not a bug, it is a feature. Viewstack and the other
navigation containers use deferred instantiation by default. As
such, the child components of a view are not instantiated until a
user actually navigates to thet view.
The solution is to "pull" the data into the component, using
binding or you own event mechanism, or on the creationComplete and
show events of the child container.