Actionscript newb here.
Learning as I go but basically what I have are two windows. The “background window” displays content to the player and a “popup” window shows in front of it to explain the window currently displayed. I have close functions assigned to both windows to close their respective display objects, but what I really need is for the popup window to close when the background window closes.
I’ve been trying to figure this out for a few days now and I’m completely stumped. Any help would be tremendously appreciated!
Here’s the relevant code for the popup window that displays info on the background window:
package com.view.windows
import flash.display.Sprite;
import flash.events.MouseEvent;
import org.greensock.*;
import flash.display.DisplayObject;
import com.view.holders.WindowHolder;
public class Popup extends Sprite
{
private var _index:int = 0;
private var _msg:Array = [];
public static var close;
public function Popup()
{
this.x = 350;
this.y = 400;
this.visible = false;
TweenLite.to(this, 0, {alpha: 0});
close_btn.buttonMode = true;
close_btn.addEventListener(MouseEvent.CLICK, close, false, 0, true);
private function showPopup():void
{
this.visible = true;
TweenLite.to(this, 1, {alpha: 1});
}
public function close(e:MouseEvent):void
{
var close = this;
TweenLite.to(this, 0, {alpha: 0});
this.visible = false;
}
}
}
And here’s the code for the background window:
package com.view.holders
{
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.utils.Dictionary;
import org.greensock.*;
import com.view.windows.*;
public class WindowHolder extends Sprite
{
private var _windowOpen:Boolean = false;
private var _windows:Dictionary = new Dictionary(true);
private var _current:Sprite;
public function WindowHolder()
{
this.x = 490;
this.y = 304;
this.visible = false;
TweenLite.to(this, 0, {alpha: 0});
this.kill_mc.visible = false;
var n:int = this.numChildren;
for (var i:int = 2; i < n; i++)
}
private function showWindow():void
{
_current.visible = true;
this.visible = true;
TweenLite.to(this, .6, {alpha: 1});
}
private function closeWindow(e:MouseEvent = null):void
{
TweenLite.to(this, .6, {alpha: 0, onComplete:visToggle});
_current.visible = false;
_windowOpen = false;
close_mc.visible = false;
this.inventory_mc.visible = false;
}
private function visToggle():void
{
this.visible = false;
}
}
}
Important thing I forgot to mention is that I removed some of the code from the above files to hopefully cut back on reading. Only the relevant stuff (or what I believe to be) is posted.
I think what I need to do is include something within the “closeWindow” function within the WindowHolder class that relates to the popup class. I just don’t know how to do this.
Thank you!