<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Monkey Magician &#187; Flex</title>
	<atom:link href="http://www.monkeymagician.co.uk/tag/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.monkeymagician.co.uk</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 16 Jun 2010 12:14:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Getting Page Title from the &lt;mx:HTML&gt; Component</title>
		<link>http://www.monkeymagician.co.uk/2010/06/16/getting-page-title-mx-html/</link>
		<comments>http://www.monkeymagician.co.uk/2010/06/16/getting-page-title-mx-html/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 12:10:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[air]]></category>

		<guid isPermaLink="false">http://www.monkeymagician.co.uk/?p=43</guid>
		<description><![CDATA[I recently found out how to get the title (i.e. the contents of &#60;title&#62;) of the current page in an &#60;mx:HTML&#62; component in Flex. Turns out you have to wait for the complete event rather than the htmlDOMInitialize event or the value is not accessible.

&#60;mx:Script&#62;
	&#60;![CDATA[

		private function onHtmlComplete():void {
			var title:String = html.domWindow.document.title;
		}

	]]&#62;
&#60;/mx:Script&#62;

&#60;mx:HTML id="html" complete="onHtmlComplete()" /&#62;

Every time [...]]]></description>
			<content:encoded><![CDATA[<p>I recently found out how to get the title (i.e. the contents of &lt;title&gt;) of the current page in an &lt;mx:HTML&gt; component in Flex. Turns out you have to wait for the complete event rather than the htmlDOMInitialize event or the value is not accessible.</p>
<pre class="code">
&lt;mx:Script&gt;
	&lt;![CDATA[

		private function onHtmlComplete():void {
			var title:String = html.domWindow.document.title;
		}

	]]&gt;
&lt;/mx:Script&gt;

&lt;mx:HTML id="html" complete="onHtmlComplete()" /&gt;
</pre>
<p>Every time a new page is loaded this event fires and it is possible to get the new title.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.monkeymagician.co.uk/2010/06/16/getting-page-title-mx-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>System Tray Icon and Menu for an Adobe Flex AIR Application</title>
		<link>http://www.monkeymagician.co.uk/2009/04/22/system-tray-icon-and-menu-for-an-adobe-flex-air-application/</link>
		<comments>http://www.monkeymagician.co.uk/2009/04/22/system-tray-icon-and-menu-for-an-adobe-flex-air-application/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 19:20:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[dock]]></category>
		<category><![CDATA[icon]]></category>
		<category><![CDATA[system tray]]></category>

		<guid isPermaLink="false">http://www.monkeymagician.co.uk/2009/04/22/system-tray-icon-and-menu-for-an-adobe-flex-air-application/</guid>
		<description><![CDATA[Adobe AIR allows you to set up a system tray icon and context menu for your application. In true AIR &#38; Flex style, this is surprisingly simple to achieve and doesn&#8217;t even require a .ico file.
Creating the System Tray Icon
Within the WindowedApplication we can embed a graphic to be used as the icon. I&#8217;m using [...]]]></description>
			<content:encoded><![CDATA[<p>Adobe AIR allows you to set up a system tray icon and context menu for your application. In true AIR &amp; Flex style, this is surprisingly simple to achieve and doesn&#8217;t even require a .ico file.<span id="more-29"></span></p>
<h3>Creating the System Tray Icon</h3>
<p>Within the WindowedApplication we can embed a graphic to be used as the icon. I&#8217;m using a 16 x 16 PNG with full alpha transparency.</p>
<pre class="code">[Embed(source="icons/tray.png")]

private var TrayIcon:Class;</pre>
<p>By attaching a handler to the initialize event, an instance of the embedded image is created (cast to a Bitmap) and the bitmap data extracted. This data can then be assigned to the array of icons for the application. I&#8217;m also setting the tooltip text. This code is wrapped inside a check that the system support system tray icons.</p>
<pre class="code">if (NativeApplication.supportsSystemTrayIcon) {
    var trayIcon:BitmapData = Bitmap(new TrayIcon()).bitmapData;
    SystemTrayIcon(nativeApplication.icon).bitmaps = [trayIcon];
    SystemTrayIcon(nativeApplication.icon).tooltip = 'This text will appear when hovering over the icon';
}</pre>
<p>The icon also supports event handlers for various ScreenMouseEvent types, meaning you can handle clicks, right clicks and so on, depending on your requirements.</p>
<h3>Creating a Context Menu</h3>
<p>The context menu for the tray icon is created as a standard NativeMenu (with a number of NativeMenuItem items) and then assigned as the menu for the icon. The sample below defined a menu with an exit option which is handled by a separate handler function.</p>
<pre class="code">var menu:NativeMenu = new NativeMenu();

var exitMenuItem:NativeMenuItem = new NativeMenuItem("Exit");
exitMenuItem.addEventListener(Event.SELECT, exitApplication);
menu.addItem(exitMenuItem);

SystemTrayIcon(nativeApplication.icon).menu = menu;</pre>
<p>The menu will now appear on a right click on the tray icon, there is no need to explicitly wire this interaction together.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.monkeymagician.co.uk/2009/04/22/system-tray-icon-and-menu-for-an-adobe-flex-air-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
