<?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>Turtlebite&#039;s Blog &#187; textstyles</title>
	<atom:link href="http://blog.turtlebite.com/tag/textstyles/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.turtlebite.com</link>
	<description>Flash CMS Framework, Fleb Framework, Global Navigation and other ActionScript Stuff</description>
	<lastBuildDate>Wed, 04 Aug 2010 09:45:02 +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>How to use your own fonts and textstyles in the Flash CMS</title>
		<link>http://blog.turtlebite.com/how-to-use-your-own-fonts-and-textstyles-in-the-flash-cms/</link>
		<comments>http://blog.turtlebite.com/how-to-use-your-own-fonts-and-textstyles-in-the-flash-cms/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 19:16:22 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Flash CMS]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[embed fonts]]></category>
		<category><![CDATA[textstyles]]></category>

		<guid isPermaLink="false">http://www.flashcmsframework.com/?p=481</guid>
		<description><![CDATA[This first tutorial will cover a very basic requirement of the Flash CMS: defining different fonts and font styles. I assume you have downloaded and installed the Flash CMS and everything works fine so far. You&#8217;ve tested and played around with it and now want to take the next steps. Step 1: Embedding the fonts [...]]]></description>
			<content:encoded><![CDATA[<p>This first tutorial will cover a very basic requirement of the Flash CMS: defining different fonts and font styles.</p>
<p><img class="alignnone size-full wp-image-493" title="ownfonts" src="http://www.flashcmsframework.com/wp-content/uploads/ownfonts.jpg" alt="ownfonts" width="673" height="397" /></p>
<p><span id="more-481"></span></p>
<p>I assume you have <a href="http://www.flashcmsframework.com/docs/doku.php?id=flash_cms_installation">downloaded and installed</a> the Flash CMS and everything works fine so far. You&#8217;ve tested and played around with it and now want to take the next steps.</p>
<p><strong>Step 1: Embedding the fonts</strong></p>
<ol>
<li>Open &#8220;fonts.fla&#8221; in Flash.</li>
<li>Open the library: you see 2 fonts already defined: &#8220;_myfont1&#8243; and &#8220;_myfont2&#8243;. You are going to owerwrite these 2 and create a third, new font.</li>
<li>In the library, create a new font. Name it &#8220;_myfont3&#8243;. (Note: The CMS will refer to these names. You can define up to 15 different fonts: &#8220;_myfont1&#8243; to &#8220;_myfont15&#8243;).</li>
<li>Open &#8220;_myfont1&#8243; in the library and choose any font you like. Be sure your export settings are the same as in the screenshot. Repeat these steps for &#8220;_myfont2&#8243; and &#8220;_myfont3&#8243; with different fonts.</li>
</ol>
<p><strong><img class="alignnone size-full wp-image-483" title="font_export" src="http://www.flashcmsframework.com/wp-content/uploads/font_export.jpg" alt="font_export" width="560" height="490" /></strong></p>
<p><strong>Step 2: Defining textstyles</strong></p>
<ol>
<li> Now open frame 1 (&#8220;setup&#8221;) in the actions panel to edit it.</li>
<li>At the top you can see the styles for hyperlinks. Change it if you like (different colours and decorations).</li>
<li>Next, you can find an array &#8220;_level0.testFontStyle&#8221;. Leave the name for now. There are 3 styles defined: &#8220;Body&#8221;, &#8220;Body bold&#8221; and &#8220;Headline&#8221;. These are the names the user sees and can choose from in the CMS.</li>
</ol>
<p>Now, type in the fontnames you have embedded. I have used these fonts: &#8220;Bumblebee&#8221; (_myfont1), &#8220;JanicesHand&#8221; (_myfont2) and &#8220;Gadget&#8221; (_myfont3). <strong> </strong></p>
<p>Here the code after all changes:</p>
<pre class="brush: php;">
_level0.testLinkStyle = new TextField.StyleSheet();
_level0.testLinkStyle.setStyle("a:link",{color:"#24A831", textDecoration:"underline"});
_level0.testLinkStyle.setStyle("a:hover",{color:"#177120", textDecoration:"none"});
// --------------------------------------------
_level0.testFontStyle = [];
// --------------------------------------------
f = {};
f.styleName = "Body";
f.font = "_myfont3";
f.size = 12;
f.color = 0x000000;
_level0.testFontStyle.push(f);
// --------------------------------------------
f = {};
f.styleName = "Handwriting in red";
f.font = "_myfont2";
f.size = 15;
f.color = 0x990000;
_level0.testFontStyle.push(f);
// --------------------------------------------
f = {};
f.styleName = "bigger Handwr. in blue";
f.font = "_myfont2";
f.size = 20;
f.color = 0x003399;
_level0.testFontStyle.push(f);
// --------------------------------------------
f = {};
f.styleName = "HUGE Handwr.in pink";
f.font = "_myfont2";
f.size = 45;
f.color = 0xD906F0;
_level0.testFontStyle.push(f);
// --------------------------------------------
f = {};
f.styleName = "The bubble Bumblebees";
f.font = "_myfont1";
f.size = 22;
f.color = 0x003333;
_level0.testFontStyle.push(f);
</pre>
<p><strong>Step 3: Export fonts.swf and upload it to the server</strong></p>
<ol>
<li>Export fonts.swf for (ActionScript 2!) and upload it into the folder &#8220;login&#8221; on your server.</li>
</ol>
<p>Login the CMS and test it. It should look similar to this (of course with your chosen fonts).</p>
<p><img class="alignnone size-full wp-image-491" title="texteditor" src="http://www.flashcmsframework.com/wp-content/uploads/texteditor.jpg" alt="texteditor" width="536" height="308" /><br />
<strong>Step 4: Create the FLA that loads this content</strong></p>
<p>First, we will create the &#8220;fonts_as3.swf&#8221;. In this SWF the fonts are embedded for global use all over your website. Create 3 fonts in the library with the settings as shown in this screenshot below.</p>
<p><img class="alignnone size-full wp-image-506" title="fonts_as3" src="http://www.flashcmsframework.com/wp-content/uploads/fonts_as3.jpg" alt="fonts_as3" width="546" height="429" /></p>
<p><strong>Step 6: Register the fonts in AS3</strong></p>
<pre class="brush: php;">

Font.registerFont(_myfont1);
Font.registerFont(_myfont2);
Font.registerFont(_myfont3);

import net.kaegi.utils.VarCentral;
var fonts:Array = [];
fonts[0] = ["_myfont1","Bumblebee"];
fonts[1] = ["_myfont2","JanicesHand Regular"];
fonts[2] = ["_myfont3","Gadget"];
VarCentral.getInstance().vars.fontsForCMS = fonts;
</pre>
<p>In the code above you can see that I use a little class, &#8220;VarCentral&#8221;. This comes in very handy if you want to store any variables in a central place because you may need them somewhere else in your site. It&#8217;s up to you to also use this or do the handling of global vars in your preferred way. The array &#8220;fonts&#8221; will later be used to replace all occurences of &#8220;_myfontX&#8221; in the html textfields of the CMS with the corresponding real fonts. This method is very useful, because you are able to change fonts without disturbing the saved html text.</p>
<p><strong>Step 7: Create the SWF that loads the CMS slots</strong></p>
<p><a href="http://www.flashcmsframework.com/downloads/turtlebite_flash_cms_example_embed_fonts.zip">Please download this FLAs</a>. I have commented everything so it should be self-explanatory. It also contains the font_as3.fla. Note that you may have to adjust it to your own fonts.</p>
<p>Below just a reminder that the Flash CMS backend is written in AS2 and your website is written in AS3:</p>
<p><img class="alignnone size-full wp-image-509" title="fonts_as2_as3.001" src="http://www.flashcmsframework.com/wp-content/uploads/fonts_as2_as3.001.jpg" alt="fonts_as2_as3.001" width="536" height="242" /></p>
<p>.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://blog.turtlebite.com/how-to-use-your-own-fonts-and-textstyles-in-the-flash-cms/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://blog.turtlebite.com/how-to-use-your-own-fonts-and-textstyles-in-the-flash-cms/&amp;title=How+to+use+your+own+fonts+and+textstyles+in+the+Flash+CMS" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.turtlebite.com/how-to-use-your-own-fonts-and-textstyles-in-the-flash-cms/&amp;title=How+to+use+your+own+fonts+and+textstyles+in+the+Flash+CMS" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-diigo">
			<a href="http://www.diigo.com/post?url=http://blog.turtlebite.com/how-to-use-your-own-fonts-and-textstyles-in-the-flash-cms/&amp;title=How+to+use+your+own+fonts+and+textstyles+in+the+Flash+CMS&amp;desc=This%20first%20tutorial%20will%20cover%20a%20very%20basic%20requirement%20of%20the%20Flash%20CMS%3A%20defining%20different%20fonts%20and%20font%20styles.%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0AI%20assume%20you%20have%20downloaded%20and%20installed%20the%20Flash%20CMS%20and%20everything%20works%20fine%20so%20far.%20You%27ve%20tested%20and%20played%20around%20with%20it%20and%20now%20want%20to%20take%20the%20next%20steps.%0D%0A%0D%0ASt" rel="nofollow" class="external" title="Post this on Diigo">Post this on Diigo</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://blog.turtlebite.com/how-to-use-your-own-fonts-and-textstyles-in-the-flash-cms/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-misterwong">
			<a href="http://www.mister-wong.com/addurl/?bm_url=http://blog.turtlebite.com/how-to-use-your-own-fonts-and-textstyles-in-the-flash-cms/&amp;bm_description=How+to+use+your+own+fonts+and+textstyles+in+the+Flash+CMS&amp;plugin=sexybookmarks" rel="nofollow" class="external" title="Add this to Mister Wong">Add this to Mister Wong</a>
		</li>
		<li class="shr-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://blog.turtlebite.com/how-to-use-your-own-fonts-and-textstyles-in-the-flash-cms/&amp;title=How+to+use+your+own+fonts+and+textstyles+in+the+Flash+CMS" rel="nofollow" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://blog.turtlebite.com/how-to-use-your-own-fonts-and-textstyles-in-the-flash-cms/&amp;title=How+to+use+your+own+fonts+and+textstyles+in+the+Flash+CMS" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.turtlebite.com/how-to-use-your-own-fonts-and-textstyles-in-the-flash-cms/&amp;title=How+to+use+your+own+fonts+and+textstyles+in+the+Flash+CMS" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://blog.turtlebite.com/how-to-use-your-own-fonts-and-textstyles-in-the-flash-cms/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=How+to+use+your+own+fonts+and+textstyles+in+the+Flash+CMS+-+http://b2l.me/afrdnn&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://blog.turtlebite.com/how-to-use-your-own-fonts-and-textstyles-in-the-flash-cms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
