<?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>Michael Fretz - Interaction Designer &#187; mojofont</title>
	<atom:link href="http://www.michaelfretz.com/tag/mojofont/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.michaelfretz.com</link>
	<description>Interaction Design Studium Blog</description>
	<lastBuildDate>Wed, 21 Jul 2010 09:43:04 +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>My talk at L.A. Flex User Group Meeting in January</title>
		<link>http://www.michaelfretz.com/2010/02/12/my-talk-at-la-flex-user-group-meeting-in-january/</link>
		<comments>http://www.michaelfretz.com/2010/02/12/my-talk-at-la-flex-user-group-meeting-in-january/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 22:41:09 +0000</pubDate>
		<dc:creator>Michael Fretz</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Internship USA]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[mojofont]]></category>

		<guid isPermaLink="false">http://www.michaelfretz.com/?p=3139</guid>
		<description><![CDATA[Some of you probably read my article about Font Embedding in Actionscript 3 projects. In the January L.A. Flex User Group meeting, Tom Bray recorded my talk about MojoFont. MojoFont is an Eclipse Plugin for easy Font Embedding in Flex, FDT or Eclipse. It was a good experience to speak to the L.A. Flex group. [...]]]></description>
			<content:encoded><![CDATA[<p>Some of you probably read my article about <a href="http://www.michaelfretz.com/2010/01/12/font-embedding-in-actionscript-projects/">Font Embedding in Actionscript 3 projects</a>. In the January <a href="http://groups.adobe.com/groups/2b6ef91865/summary" target="_blank">L.A. Flex User Group </a>meeting, <a href="http://www.tombray.com/2010/02/l-a-flex-video-embedding-fonts-with-mojofont-with-michael-fretz/" target="_blank">Tom Bray</a> recorded my talk about <a href="http://mojofont.badmojo.ch/" target="_blank">MojoFont</a>. MojoFont is an Eclipse Plugin for easy Font Embedding in Flex, FDT or Eclipse. It was a good experience to speak to the L.A. Flex group. Thank you Tom for letting me a part of it. If you want to see my talk watch this video.<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="580" height="435" 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://vimeo.com/moogaloop.swf?clip_id=9411553&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="580" height="435" src="http://vimeo.com/moogaloop.swf?clip_id=9411553&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><a href="http://www.tombray.com/2010/02/l-a-flex-video-embedding-fonts-with-mojofont-with-michael-fretz/" target="_blank">My talk about MojoFont at L.A. Flex User Group</a></p>
<p>Unfortunately the picture quality is not really good but if you want to know more about Font Embedding with MojoFont read my post about <a href="http://www.michaelfretz.com/2010/01/12/font-embedding-in-actionscript-projects/">Font Embedding in Actionscript 3.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelfretz.com/2010/02/12/my-talk-at-la-flex-user-group-meeting-in-january/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Font Embedding in Actionscript Projects</title>
		<link>http://www.michaelfretz.com/2010/01/12/font-embedding-in-actionscript-projects/</link>
		<comments>http://www.michaelfretz.com/2010/01/12/font-embedding-in-actionscript-projects/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 03:12:14 +0000</pubDate>
		<dc:creator>Michael Fretz</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[mojofont]]></category>

		<guid isPermaLink="false">http://www.michaelfretz.com/?p=3010</guid>
		<description><![CDATA[While working on Actionscript projects you will have to use fonts quite often. There are many ways how you can embed a font into your project. In this post I will illustrate different ways of how to do that and I would like to demonstrate a very easy way with MojoFont.

Example 1: Font Embedding During [...]]]></description>
			<content:encoded><![CDATA[<p>While working on Actionscript projects you will have to use fonts quite often. There are many ways how you can embed a font into your project. In this post I will illustrate different ways of how to do that and I would like to demonstrate a very easy way with MojoFont.</p>
<p><span id="more-3010"></span></p>
<p><strong>Example 1: Font Embedding During Runtime With SWF</strong><br />
Embedding a font with <span>SWF</span> has the advantage that it can be loaded on run-time. This will make the file size of the start-up application smaller and improves loading times. The font will be only loaded if there is a need for it. You will need to have Adobe Flash CS4 or higher for this example.<br />
1) Open a new <span>Actionscript</span> 3 file in the Flas IDE and save it as American.<span>fla</span><br />
2) Open the action panel and type following:</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>systemFont=<span style="color: #990000;">&quot;American Typewriter&quot;</span>, <span style="color: #004993;">fontName</span>=<span style="color: #990000;">&quot;American&quot;</span>,
	   mimeType=<span style="color: #990000;">&quot;application/x-font&quot;</span>, unicodeRange=<span style="color: #990000;">&quot;U+0061-U+007A&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> american<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Class</span>;
&nbsp;
<span style="color: #004993;">Font</span>.<span style="color: #004993;">registerFont</span><span style="color: #000000;">&#40;</span>american<span style="color: #000000;">&#41;</span>;</pre></div></div>

<p><strong>systemFont</strong> is the actual name of the font on your system.<br />
<strong>fontName</strong> can be named what ever you want to name it.<br />
<strong>unicodeRange</strong> is used to define the avaible characters.</p>
<p>I used for this example only lowercase characters. You can change the <span>unicodeCharset</span> to add more characters. A good website to generate the required <span>unicode</span> is <a href="http://rishida.net/scripts/uniview/conversion.php" target="_blank">http://rishida.net/scripts/uniview/conversion.php</a></p>
<p>3) Compile the <span>SWF</span>. You will be asked for the Flex <span>SDK</span> Path on your first compile. If you have the Flex SDK press OK and compile again otherwise download first the Flex SDK from <a href='http://opensource.adobe.com/wiki/display/flexsdk/'>opensource.adobe.com/wiki/display/flexsdk</a>. Now you should have a blank <span>SWF</span>.</p>
<p>4) Start a new <span>Actionscript</span> 3 file and save it as <span>Fonttest</span>.<span>fla</span> in the same directory as the other file.<br />
5) Open the action panel and type the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">loader</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Loader</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Loader</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #004993;">loader</span>.<span style="color: #004993;">contentLoaderInfo</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">INIT</span>, fontloaded<span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #004993;">loader</span>.<span style="color: #004993;">load</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLRequest</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">'AmericanTypewriter.swf'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> fontloaded<span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> tf<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">TextField</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">TextField</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
	tf.<span style="color: #004993;">width</span>			= <span style="color: #000000; font-weight:bold;">400</span>;
	tf.<span style="color: #004993;">embedFonts</span> = <span style="color: #0033ff; font-weight: bold;">true</span>;
	tf.<span style="color: #004993;">defaultTextFormat</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">TextFormat</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">'American'</span>, <span style="color: #000000; font-weight:bold;">30</span>, 0x000000<span style="color: #000000;">&#41;</span>;
	tf.<span style="color: #004993;">text</span> = <span style="color: #990000;">'hey you'</span>;
	<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>tf<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>6) Save the file and compile it. You will now load the font from the <span>SWF</span>.</p>
