PDA

View Full Version : Window Component _parental issues


bmckenzie
01-04-2005, 04:25 AM
I'm trying to play a movieclip in a Flash MX2004 Window Component window.:
Could someone help me sort out how to scope this script so it works 'globally'?

_global.makeWin = function(){
trace("making window");
import mx.managers.PopUpManager;
import mx.containers.Window;
var win = PopUpManager.createPopUp(_root, Window, true, {closeButton:true});
trace(win);
}

If I run this from a button in a movieClip, I get a new window, plus the following messages:
making window
_level0.depthChild0

However, when I load the swf containing the button into another movie, clicking the button produces NO window, as evidenced by these messages:
making window
null

I can't find "depthChild" in the documentation, tho I guess it has to do with the first param in the createPopUp function. I have tried setting that param to _root, _parent, this, and _level0, all with the same result.

Baffledly,

Bruce

madgett
01-08-2005, 04:13 AM
You are using _root as the place to load the popupwindow. When you load the external movie into a new one _root changes. You need to set the movieclip's lockroot containing the button to true so that when you refer to _root it knows you mean the root of that movieclip.

Just put:

this._lockroot = true;

That works for me.