i have an air application that has a button when clicked opens a new spark.window component. in the window is a video player. the new secondWindow.open() method works fine. what i can’t seem to do is close the second window when the parent window closes.
i have this:
//parent window
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="733" minHeight="653" creationComplete="main()" currentState="loginForm" applicationDeactivate="windowedapplication1_applicationDeactivateHandler(event)">
//close second window
protected function windowedapplication1_applicationDeactivateHandler(event:Event):void{
NativeApplication.nativeApplication.openedWindows[0].close();
}
</s:WindowedApplication>
//second window
<s:Window name="secondWindow" xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="450" minHeight="323" windowComplete="init()">
//video player code is here
</s:Window>
Main application:
Child window (TestWindow.mxml):