Skip to main content
October 14, 2015
Answered

How do i make a pop-up window without a button?

  • October 14, 2015
  • 1 reply
  • 580 views

Hi, I am creating a game where the player will move according to a dice roll and upon reaching the designated space, there will be a interactive pop-up that comes out immediately.

However i am unable to do it without a button to call the pop-up window. Is there anyway to make sure the pop-up is automatically called?

The window is a movie clip and not an URL.

This topic has been closed for replies.
Correct answer nezarov

In Flash player there's no pop-up window,  if you need something like that you have to create a java script pop-up function in your web page and call it in ActionScript..

In your case I think you don't need to do that just use some function to show and hide the window inside the swf file..

For example:

var window_mc:MovieClip = new MovieClip();

var textField:TextField = new TextField();

var textFormat:TextFormat = new TextFormat();

textFormat.font = "Arial";

textFormat.size = 15;

textFormat.color = 0x666666;

textField.text = "Your text here..";

textField.wordWrap = true;

textField.setTextFormat(textFormat);

textField.width = textField.textWidth +5;

textField.height = textField.textHeight +5;

window_mc.addChild(textField);

window_mc.x = 200;

window_mc.y = 100;

window_mc.visible = false;

addChild(window_mc);

Now the pop-up window is on the stage, you can use window_mc.visible = true; to show it whenever you want, and window_mc.visible = false; to hide it.

1 reply

Inspiring
October 14, 2015

if the window is a MovieClip then use addChild(window_mc); upon reaching the designated space..

October 15, 2015

but how do i add in what i want to pop up? How do i code it that it calls the window?

nezarovCorrect answer
Inspiring
October 15, 2015

In Flash player there's no pop-up window,  if you need something like that you have to create a java script pop-up function in your web page and call it in ActionScript..

In your case I think you don't need to do that just use some function to show and hide the window inside the swf file..

For example:

var window_mc:MovieClip = new MovieClip();

var textField:TextField = new TextField();

var textFormat:TextFormat = new TextFormat();

textFormat.font = "Arial";

textFormat.size = 15;

textFormat.color = 0x666666;

textField.text = "Your text here..";

textField.wordWrap = true;

textField.setTextFormat(textFormat);

textField.width = textField.textWidth +5;

textField.height = textField.textHeight +5;

window_mc.addChild(textField);

window_mc.x = 200;

window_mc.y = 100;

window_mc.visible = false;

addChild(window_mc);

Now the pop-up window is on the stage, you can use window_mc.visible = true; to show it whenever you want, and window_mc.visible = false; to hide it.