PDA

View Full Version : Window class & passing variables.


nytyme
10-05-2004, 08:33 PM
I'm using the Window component to load a SWF into popup window.


import mx.managers.PopUpManager;
import mx.containers.Window;
var myWin:MovieClip;
function initiateWindow(wWdw,wTitle,wPath,wHeight,wWidth,wX ,wY)
{
wWdw = PopUpManager.createPopUp(_root, Window, true, {closeButton:true, title: wTitle, _height: wHeight, _width: wWidth, _x: wX, _y: wY,contentPath:wPath});
var twListener:Object = new Object();
twListener.click = function(evt:Object){
evt.target.deletePopUp();
}
wWdw.addEventListener("click", twListener);
wWdw._root.myText.text = "hello";
wWdw._lockroot = true;
return wWdw;
}
// button code:
on(release)
{
aTW = initiateWindow(_root.myWin,"PopUp", _root.FLASHPATH + "DragDropTree.swf" ,450,600,100,0);
}


this is working, probably not the best setup though. However, I am trying to figure out how to pass variables to the loaded SWF. I tried making the button code this:
aTW = initiateWindow(_root.myWin,"PopUp", _root.FLASHPATH + "DragDropTree.swf?MYVAR=Hello" ,450,600,100,0);

but i am told it can't find "DragDropTree.swf?MYVAR=Hello"
without the querystring, it works.


can anyone help me out?

I'd really like to continue using createPopUp because of the X button and modal abilities.

nytyme
10-05-2004, 09:02 PM
twListener.complete = function()
{
//trace("trying to set a variable");
wWdw.content.MYVAR = SomeVar;
wWdw.content.InitializeMovie(); // intializes the movie again to reset everything to the non-defaults.
}

wWdw.addEventListener("click", twListener);
wWdw.addEventListener("complete", twListener);