I'm doing a flex program, but i'm having some trouble when calling a pop up from my module. These are the codes:
The function that calls the popUp.
[Bindable] private var popUp : newMemberPopUp;
private function btnNewClickHandler(event:MouseEvent):void {
popUp = newMemberPopUp(PopUpManager.createPopUp(this, newMemberPopUp, true));
}
The popUp mxml
<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="350" height="250"
title="Dados Cadastrais">
<fx:Declarations>
</fx:Declarations>
<s:VGroup width="100%">
<mx:Form width="100%">
<mx:FormItem label="Nome">
<mx:TextInput id="nameTextInput"/>
</mx:FormItem>
<mx:FormItem label="Telefone">
<mx:TextInput id="phoneTextInput"/>
</mx:FormItem>
<mx:FormItem label="Email">
<mx:TextInput id="emailTextInput"/>
</mx:FormItem>
<mx:FormItem label="Data de Nascimento">
<mx:DateField/>
</mx:FormItem>
<mx:FormItem label="Data de Cadastro">
<mx:DateField/>
</mx:FormItem>
</mx:Form>
<s:HGroup paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
<s:Button label="Gravar"/>
<s:Button label="Cancelar"/>
</s:HGroup>
</s:VGroup>
</s:TitleWindow>
The error i'm getting is this one:
TypeError: Error #1009: Cannot access a property or method of a null object reference. at mx.managers::PopUpManagerImpl/http://www.adobe.com/2006/flex/mx/internal::createModalWindow()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:682] at mx.managers::PopUpManagerImpl/addPopUp()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:397] at mx.managers::PopUpManagerImpl/createPopUp()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:236] at mx.managers::PopUpManager$/createPopUp()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\PopUpManager.as:139] at view::Members/btnNewClickHandler()[E:\MyFlexWorkspace\CTCA\src\model\Members.as:29] at view::Members/__btnNew_click()[E:\MyFlexWorkspace\CTCA\src\view\Members.mxml:39]
If i call the pop up from the application it works fine, but if i call it from the module i have this error.