Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Desktop, Mobile and non-browser Environments > AIR (Apollo)

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-01-2008, 04:20 PM   #1
seanlail
Member
 
Join Date: Apr 2006
Location: London
Posts: 69
Default Window placement (AIR application in Flex)

I'm creating an AIR application in Flex 3 and am having a few issues getting it to start in the bottom right corner of my screen and remember where it's been.

The X and Y coordinates are being reset all the time for some reason and I can't find out where.

This is my main application MXML:

ActionScript Code:
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication  xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute"     showFlexChrome="false" width="{mainW}" height="{mainH}" alpha="1" applicationComplete="{init()}">     <mx:Script>         <![CDATA[             import flash.utils.Timer;             import flash.events.TimerEvent;             import flash.display.Screen;                         [Bindable] private var mainW:Number = 200;             [Bindable] private var mainH:Number = 400;             [Bindable] private var mainTitle:String = "Main Window";                         private var timer:Timer;             private var s:Screen;                         private function init() : void {                                 nativeWindow.x = -1000;                 nativeWindow.y = -1000;                                 stage.addEventListener( MouseEvent.MOUSE_DOWN, onMouseDown );                 timer = new Timer(1000, 1);                 timer.addEventListener(TimerEvent.TIMER_COMPLETE, alignBottomRight);                 timer.start();             }             private function alignBottomRight( e:TimerEvent ) : void {                 timer.stop();                 s = Screen.mainScreen;                 nativeWindow.x = s.visibleBounds.width - nativeWindow.width - 5;                 nativeWindow.y = s.visibleBounds.height - nativeWindow.height - 5;             }             private function onMouseDown( e:MouseEvent ) : void {                 nativeWindow.startMove();             }         ]]>     </mx:Script>     <mx:Panel width="{mainW}" height="{mainH}" title="{mainTitle}" >         <mx:Label text="Text" />     </mx:Panel>     <OtherWindow /> </mx:WindowedApplication>

This is the OtherWindow.MXML:

ActionScript Code:
<?xml version="1.0" encoding="utf-8"?> <mx:Window xmlns:mx="http://www.adobe.com/2006/mxml" showFlexChrome="false" layout="absolute" >     <mx:Script>         <![CDATA[             [Bindable] private var winX:Number = 30;             [Bindable] private var winY:Number = 100;             [Bindable] private var winW:Number = 140;             [Bindable] private var winH:Number = 200;             [Bindable] private var winTitle:String = "Other Window";         ]]>     </mx:Script>     <mx:Panel x="{winX}" y="{winY}" width="{winW}" height="{winH}" title="{winTitle}" /> </mx:Window>
seanlail is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Controlling Browser Window via Flash Javascript buttons [via 'get url' statement]. cheeky_monkey ActionScript 1.0 (and below) 7 01-20-2009 03:30 PM
Integrating Flex, HTML, Javascript in AIR glidealong AIR (Apollo) 1 02-13-2008 08:56 AM
How to convert an MDI window to an external window drmack ActionScript 3.0 0 12-02-2007 10:16 PM
Blocking Window in flash???!!! roshankolar Projectors and CDs 0 09-07-2007 11:48 AM
Window control lewisfaith Server-Side Scripting 1 07-30-2002 12:49 PM


All times are GMT. The time now is 01:39 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.