<p>This example is based on the video tutorial from Lee <span>Brimelow</span>. Make sure that you watch his video Tutorial at <a href="http://gotoandlearn.com/play?id=102" target="_blank">http://gotoandlearn.com/play?id=102</a> to dive deeper into loading fonts with external <span>SWF</span>.</p>
<p><a href="http://michaelfretz.com/wp-content/uploads/2010/01/FontEmbeddinginFlash.zip">Download Sourcecode including FLA</a></p>
<p><strong>Example 2: Font Embedded In Flash.</strong></p>
<p>Using the [Embed] tag: The font needs to be accessible in your Actionscript project during compile time.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Sprite</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<span style="color: #004993;">AntiAliasType</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<span style="color: #004993;">TextField</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<span style="color: #004993;">TextFormat</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> FontEmbeddingEmbedTag extends <span style="color: #004993;">Sprite</span>
	<span style="color: #000000;">&#123;</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;Arial.ttf&quot;</span>, fontFamily=<span style="color: #990000;">&quot;foo&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> bar<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Class</span>;
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> FontEmbeddingEmbedTag<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> format<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">TextFormat</span>              = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">TextFormat</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			format.<span style="color: #004993;">font</span>                      = <span style="color: #990000;">&quot;foo&quot;</span>;
			format.<span style="color: #004993;">color</span>                = 0xFFFFFF;
			format.<span style="color: #004993;">size</span>                 = <span style="color: #000000; font-weight:bold;">30</span>;
