Ok, here is a revised version of the script for 2 buttons.
When the movie loads you create a window but make it invisible. Then you can press any button to load another image and it will be resized. You can place the window wherever you want. The closebutton only makes it invisible. So the window is always present.PHP Code:import mx.utils.Delegate;
myTW = mx.managers.PopUpManager.createPopUp (_root, mx.containers.Window, false, {closeButton:true, title:"This is the title", _x:270, _y:40, color:16711680, contentPath:"images/a1.jpg"});
myTW.visible = false;
sizerPop = new Object ();
sizerPop.handleEvent = function (img)
{
if (img.type == "complete")
{
myTW.setSize (myTW.content._width, myTW.content._height + 25);
}
};
myTW.addEventListener ("complete", sizerPop);
but.onPress = function ()
{
myTW.visible = true;
myTW.contentPath = "images/a1.jpg";
};
but2.onPress = function ()
{
myTW.visible = true;
myTW.contentPath = "images/BMW_milk_ad.jpg";
};
var closeWindow:Object = new Object ();
closeWindow.click = Delegate.create (this, cw);
function cw (evt)
{
evt.target.visible = false;
}
myTW.addEventListener ("click", closeWindow);




Reply With Quote