It'll never work properly, AlertForm.removeAlert calls
PopupManager.removePopup()

On Tue, Dec 9, 2008 at 4:28 PM, Alex Harui <[EMAIL PROTECTED]> wrote:

>  Alert doesn't expect to be a child of a Canvas.  It has to be popped up.
> Post a test case of what didn't work.
>
>
>
> *From:* [email protected] [mailto:[EMAIL PROTECTED] *On
> Behalf Of *devenhariyani
> *Sent:* Monday, December 08, 2008 5:09 PM
> *To:* [email protected]
> *Subject:* [flexcoders] Getting Null exception when adding an Alert to a
> Canvas
>
>
>
> 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]
>
>  
>



-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

Like the cut of my jib? Check out my Flex blog!

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]
:: http://flex.joshmcdonald.info/
:: http://twitter.com/sophistifunk

Reply via email to