I have an application that has a small 300x300 canvas, and I want to
show an Alert that is centered inside of that canvas.  I tried passing
a parent parameter to Alert.show() method but that did not work, so I
was able to get the below code to center the alert inside the Canvas,
but the problem is that when a user clicks OK on the Alert, I get a
null pointer exception sometimes.  Any ideas why i get the exception
somtimes, and how to get rid of it??

//app popup alert to parent container
var alertMsg:Alert = new Alert();
alertMsg.text = arrErrorMsgs.join("\n\n");
alertMsg.title = "Invalid Feedback Form";
alertMsg.owner = Application.application.cnvFeedback;
alertMsg.explicitMaxHeight = 300;
alertMsg.explicitMaxWidth = 300;
Application.application.cnvFeedback.addChild(alertMsg);

--------------------------------------------------------
EXCEPTION
---------------------------------------------------------
TypeError: Error #1009: Cannot access a property or method of a null
object reference.
        at
mx.managers::PopUpManagerImpl/findPopupInfoByOwner()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:657]
        at
mx.managers::PopUpManagerImpl/removePopUp()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:366]
        at
mx.managers::PopUpManager$/removePopUp()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\managers\PopUpManager.as:196]
        at
mx.controls.alertClasses::AlertForm/removeAlert()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\controls\alertClasses\AlertForm.as:502]
        at
mx.controls.alertClasses::AlertForm/clickHandler()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\controls\alertClasses\AlertForm.as:541]


Reply via email to