PopupManager not firing "complete" event

PopupManager not firing “complete” event
The following code works in “test movie” mode.

But when I publish and view online it works about half the time.

My cancel button does not have a listener associated and the delete button is visible.

Does anyone see a problem with what I am doing?

var myWindow = mx.managers.PopUpManager.createPopUp(_root, mx.containers.Window, true);

var myWindowListener:Object = new Object();

myWindowListener.complete = function()
{
modalWindow = myWindow.content;
modalWindow.btnCancel.addEventListener(“click”, myWindowListener);
modalWindow.btn_Delete.visible=false;
}

myWindow.addEventListener(“complete”, myWindowListener);