-
Ok, here is a revised version of the script for 2 buttons.
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);
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.
-
Hi,
I got 2 btns named- 'btn', 'btn2'. Wrote this new code on the actions layer. Wow, grt. this is exactly what i wanted. thanks a zillion :)
but, when i uploaded it on:
http://www.cndmotorhomes.com/1Aug/1aug.swf
the same problem appeared. the close btn going to the left. Maybe a preloader is needed. I don't know how to do this. Pls help.
-
i have searched a lot. But couldn't figure how to put a preloader in the window component. I would like to remind that my window is generated thru actionscript. the content for the popup is coming thru as and xml at the click of a radio/chk. so pls help me keeping that in mind. :)
-
You need to preload the images before or just at the time the movie is loaded. You can try this.
http://www.flashscript.biz/component...preloader.html
It works also without a button. Just put the component somewhere in a corner, name it, fill out the chart in the property inspector and set alpha to 0. Then you don't even see the preloading.
-
thanks so much. I'll try it and let u know if i meet any problem :)