Acessing root stage.stageWidth
Hi,
So I'm trying to do a simple graph with rollover definitions. I have the graph on one layer in the root along with the definitions. On a hit testing MC I have the following:
var defbox:info = new info();
var mcName = this.name;
var xPos = (MovieClip(parent).stage.stageWidth)/2;
var yPos = (MovieClip(parent).stage.stageHeight)/2;
this.addEventListener(MouseEvent.MOUSE_OVER, mouse_over);
function mouse_over(event:MouseEvent):void {
this.removeEventListener(MouseEvent.MOUSE_OVER, mouse_over);
this.addEventListener(MouseEvent.MOUSE_OUT, mouse_out);
this.addChild(defbox);
defbox.x = xPos-350;
defbox.y = yPos-350;
defbox.alpha = .95;
defbox.title.title.text = MovieClip(parent).titles[mcName];
defbox.def.text = MovieClip(parent).definitions[mcName];
defbox.def.autoSize = "center";
defbox.body.height = defbox.def.height + 25;
defbox.title.y = defbox.body.y -8;
}
function mouse_out(event:MouseEvent):void {
this.addEventListener(MouseEvent.MOUSE_OVER, mouse_over);
this.removeEventListener(MouseEvent.MOUSE_OUT, mouse_out);
this.removeChild(defbox);
}
The problem is that the loaded MC namely, defbox is does not appear at stage.width/2 (or height). It appears to be loading somewhere relative to the hit tester (the mc where the defbox mc is being loaded). I can't seem to access the root stage. I'm pretty sure that all the MCs registry points are normal. Any suggestions? Thanks.