&nbsp;
			<span style="color: #6699cc; font-weight: bold;">var</span> label<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">TextField</span>         = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">TextField</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			label.<span style="color: #004993;">embedFonts</span>            = <span style="color: #0033ff; font-weight: bold;">true</span>;
			label.<span style="color: #004993;">width</span>                    = <span style="color: #000000; font-weight:bold;">300</span>
			label.<span style="color: #004993;">defaultTextFormat</span>     = format;
			label.<span style="color: #004993;">text</span>                  = <span style="color: #990000;">&quot;Hi michaelfretz.com!&quot;</span>;
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>label<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p><a href="http://michaelfretz.com/wp-content/uploads/2010/01/FontEmbeddingEmbedTag.zip">Download Sourcecode</a></p>
<p><strong>Example 3: The MojoFont Way</strong><br />
My favorite way of embedding a font into an Actionscript project is using MojoFont.<br />
You may ask, what is MojoFont? MojoFont is an Eclipse Plugin for embedding Fonts, developed by Philipp Laeubli. MojoFont is still in private beta but will be released soon as a public beta.</p>
<p><strong>Example 3.1: Embedding A Single Font For Basic Textfields With MojoFont</strong><br />
<strong>1)</strong> Apply for a private beta account at <a href="http://mojofont.badmojo.ch/" target="_blank">http://mojofont.badmojo.ch</a> and install it as soon as you get the url for the eclipse update-site.<br />
<strong>2)</strong> Start Flex or FDT and open a new or existing Actionscript 3 project.</p>
<p><img class="alignnone size-full wp-image-3028" title="MojoFontTutorial01" src="http://www.michaelfretz.com/wp-content/uploads/2010/01/MojoFontTutorial01.png" alt="MojoFontTutorial01" width="580" height="225" /></p>
<p><strong>3)</strong> Go to File -&gt; Import -&gt;Other</p>
<p><img class="alignnone size-full wp-image-3029" title="MojoFontTutorial02" src="http://www.michaelfretz.com/wp-content/uploads/2010/01/MojoFontTutorial02.png" alt="MojoFontTutorial02" width="580" height="499" /></p>
<p><strong>4)</strong> Choose MojoFont -&gt; Import and convert Font</p>
<p><img class="alignnone size-full wp-image-3030" title="MojoFontTutorial03" src="http://www.michaelfretz.com/wp-content/uploads/2010/01/MojoFontTutorial03.png" alt="MojoFontTutorial03" width="551" height="551" /></p>
<p><strong>5)</strong> For the First Tutorial we choose the import mode: &#8220;Import a font with a single style&#8221;. This option will allow us to use only one style of th font. A single style font can not be used for HTML textfield. You can make a font bold or italic but to do that you have to import the font with &#8220;import font with multiple font style&#8221;. I will show the import of fonts for HTML textfield in the next example further down.</p>
<p><img class="alignnone size-full wp-image-3031" title="MojoFontTutorial04" src="http://www.michaelfretz.com/wp-content/uploads/2010/01/MojoFontTutorial04.png" alt="MojoFontTutorial04" width="549" height="319" /></p>
<p><strong>6)</strong> Choose a font you want to use and press &#8220;Next &gt;&#8221;.</p>
<p><img class="alignnone size-full wp-image-3033" title="MojoFontTutorial05" src="http://www.michaelfretz.com/wp-content/uploads/2010/01/MojoFontTutorial05.png" alt="MojoFontTutorial05" width="550" height="770" /></p>
<p><img class="alignnone size-full wp-image-3034" title="MojoFontTutorial06" src="http://www.michaelfretz.com/wp-content/uploads/2010/01/MojoFontTutorial06.png" alt="MojoFontTutorial06" width="550" height="769" /><br />
<strong>7)</strong> Select a location in your project where the compiled SWC should be saved. The path to this SWC will be automatically added to your project properties and if you decide to delete a font you have to delete this path too. (Right-click on your project name-&gt;Properties-&gt;Actionscript Build path-&gt;Library path) For the Charset Range we use &#8220;Default / All&#8221;. If you only need some caracters and want to keep the filesize low you can change the settings to &#8220;Predefined&#8221; or &#8220;Custom&#8221;.</p>
<p><img class="alignnone size-full wp-image-3035" title="MojoFontTutorial07" src="http://www.michaelfretz.com/wp-content/uploads/2010/01/MojoFontTutorial07.png" alt="MojoFontTutorial07" width="551" height="771" /><br />
<strong>8)</strong> A quick example how to use it will be shown before you press Finish.</p>
<p><img class="alignnone size-full wp-image-3036" title="MojoFontTutorial08" src="http://www.michaelfretz.com/wp-content/uploads/2010/01/MojoFontTutorial08.png" alt="MojoFontTutorial08" width="550" height="770" /></p>
<p><strong>9)</strong> This is how your Sourcecode should look like if you want to embed a font with MojoFont.</p>
<p><img class="alignnone size-full wp-image-3038" title="MojoFontTutorial09" src="http://www.michaelfretz.com/wp-content/uploads/2010/01/MojoFontTutorial09.png" alt="MojoFontTutorial09" width="580" height="200" /></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Sprite</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<span style="color: #004993;">TextField</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> MojoFontBasic01 extends <span style="color: #004993;">Sprite</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> MojoFontBasic01<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> txt<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">TextField</span> 	= ComicSansMSRegular.createTextField<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			txt.<span style="color: #004993;">text</span>		= <span style="color: #990000;">'Hi michaelfretz.com'</span>;
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>txt<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p><strong>10)</strong> The compiled version will look like that</p>
<p><img class="alignnone size-full wp-image-3037" title="MojoFontTutorial10" src="http://www.michaelfretz.com/wp-content/uploads/2010/01/MojoFontTutorial10.png" alt="MojoFontTutorial10" width="514" height="211" /></p>
<p><a href="http://michaelfretz.com/wp-content/uploads/2010/01/MojoFontBasic01.zip">Download Sourcecode</a></p>
<p><strong>Example 3.2: Same As Before But With TextFormat</strong></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Sprite</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<span style="color: #004993;">TextField</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<span style="color: #004993;">TextFormat</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> MojoFontBasic02 extends <span style="color: #004993;">Sprite</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> MojoFontBasic02<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> txtFormat<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">TextFormat</span> 	= ComicSansMSRegular.createTextFormat<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">20</span><span style="color: #000000;">&#41;</span>;
			txtFormat.<span style="color: #004993;">color</span>			= 0xff8c00;
			txtFormat.<span style="color: #004993;">kerning</span>		= <span style="color: #000000; font-weight:bold;">2</span>;
			<span style="color: #6699cc; font-weight: bold;">var</span> txt<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">TextField</span>		= ComicSansMSRegular.createTextField<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			txt.<span style="color: #004993;">defaultTextFormat</span>		= txtFormat;
			txt.<span style="color: #004993;">text</span>			= <span style="color: #990000;">'hi michaelfretz.com'</span>;
			txt.<span style="color: #004993;">selectable</span>			= <span style="color: #0033ff; font-weight: bold;">false</span>;
			txt.<span style="color: #004993;">width</span>			= <span style="color: #000000; font-weight:bold;">300</span>;
			txt.<span style="color: #004993;">rotation</span>			= <span style="color: #000000; font-weight:bold;">20</span>;
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>txt<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p><a href="http://michaelfretz.com/wp-content/uploads/2010/01/MojoFontBasic02.zip">Download Sourcecode</a></p>
<p><strong>Example 3.3: Text As HTML Textfield</strong></p>
<p>If you want to use HTML text with your MojoFont import, you need to use &#8220;Import multiple Font Style&#8221; instead of &#8220;Import a font with a single style&#8221;. This will bring you up this window.<strong><br />
</strong></p>
<p><strong><img class="alignnone size-full wp-image-3048" title="MojoFontTutorial11" src="http://www.michaelfretz.com/wp-content/uploads/2010/01/MojoFontTutorial11.png" alt="MojoFontTutorial11" width="548" height="770" /></strong></p>
<p>You can choose for all styles a suitable font. You can even mix fonts in a HTML textfield. The rest will be more or less the same. Here the sourcecode.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Sprite</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<span style="color: #004993;">TextField</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> MojoFontAdv01 extends <span style="color: #004993;">Sprite</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> MojoFontAdv01<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> txt<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">TextField</span> = Helvetica.createTextField<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			txt.<span style="color: #004993;">htmlText</span> = <span style="color: #990000;">'&lt;strong&gt;Hi&lt;/strong&gt; &lt;em&gt;michael&lt;/em&gt; fretz'</span>;
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>txt<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p><a href="http://michaelfretz.com/wp-content/uploads/2010/01/MojoFontAdv01.zip">Download Sourcecode</a></p>
<p><strong>Example 3.4: HTML Text Same As Before But With TextFormat</strong></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Sprite</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<span style="color: #004993;">TextField</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<span style="color: #004993;">TextFormat</span>;
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> MojoFontAdv02 extends <span style="color: #004993;">Sprite</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> MojoFontAdv02<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> txtFormat<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">TextFormat</span>	= Helvetica.createTextFormat<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			txtFormat.<span style="color: #004993;">size</span>				= <span style="color: #000000; font-weight:bold;">20</span>;
			txtFormat.<span style="color: #004993;">color</span>				= 0xff8c00;
			txtFormat.<span style="color: #004993;">underline</span>			=  <span style="color: #0033ff; font-weight: bold;">true</span>;
			<span style="color: #6699cc; font-weight: bold;">var</span> txt<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">TextField</span>			= Helvetica.createTextField<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
			txt.<span style="color: #004993;">defaultTextFormat</span>		= txtFormat;
