PDA

View Full Version : popUp window component: close button funk??


trashman
03-22-2005, 08:22 AM
hey all-
i've been working with the popUpManager class to popup a window component. i can open a window with a frame action, and its close button will close the window. but if i use a button with an eventListener or put the popUp code on a button, i can't get it to close anymore. could anyone tell me why the following code would keep the window's close button from working??


buttonListener = new Object();
buttonListener.click = function(){
myWindow = mx.managers.PopUpManager.createPopUp(_root, mx.containers.Window, true, {closeButton:true, title:"cool popUp", contentPath: "image01.jpg"});
myWindow.setSize(240,132);
}

close = new Object();
close.click = function(){
myWindow.deletePopUp();
}

button.addEventListener("click", buttonListener);
myWindow.addEventListener("click", close);


all i have is this code on frame 1 of an 'actions' layer, a button component called "button" (also on frame 1) and a window component in the library.
i'm stumped! any thoughts?

cheers!
-j

tswaigand
03-22-2005, 10:56 PM
stop();

var buttonListener:Object = new Object();
buttonListener.click = function(evt:Object) {
myWindow = mx.managers.PopUpManager.createPopUp(_root, mx.containers.Window, true, {title:"cool popUp", contentPath:"image01.jpg", closeButton:true});
myWindow.setSize(240, 132);
var closeListener:Object = new Object();
closeListener.click = function(evt) {
evt.target.deletePopUp();
};
myWindow.addEventListener("click", closeListener);
};
button.addEventListener("click", buttonListener);

tswaigand
03-22-2005, 11:07 PM
Sorry for the dual post, but I hope the above code helps you. I set up a test file and it was working correctly for me (other than the image :-P). Good Luck!

Tammy

trashman
03-23-2005, 05:07 AM
hey, that looks like it will work. thanks tam!
-josh