In my main application I have a viewstack with 3 child views. In the viewstack change handler, I programmatically change the selectedchild property.
I understand that the initialize method for the view is not called every time I change the selectedChild Property. So I tried to invoke the init method programmatically too..
view1.mxml
<fx:Script>
<![CDATA[
public function init():void{
//something
}
]]>
</fx:Script>
main.mxml
viewStack.selectedChild = viewStack.getChildByName("viewname") as NavigatorContent;
var v1:view1 = new view1();
v1.init();
But I get a null pointer error. Am I missing anything? Any help would be appreciated. I am a beginner here.