Navigate to a new view upon click using flex
friends. I'm developing a flex mobile app. I've declared a Titlewindow which contains the alert message following the example of "TourdeFlex". And I failed to navigate to a new View after clicking YES button.
<fx:Script>
<![CDATA[
protected function some_handler():开发者_JAVA技巧void
{
(new AlertMsg()).open(this,false);
}
]]>
</fx:Script>
<fx:Declarations>
<fx:Component className="AlertMsg">
<s:SkinnablePopUpContainer x="70" y="300">
<s:TitleWindow title="MSG" close="close()">
<s:VGroup horizontalAlign="center" paddingTop="8" paddingBottom="8" paddingLeft="8" paddingRight="8" gap="5" width="100%">
<s:Label text="Some Alert MSG"/>
<s:HGroup>
<s:Button label="YES" click="{outerDocument.navigator.pushView(myNewView)}"/>
<s:Button label="No" click="close()"/>
</s:HGroup>
</s:VGroup>
</s:TitleWindow>
</s:SkinnablePopUpContainer>
</fx:Component>
</fx:Declarations>
This code can be successfully compiled but it was wrong during runtime:Error #1009: Cannot access a property or method of a null object reference. How can I handle this kind of problem.
outerDocument
is null. Try owner
:
click="(owner as spark.components.View).navigator.pushView(myNewView)"
精彩评论