<?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>Flexpert to the rescue &#187; AIR</title>
	<atom:link href="http://www.flexpert.be/tag/air/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flexpert.be</link>
	<description>Blog site about all things Adobe</description>
	<lastBuildDate>Sat, 28 Aug 2010 17:07:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>June 29th &#8211; Next CFUGBE event: Using ColdFusion with AIR</title>
		<link>http://www.flexpert.be/2010/06/june-29th-next-cfugbe-event-using-coldfusion-with-air/</link>
		<comments>http://www.flexpert.be/2010/06/june-29th-next-cfugbe-event-using-coldfusion-with-air/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 11:15:51 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Event]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[cfair.swc]]></category>
		<category><![CDATA[ColdFusion 9]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[remoting]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=534</guid>
		<description><![CDATA[The next ColdFusion user Group meeting in Belgium wil take place on June 29th, 2010. The location is the Adobe Offices, Culliganlaan 2F, Diegem. The meeting will start at 19h00 and you&#8217;ll have the opportunity to get some free drinks and do some networking with fellow developers. You are not required to know much about [...]]]></description>
			<content:encoded><![CDATA[<p>The next ColdFusion user Group meeting in Belgium wil take place on June 29th, 2010. The location is the Adobe Offices, Culliganlaan 2F, Diegem. The meeting will start at 19h00 and you&#8217;ll have the opportunity to get some free drinks and do some networking with fellow developers. You are not required to know much about ColdFusion for this particular event, so that&#8217;s no excuse not to join us.</p>
<p>Now, the ColdFusion User Group has always been meant to be community driven. However, it seems a bit hard to convince you guys to step up and talk about the things you do with ColdFusion. So, for this meeting we thought we&#8217;d set an example and do some sessions ourselves:</p>
<table style="width: 100%" border="0" cellspacing="5" cellpadding="0" align="left">
<tbody>
<tr>
<td width="71px" valign="top"><img src="http://www.cfug.be/images/Statler.jpg" border="0" alt="Cyril Hanquez" width="71" height="71" /></td>
<td style="text-align: left;" width="399px" valign="top"><strong>Statler (aka Cyril Hanquez)</strong> will give you an overview of AIR 2 and it&#8217;s new features. It will help you get familiar with the technology and show you some cool stuff you can do with it.</td>
</tr>
<tr>
<td width="71px" valign="top"><img src="http://www.cfug.be/images/Waldorf.jpg" border="0" alt="Steven Peeters" width="71" height="71" /></td>
<td style="text-align: left;" width="399px" valign="top"><strong>Waldorf (aka Steven Peeters)</strong> is going to take it from there and digg a litle deeper into the realm of using AIR with ColdFusion by walking you through an application that uses the ColdFusion ORM feature on the client side with an SQLite database to have automatic online/offline synchronisation.</td>
</tr>
</tbody>
</table>
<p><strong>PROGRAM:</strong></p>
<p><strong>19h00: AIR 2 overview</strong> &#8211; presentation by <strong>Cyril Hanquez</strong>.<br />
<strong>20h00: Using ColdFusion&#8217;s ORM in AIR</strong> &#8211; presentation by <strong>Steven Peeters</strong>.<br />
<strong>21h00: Free drinks and networking</strong></p>
<p>The event is free of charge, but seats are limited. Make sure you <a href="http://cfugbe.eventbrite.com/">register quickly!</a></p>
<p>Cyril and Steven, CFUG managers</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2010/06/june-29th-next-cfugbe-event-using-coldfusion-with-air/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Applications in AIR on Android</title>
		<link>http://www.flexpert.be/2010/06/applications-in-air-on-android/</link>
		<comments>http://www.flexpert.be/2010/06/applications-in-air-on-android/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 13:14:54 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flash Catalyst]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[BTicino]]></category>
		<category><![CDATA[domotics]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[solar panel monitor]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=512</guid>
		<description><![CDATA[This time I would like to share a small video with you guys. It&#8217;s about a couple of AIR applications that I&#8217;ve created. The first one in the video is a solar panel monitor application, which monitor the power output of my solar panels at home. This one works over the internet as well, since [...]]]></description>
			<content:encoded><![CDATA[<p>This time I would like to share a small video with you guys. It&#8217;s about a couple of AIR applications that I&#8217;ve created. The first one in the video is a solar panel monitor application, which monitor the power output of my solar panels at home. </p>
<p>This one works over the internet as well, since it simply downloads a CVS file every 10 minutes to automatically update the application. The design was made in Illustrator, brought into Flash Catalyst to get the arrow working and finally I took it to Flash Builder to attach the HTTPService that fetches the data. You can read the full implementation in my book <a href="http://www.amazon.com/Flash-Builder-Catalyst-Workflow-Essential/dp/1430228350/ref=pd_rhf_p_t_1" target="_blank">&quot;Flash Builder and Flash Catalyst: The New Workflow&quot;</a> as well, since it&#8217;s one of the many examples in there.</p>
<p>The second application is a remote control for my <a href="http://www.bticino.com" target="_blank">BTicino</a> domotics system. I&#8217;ve been wanting to do this for a very long time now. But up until now I just couldn&#8217;t do it, because you couldn&#8217;t create this thing in Flash Lite 3. But now, with AIR on Android (and soon on other mobile platforms as well) I could create a socket connection to my MH200 controller and feed it directly with my input to control the shutters and lights. Naturally, the possibilities are only limited by your imagination.</p>
<p>Both applications are Flex 4 applications, which proves that, despite the fact that the Flex framework isn&#8217;t optimised for these mobile devices and Slider (special Flex framework for mobile) isn&#8217;t yet available, the application still works pretty damn well. Loading times are not that bad either. Imagine what an optimised Flex framework will be able to perform then&#8230;</p>
<p><center><br />
<script type="text/javascript">
    		var parameters =
    			{	id: "1"
    			,	src: "http://www.flexpert.be/tutorials/AIRonAndroid/AIRonAndroid.f4v"
    			,	autoPlay: "false"
    			,   width: "360"
    			,   height: "299"
				,	autoHideControlBar: "false"
				,	controlBarPosition: "bottom"
    			};
    		// Embed the player SWF:
    		swfobject.embedSWF
				( "/strobe/StrobeMediaPlayback.swf"
				, "player"
				, parameters["width"], parameters["height"]
				, "10.0.0"
				, {}
				, parameters
				, { allowFullScreen: "true" }
				, { name: "StrobeMediaPlayback" }
				);		
     </script></p>
<div id="player">
<p>Please install Flash Player 10.0</p>
</p></div>
<p></center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2010/06/applications-in-air-on-android/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>FATC &#8211; AIR 2.0 workshop overview</title>
		<link>http://www.flexpert.be/2010/05/fatc-air20-workshop/</link>
		<comments>http://www.flexpert.be/2010/05/fatc-air20-workshop/#comments</comments>
		<pubDate>Fri, 14 May 2010 02:54:01 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Event]]></category>
		<category><![CDATA[FATC]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[workshop]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=452</guid>
		<description><![CDATA[OK, so now we&#8217;re done with the AIR 2.0 workshop here. Things were really looking good and we had some great questions and responses from the audience. Let me make a small summary of what we covered. Peter Elst was up first and he talked about the basic stuff in AIR. Since the audience was [...]]]></description>
			<content:encoded><![CDATA[<p>OK, so now we&#8217;re done with the AIR 2.0 workshop here. Things were really looking good and we had some great questions and responses from the audience. Let me make a small summary of what we covered.</p>
<p><a href="http://www.peterelst.com" target="_blank">Peter Elst</a> was up first and he talked about the basic stuff in AIR. Since the audience was divided into people already familiar with AIR and people who had no experience at all, this was a realy good start to get everyone up-to-speed. Topics ranged from basic AIR APIs like file access and drag-and-drop functionality to URL monitoring and basic SQLite access.</p>
<p>That&#8217;s where I stepped in and turned the volume up just a notch, because my session was entirely about working with the SQLite local database. Starting with the basics on accessing the database synchronously or asynchronously, I moved on to using the ColdFusion 9 ORM capabilities on the client side. That means that you don&#8217;t have to write any SQL statements to create or update the database. The cool thing about this specific ORM implementation is the fact that you can use that feature to synchronise your local database with a remote server as well. Unfortunately, during the workshop, the internet connection dropped and I could show it actually working, so you guys have to believe me that this is awesome stuff. You can find my slides from the session below.</p>
<p><center><object id="__sse4091379" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=fatc2010-100513213931-phpapp01&amp;stripped_title=flash-and-the-city-2010" /><param name="name" value="__sse4091379" /><param name="allowfullscreen" value="true" /><embed id="__sse4091379" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=fatc2010-100513213931-phpapp01&amp;stripped_title=flash-and-the-city-2010" name="__sse4091379" allowscriptaccess="always" allowfullscreen="true"></embed></object></center></p>
<p>Before having everyone falling asleep, I let <a href="http://theflashblog.com/" target="_blank">Lee Brimelow</a> take the stage and he went on about multitouch on devices. He talked about the new possibilities with multitouch and gestures in AIR and how you can test it on devices (laptops) that are not multitouch enabled.</p>
<p>Finally, Weyert De Boer took the stage and he had some great stuff to tell about using AIR&#8217;s socket server capabilities to create a custom HTTP server application. This was really impressive stuff.</p>
<p>At the end we had a small Q&#038;A session and that was a wrap for us. So now, I would just like to thank everyone who attended the workshop and hopefully you&#8217;ve taken along some great new insights.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2010/05/fatc-air20-workshop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solving the &#8220;missing AIR application XML file&#8221; error in Flash Builder</title>
		<link>http://www.flexpert.be/2010/04/solving-the-missing-air-application-xml-file-error-in-flash-builder/</link>
		<comments>http://www.flexpert.be/2010/04/solving-the-missing-air-application-xml-file-error-in-flash-builder/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 18:27:42 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[app.xml]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[code-behind]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=440</guid>
		<description><![CDATA[When creating an AIR project, you automatically get an XML configuration file for your application, which contains the initial width and height, the available icons and the indication whether or not the application uses a custom chrome (amongst other settings). This XML file has the same name as the application itself, followed by &#8220;-app.xml&#8221;. OK, [...]]]></description>
			<content:encoded><![CDATA[<p>When creating an AIR project, you automatically get an XML configuration file for your application, which contains the initial width and height, the available icons and the indication whether or not the application uses a custom chrome (amongst other settings). This XML file has the same name as the application itself, followed by &#8220;-app.xml&#8221;. OK, so now you know what exactly I&#8217;m talking about, let me explain the problem.</p>
<p>When creating AIR applications, you often create custom components, which you place in separate packages to help organize the structure of your project. And every once in a while you will also <strong>create a custom component that extends the WindowedApplication class</strong>, for example to create an application that automatically updates itself when a new version becomes available. such a component would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> AutoUpdater <span style="color: #0066CC;">extends</span> WindowedApplication <span style="color: #66cc66;">&#123;</span>
&nbsp;
  <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> appUpdater:ApplicationUpdaterUI;
&nbsp;
  <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> AutoUpdater<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    appUpdater = <span style="color: #000000; font-weight: bold;">new</span> ApplicationUpdaterUI<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    addEventListener<span style="color: #66cc66;">&#40;</span>FlexEvent.<span style="color: #006600;">APPLICATION_COMPLETE</span>, startAutoUpdate<span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> startAutoUpdate<span style="color: #66cc66;">&#40;</span>event:FlexEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    appUpdater.<span style="color: #006600;">configurationFile</span> = <span style="color: #000000; font-weight: bold;">new</span> File<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;app:/updateConfig.xml&quot;</span><span style="color: #66cc66;">&#41;</span>;
    appUpdater.<span style="color: #006600;">isCheckForUpdateVisible</span> = <span style="color: #000000; font-weight: bold;">false</span>;
    appUpdater.<span style="color: #006600;">isDownloadUpdateVisible</span> = <span style="color: #000000; font-weight: bold;">false</span>;
    appUpdater.<span style="color: #006600;">isDownloadProgressVisible</span> = <span style="color: #000000; font-weight: bold;">false</span>;
    appUpdater.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>UpdateEvent.<span style="color: #006600;">INITIALIZED</span>, autoUpdateInitialised<span style="color: #66cc66;">&#41;</span>;
    appUpdater.<span style="color: #006600;">initialize</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> autoUpdateInitialised<span style="color: #66cc66;">&#40;</span>event:UpdateEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    appUpdater.<span style="color: #006600;">checkNow</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Now, you can simply extend your new application from this AutoUpdater class by declaring it as the root tag of your main application file. However, <strong>in Flash Builder 4 this generates an error, as shown in the picture below</strong>.</p>
<p><center><a href="http://www.flexpert.be/wp-content/uploads/FBerrors.png"><img src="http://www.flexpert.be/wp-content/uploads/FBerrors.png" alt="Compilation issues in Flash Builder" title="Compilation issues in Flash Builder" style="border:0" width="600" height="154" class="aligncenter size-full wp-image-442" /></a></center></p>
<p> In this screenshot you notice there are two errors, since for my project I also created another custom class which implements the URL monitoring system as well, on top of the automatic updates. <strong>Apparently the compiler expects each application to have its own XML configuration file</strong>, even though those components are not the actual starting point for your application.</p>
<p><strong>To solve this problem you simply have to go to the project settings dialog.</strong> In that dialog you go to the &#8220;Flex Applications&#8221; part by selecting it on the left side. Within that section you can see each application within your project &#8211; yes, a single project can contain more than one applications.</p>
<p><center><a href="http://www.flexpert.be/wp-content/uploads/FBProjectSettings.png"><img src="http://www.flexpert.be/wp-content/uploads/FBProjectSettings.png" alt="Flash Builder Project Settings" title="Flash Builder Project Settings" style="border:0" width="600" height="373" class="aligncenter size-full wp-image-441" /></a></center></p>
<p>You can notice that the AutoUpdater class (and in my case the MonitoredAutoUpdater class as well) is flagged as an application. Just <strong>select that application and click the &#8220;Remove&#8221; button</strong>. This will not remove the file from the project, but instead it just removes the application flag. And because the compiler will no longer recognize it as an actual appliaction, it will not search for that XML configuration file anymore, thus solving your problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2010/04/solving-the-missing-air-application-xml-file-error-in-flash-builder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ben Forta is coming to Belgium</title>
		<link>http://www.flexpert.be/2010/02/ben-forta-is-coming-to-belgium/</link>
		<comments>http://www.flexpert.be/2010/02/ben-forta-is-coming-to-belgium/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 13:18:48 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Event]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Ben Forta]]></category>
		<category><![CDATA[CFUG]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=341</guid>
		<description><![CDATA[For those of you who don&#8217;t know Ben Forta, he&#8217;s the Adobe senior product evangelist and the author of numerous books about ColdFusion (nad other technologies). He&#8217;s also the director of the evangelism team. Every once in a while you get the chance to meet with him at some ColdFusion event, but not often in [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who don&#8217;t know <a href="http://www.forta.com" target="_blank">Ben Forta</a>, he&#8217;s the Adobe senior product evangelist and the author of numerous books about ColdFusion (nad other technologies). He&#8217;s also the director of the evangelism team.</p>
<p>Every once in  a while you get the chance to meet with him at some ColdFusion event, but not often in Belgium. Well, here&#8217;s your chance now, because on March 9, 2010 he&#8217;s coming to Liege/Luik in Belgium. This event will not be about ColdFusion alone. There will alo be presentations on Flash Builder 4 and AIR 2.0. Tickets are free, but seats are limited, so hurry up and secure your seat at <a href="http://rialiege.eventbrite.com/" target="_blank">http://rialiege.eventbrite.com/</a>.</p>
<p>I hope to see you guys there&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2010/02/ben-forta-is-coming-to-belgium/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embedding fonts in Flex, AIR and Actionscript projects</title>
		<link>http://www.flexpert.be/2009/06/embedding-fonts-in-flex-air-and-actionscript-projects/</link>
		<comments>http://www.flexpert.be/2009/06/embedding-fonts-in-flex-air-and-actionscript-projects/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 12:45:57 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[embed]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[font]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=49</guid>
		<description><![CDATA[Question: I’m trying to develop a Flex application that uses a Text component which will take an html rendered text. So far, no problem there. However, I would like to use more than 1 font (regular, bold, italic) in this text component and I’m not sure if the fonts are all on the user’s computer. [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: medium;"><strong>Question:</strong></span></p>
<p><em>I’m trying to develop a Flex application that uses a Text component which will take an html rendered text. So far, no problem there. However, I would like to use more than 1 font (regular, bold, italic) in this text component and I’m not sure if the fonts are all on the user’s computer. What’s the best way of tackling this problem?</em></p>
<p><span style="font-size: medium;"><strong>Solution:</strong></span></p>
<p>If you don’t know for sure the fonts are installed on the user’s computer (because it’s some exotic font or some typical OS dependant font, the best way of dealing with that would be to embed the font in your Flex application (or any Actionscript application). Now, how do you do this exactly when you want to embed multiple fonts for a single component? Well, I’ll show you.</p>
<p>There are actually 3 ways of embedding your fonts in an application:</p>
<ol>
<li>embed fonts in your Actionscript code</li>
<li>embed fonts directly in CSS</li>
<li>embed fonts in CSS using a SWF file that has (part of) the fonts embedded</li>
</ol>
<p><strong>1. Embed your fonts directly in Actionscript</strong></p>
<p>To embed a font in Actionscript, you’ll have to assign it to some static variable to be able to incorporate it in the compilation of your application. Just before that variable definition, you specify a <strong>metadata tag “Embed”</strong> (just like you would if you were to embed an image). The properties for this metadata tag are:</p>
<ul>
<li>source: the location of your font file</li>
<li>fontName: the name you want to use in the application for your font. I’ve chosen to use myFont to indicate it can be anything you like. But you could also choose the font name itself if you prefer it like that</li>
<li>fontStyle: italic if it is an italic font (can be in combination with fontWeight)</li>
<li>fontWeight: bold if it is a bold font (can be in combination with fontStyle)</li>
<li>mimeType: e.g. application/x-font-truetype if it’s a truetype font</li>
</ul>
<p>Repeat this step for all the different fonts you want to embed, but <strong>make sure that the fontName property is exactly the same</strong> for all of them. So, when for example you want to embed a Verdana font in regular, bold, italic and boldItalic, your code would look something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;C:<span style="">\\</span>Windows<span style="">\\</span>Fonts<span style="">\\</span>Verdana.ttf&quot;</span>,
       <span style="color: #004993;">fontName</span>=<span style="color: #990000;">&quot;myFont&quot;</span>,
       mimeType=<span style="color: #990000;">&quot;application/x-font-truetype&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
<span style="color: #0033ff; font-weight: bold;">public</span> static const VerdanaTTF<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>;
&nbsp;
<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;C:<span style="">\\</span>Windows<span style="">\\</span>Fonts<span style="">\\</span>VerdanaBold.ttf&quot;</span>,
       fontWeight=<span style="color: #990000;">&quot;bold&quot;</span>,
       <span style="color: #004993;">fontName</span>=<span style="color: #990000;">&quot;myFont&quot;</span>,
       mimeType=<span style="color: #990000;">&quot;application/x-font-truetype&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
<span style="color: #0033ff; font-weight: bold;">public</span> static const VerdanaBoldTTF<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>;
&nbsp;
<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;C:<span style="">\\</span>Windows<span style="">\\</span>Fonts<span style="">\\</span>VerdanaItalic.ttf&quot;</span>,
       <span style="color: #004993;">fontStyle</span>=<span style="color: #990000;">&quot;italic&quot;</span>,
       <span style="color: #004993;">fontName</span>=<span style="color: #990000;">&quot;myFont&quot;</span>,
       mimeType=<span style="color: #990000;">&quot;application/x-font-truetype&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
<span style="color: #0033ff; font-weight: bold;">public</span> static const VerdanaItalicTTF<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>;
&nbsp;
<span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #004993;">source</span>=<span style="color: #990000;">&quot;C:<span style="">\\</span>Windows<span style="">\\</span>Fonts<span style="">\\</span>VerdanaBoldItalic.ttf&quot;</span>,
       fontWeight=<span style="color: #990000;">&quot;bold&quot;</span>,
       <span style="color: #004993;">fontStyle</span>=<span style="color: #990000;">&quot;italic&quot;</span>,
       <span style="color: #004993;">fontName</span>=<span style="color: #990000;">&quot;myFont&quot;</span>,
       mimeType=<span style="color: #990000;">&quot;application/x-font-truetype&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
<span style="color: #0033ff; font-weight: bold;">public</span> static const VerdanaBoldItalicTTF<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>;</pre></div></div>

<p><strong>2. Embed your font directly in CSS</strong></p>
<p>Now, you can do exactly the same using only an external CSS file. The embedding part itself is a little bit different though. You would have to use the @font-face style for each of the separate font styles you want to incorporate in the resulting SWF file and provide it with the following attributes:</p>
<ul>
<li>src: the location of your font file.</li>
<li>fontFamily: the name you want to use in your application for your font. Again, I’ve chosen to use myFont to indicate it can be anything you like. But you could also choose the font name itself if you prefer it like that</li>
<li>fontStyle: italic if it is an italic font (can be combined with fontWeight)</li>
<li>fontWeight: bold if it is a bold font (can be combined with fontStyle)</li>
</ul>
<p>The src style attribute can either point to a file on the local file system or to a file somewhere on the web or another location. For embedding a font which resides <strong>on the local file system, you would specify local(“&lt;font name&gt;”)</strong> . The font name will remain the same for all the variations you want to embed, because it’s the style attributes that will make up the difference here. You’ll probably use this local specification most of the time, because you’ll probably want to embed a font that you have on your own computer. However, if you were to incorporate a font file which resides somewhere <strong>on a remote location, you would use url(“&lt;path to font file&gt;”)</strong>. This path can either be a relative or absolute path.</p>
<p>Of course you need to <strong>repeat the @font-face style for every font variation you want to embed</strong>. Again, make sure that the fontFamily property is exactly the same for all of them, because you will use that name in the fontFamily attribute of the style you are going to apply on the component in order to use the different font styles.</p>
<p>For the same Verdana font definitions, your code should look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">@font<span style="color: #000000; font-weight: bold;">-</span>face <span style="color: #000000;">&#123;</span>
	src<span style="color: #000000; font-weight: bold;">:</span> local<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Verdana&quot;</span><span style="color: #000000;">&#41;</span>;
	fontFamily<span style="color: #000000; font-weight: bold;">:</span> myFont;
<span style="color: #000000;">&#125;</span>
&nbsp;
@font<span style="color: #000000; font-weight: bold;">-</span>face <span style="color: #000000;">&#123;</span>
	src<span style="color: #000000; font-weight: bold;">:</span> local<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Verdana&quot;</span><span style="color: #000000;">&#41;</span>;
	fontFamily<span style="color: #000000; font-weight: bold;">:</span> myFont;
	fontWeight<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">bold</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
@font<span style="color: #000000; font-weight: bold;">-</span>face <span style="color: #000000;">&#123;</span>
	src<span style="color: #000000; font-weight: bold;">:</span> local<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Verdana&quot;</span><span style="color: #000000;">&#41;</span>;
	fontFamily<span style="color: #000000; font-weight: bold;">:</span> myFont;
	<span style="color: #004993;">fontStyle</span><span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">italic</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
@font<span style="color: #000000; font-weight: bold;">-</span>face <span style="color: #000000;">&#123;</span>
	src<span style="color: #000000; font-weight: bold;">:</span> local<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Verdana&quot;</span><span style="color: #000000;">&#41;</span>;
	fontFamily<span style="color: #000000; font-weight: bold;">:</span> myFont;
	fontWeight<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">bold</span>;
	<span style="color: #004993;">fontStyle</span><span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">italic</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p><strong>3.	Use a SWF file with partially embedded fonts</strong></p>
<p>These first 2 methods work just fine. However, <strong>they do add several hundreds of kilobytes to your SWF file size</strong>. And this is only for 1 specific font, so imagine what it would do to a SWF file that compiles a couple of fonts into your application. This is due to the fact that a font is more than just alphabetical characters. Most of the time you don’t need all of those characters, but just the basic ones like digits, lowercase and uppercase letters and punctuation signs.</p>
<p>Fortunately, <strong>there is also another solution that allows you to limit the number of glyphs</strong> (this is what the individual font signs are called) to incorporate in your application. To be able to do this, we are going to have to take our development out of Flex Builder (or Flash builder of course) and bring it into Flash.</p>
<p>So, in Flash, you start by creating a <strong>new ActionScript 3 Flash file</strong>. On the stage, you <strong>place a text field</strong> and type some text. In the properties of that text field, you have to <strong>set it to Dynamic Text</strong>. In the Character subframe of the properties panel, you <strong>then select the font you want to embed as well as the style</strong> (regular, bold, italic or bold italic).</p>
<p><img class="aligncenter size-full wp-image-81" title="Properties panel" src="http://www.flexpert.be/wp-content/uploads/dynamic_text.jpg" alt="Properties panel" width="405" height="401" /></p>
<p>At the bottom of that same properties panel, you also see <strong>a button labeled “Character Embedding”</strong>. Just click on that one and you’ll get a dialog box which allows you to <strong>select the glyphs you want to embed</strong> in the Flash file. Select the uppercase, lowercase, numerals and punctuation glyphs and click ok to embed them in the SWF.</p>
<p><strong><img class="aligncenter size-full wp-image-87" title="Embed settings" src="http://www.flexpert.be/wp-content/uploads/embed.jpg" alt="Embed settings" width="304" height="399" /></strong></p>
<p>Now, perform the same procedure for the other font styles you want to embed, so you’ll eventually end up with 4 different dynamic text fields that all include a different style of your font.</p>
<p>The next step is then to <strong>compile your SWF file</strong>, so you can use it in your Flex or AIR application. To do that, you’ll first have to go to the Publish Settings, which you can find in the File menu. In the Format tab of the settings dialog, make sure that only Flash type is selected and then click on Publish. A SWF file will now be generated and that file will contain all the characters from the different font styles that you’ve just indicated.</p>
<p>Go back to Flex Builder (or Flash Builder of course) and <strong>add a fonts directory to your project</strong>. In this directory you place the SWF file that you have just generated. Now, to actually use the embedded fonts from the SWF file, <strong>we have to rely again on CSS</strong>. This is quite similar to the second method I’ve explained. However, <strong>this time the fontFamily property must be exactly the same as the actual font that you have included</strong>. So, in my example here, it has to be “Verdana”. You cannot choose the fontFamily name you want to use in your application freely anymore.</p>
<p>So, enter the different @font-face styles that match the embedded fonts from the SWF file in the same way as you would do when using the second method, bearing in mind that the font name is fixed now. Your code should look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">@font<span style="color: #000000; font-weight: bold;">-</span>face <span style="color: #000000;">&#123;</span>
	src<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">url</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;../fonts/Verdana.swf&quot;</span><span style="color: #000000;">&#41;</span>;
	fontFamily<span style="color: #000000; font-weight: bold;">:</span> Verdana;
<span style="color: #000000;">&#125;</span>
&nbsp;
@font<span style="color: #000000; font-weight: bold;">-</span>face <span style="color: #000000;">&#123;</span>
	src<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">url</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;../fonts/Verdana.swf&quot;</span><span style="color: #000000;">&#41;</span>;
	fontFamily<span style="color: #000000; font-weight: bold;">:</span> Verdana;
	fontWeight<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">bold</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
@font<span style="color: #000000; font-weight: bold;">-</span>face <span style="color: #000000;">&#123;</span>
	src<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">url</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;../fonts/Verdana.swf&quot;</span><span style="color: #000000;">&#41;</span>;
	fontFamily<span style="color: #000000; font-weight: bold;">:</span> Verdana;
	<span style="color: #004993;">fontStyle</span><span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">italic</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
@font<span style="color: #000000; font-weight: bold;">-</span>face <span style="color: #000000;">&#123;</span>
	src<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">url</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;../fonts/Verdana.swf&quot;</span><span style="color: #000000;">&#41;</span>;
	fontFamily<span style="color: #000000; font-weight: bold;">:</span> Verdana;
	fontWeight<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">bold</span>;
	<span style="color: #004993;">fontStyle</span><span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">italic</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>When you take a closer look at the generated SWF file, <strong>you will certainly notice a big difference in file size between the first 2 methods and this last one</strong>. This is because now, not all glyphs are embedded in the SWF file.</p>
<p>All you have to do now, is just set the fontFamily for the necessary components to the name you’ve just used in your CSS or Actionscript style embedding of the fonts, make sure you use the htmlText property and you’re all set to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2009/06/embedding-fonts-in-flex-air-and-actionscript-projects/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
