Archive

Posts Tagged ‘close’

DropDownController PopupAnchor

November 8, 2011 Leave a comment

Lets pretend you have a popup that you want to show when a button is clicked, as in the following example:

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication 
	xmlns:fx="http://ns.adobe.com/mxml/2009"
	xmlns:mx="library://ns.adobe.com/flex/mx"
	xmlns:s="library://ns.adobe.com/flex/spark">
	
	<s:Button 
		label="Some Button that pops something up"
		horizontalCenter="0"
		verticalCenter="0"
		click="popup.displayPopUp = true;"/>

	<s:PopUpAnchor 
		id="popup"
		right="0"
		bottom="0">
		<s:Group>
			<s:Rect 
				width="50"
				height="50">
				<s:fill>
					<s:SolidColor color="0xFF00FF"/>
				</s:fill>
			</s:Rect>
		</s:Group>
	</s:PopUpAnchor>

</s:WindowedApplication>

How do you easily manage when the popup is closed in this case?
Read more…

Making sure your air application exits (?:when using ApplicationUpdater(?:UI)?)?

December 30, 2010 Leave a comment

One of our desktop applications had the requirement of providing an auto-update feature. We turned to the built in framework of ApplicationUpdaterUI to fill that requirement, but interestingly enough the form would sometimes not show at all after calling initialize and then our application wouldn’t actually exit when the main window was closed by the user and no other windows were visible.

The symptom of the application not exiting was because I was listening for the INITALIZED and ERROR events on the application updater with weak references and no other references to the updater existed. Thus, sometimes, the updater UI wouldn’t show up at all. Despite the form not showing up sometimes, the native window was actually created, so when the main window closed, the application didn’t actually exit and had to be shut down via the OS (e.g. task manager/force quit) – ouch.

Once I realized what was going on and added strong referenced listeners, I could still make the problem occur by simply closing the application updater UI dialog or by pressing the cancel button – stupid.

Read more…