Help making a MovieClip to be a popup
Hi guys
I have a a scene in the stage as the background with a text saying to press anywhere...
When someone clicks on it, a MC will appear asking something...
My question is... how can I make this MC to be a pop up instead of being on the stage?
This is what I have, so far:
private var initialScreen:Loader;
private var pos:TextField;
private var pos_holder:Sprite;
private var fmat:TextFormat;
..............................................
initialScreen = new Loader();
initialScreen.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
initialScreen.load(new URLRequest("1.jpg"));
fmat = new TextFormat();
fmat.font = "Times New Roman";
fmat.size = 105;
fmat.color = "0x0000FF";
pos = new TextField();
pos.defaultTextFormat = fmat;
pos.autoSize = TextFieldAutoSize.CENTER;
pos.text = "Click anywhere";
pos_holder = new Sprite();
pos_holder.addChild(pos);
private function onComplete(e:Event):void {
initialScreen.width = stage.stageWidth;
initialScreen.height = (stage.stageHeight * 1.5);
initialScreen.x = 0;
initialScreen.y = ((stage.stageHeight/2) - stage.stageHeight);
addChild(initialScreen);
pos_holder.width = stage.stageWidth * 0.8; // 80% width relative to stage
pos_holder.scaleY = titulo_holder.scaleX; // To keep aspectratio
pos_holder.x = stage.stageWidth / 2.2;
pos_holder.y = (stage.stageHeight * 0.2);
stage.addChild(titulo_holder);
initialScreen.addEventListener(MouseEvent.CLICK, popup);
}
private function popup (e:MouseEvent):void {
var question1:MovieClip = new MovieClip();
question1.graphics.beginFill(0xFF0000);
question1.graphics.drawRect(0, 0, 100, 80);
question1.graphics.endFill();
question1.x = (stage.stageWidth * 0.40);
question1.y = (stage.stageHeight * 0.70);
addChild(question1);
}
**** I haven´t finish making the MC yet, since it will have a couple of buttons and a text... but I need it to be like a popup and now it just appears on the background
Thanks!!!