&nbsp;
			txt.<span style="color: #004993;">multiline</span>				= <span style="color: #0033ff; font-weight: bold;">true</span>;
			txt.<span style="color: #004993;">width</span>					= <span style="color: #000000; font-weight:bold;">300</span>;
			txt.<span style="color: #004993;">wordWrap</span>				= <span style="color: #0033ff; font-weight: bold;">true</span>;
			txt.<span style="color: #004993;">rotation</span>				= <span style="color: #000000; font-weight:bold;">30</span>;
			txt.<span style="color: #004993;">htmlText</span>				= <span style="color: #990000;">'&lt;strong&gt;hi&lt;/strong&gt;
&lt;em&gt;michaelfretz.com&lt;/em&gt;'</span>
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>txt<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p><a href="http://michaelfretz.com/wp-content/uploads/2010/01/MojoFontAdv02.zip">Download Sourcecode</a></p>
<p><strong>Live Demo</strong></p>
<p>If you want to see a live demo of MojoFont join me at the <a href="http://groups.adobe.com/groups/2b6ef91865/summary" target="_blank">LA Flex User Group</a> meeting in Santa Monica <span title="GMT-8 Pacific Time US &amp; Canada">January 13, 2010 from 7:00pm &#8211; 10:00pm where I will held a short presentation about MojoFont. </span>We meet at 12304 Santa Monica Blvd, Suite 215A. California, USA.</p>
<p>or</p>
<p>Join us for the Los Angeles Flash User Group meeting on January 20, 2010 at 525 Venezia Ave.  Venice, CA 90291 <a href="http://www.laflash.org">www.laflash.org</a> where I will talk about FontEmbedding in Actionscript projects.</p>
<p><strong>Thanks</strong></p>
<p>Many special thank to Philipp Laeubli who is the developer and founder of MojoFont. Please visit his project <a href="http://mojofont.badmojo.ch/" target="_blank">website</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelfretz.com/2010/01/12/font-embedding-in-actionscript-projects/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>XML Visualization with AS3.0, Tween Lite, MojoFont, PHP 5 and MySQL</title>
		<link>http://www.michaelfretz.com/2009/08/20/xml-visualization-with-as30-tween-lite-mojofont-php-5-and-mysql/</link>
		<comments>http://www.michaelfretz.com/2009/08/20/xml-visualization-with-as30-tween-lite-mojofont-php-5-and-mysql/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 11:26:33 +0000</pubDate>
		<dc:creator>Michael Fretz</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Interface Design]]></category>
		<category><![CDATA[mojofont]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tween lite]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.michaelfretz.com/?p=2740</guid>
		<description><![CDATA[One of the main reason I use Actionscript 3.0 is to create data visualization. Most times the data is saved in a XML or database. Therefore I would like to show you some parts of of a recently developed program.
Here is an example of the final result.
(Please open the article to see the flash file [...]]]></description>
			<content:encoded><![CDATA[<p>One of the main reason I use Actionscript 3.0 is to create data visualization. Most times the data is saved in a XML or database. Therefore I would like to show you some parts of of a recently developed program.<br />
Here is an example of the final result.</p>
<p><object type="application/x-shockwave-flash" data="http://www.michaelfretz.com/wp-content/uploads/2009/08/Hagedorn_Organigramm.swf" width="580" height="600" class="embedflash"><param name="movie" value="http://www.michaelfretz.com/wp-content/uploads/2009/08/Hagedorn_Organigramm.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object></p>
<p><span id="more-2740"></span></p>
<p><strong>Font Embedding</strong></p>
<p>Because most time you visualize data you need to write some text to it. If you have done any pure ActionScript projects in Flex or FDT you know this stuff sucks. The resulting code looks like this and it takes hours of googling to get to the right embed parameters/tags.</p>
<p><img class="alignnone size-full wp-image-2742" title="Font embedding" src="http://www.michaelfretz.com/wp-content/uploads/2009/08/fontembeddingoldfashinway.jpg" alt="Font embedding" width="580" height="185" /></p>
<p>But now the way of font handling in Actionscript changed. My colleague Philipp Laeubli created a plugin for eclipse which makes font embedding a piece of cake. If your interested in this, just apply for a private beta account on <a href="http://mojofont.badmojo.ch" target="_blank">mojofont.badmojo.ch</a>.<br />
Here a little example how to embed a font with the mojofont plugin.<br />
<img class="alignnone size-full wp-image-2743" title="Font embedding with mojofont" src="http://www.michaelfretz.com/wp-content/uploads/2009/08/fontembeddingeasyway.png" alt="Font embedding with mojofont" width="425" height="178" /></p>
<p>Instead of writing a whole bunch of metacode and doing some strange font registration, you import your font, and then you can use ist like this: Helvetica.createTextField(). Thats it. All the nasty embedding code and other things are completely handled by the plugin which generates a simple to use and embed swc file.</p>
<p><strong>Tweening</strong><br />
For the hole tweening I used the tweenlite library from <a href="http://blog.greensock.com/tweenliteas3/" target="_blank">http://blog.greensock.com/tweenliteas3/</a>. In my opinion it is one of the best tweening libarys and very easy to use.</p>
<p><strong>XML Loading</strong><br />
I wrote a XMLLoader class. The XMLLoader class loads the hole data of the XML into a String. As soon as its finishes with loading, it dispatches an event. With the getter methods its easy to recive the data and use it afterwards in your programm.</p>
<p><img class="alignnone size-full wp-image-2749" title="xmlloader1" src="http://www.michaelfretz.com/wp-content/uploads/2009/08/xmlloader1.jpg" alt="xmlloader1" width="512" height="554" /></p>
<p><strong>PHP File to generate XML</strong><br />
Many of you will ask why I id use XML. In my opinion its the easiest way of recieving data and its easy to generate it from a database. To generate the XML file I developed a PHP file. This file connects to a MySQL database and loads the whole content of the defined table.  At the moment you will have to define the used fields by hand. First of all, be sure you have all the needed fields in your database. Afterwards change the values in the begin of the mysqlToXML.php file. You have two options. 1: Make the PHP file look like an XML after loading it or 2: let it generate an external file. The first one is the better way if you change often data but dont have to many visitors. The option with the external file is a good option if you want to save database connections because you only ned to generate the XML file once you have changed some data. If you use the external XML file option, be sure that you have the write permission set on your webspace. After you generated your XML just make sure your XML loader class in your Actionscript project knows the path to the file. If you use the other option just add the path of the mysqlToXML.php in your Actionscript project.<br />
<a href="http://www.michaelfretz.com/wp-content/uploads/2009/08/mysqlToXML.zip">Download mysqlToXML.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelfretz.com/2009/08/20/xml-visualization-with-as30-tween-lite-mojofont-php-5-and-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
