<?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>manewc &#187; Flash Text / HTML / CSS</title>
	<atom:link href="http://manewc.com/category/flash-text/feed/" rel="self" type="application/rss+xml" />
	<link>http://manewc.com</link>
	<description>iPhone, Flash, Flex, AIR, &#38; Web Development</description>
	<lastBuildDate>Sat, 31 Oct 2009 16:47:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>[AS 3] Function for Creating Text Fields</title>
		<link>http://manewc.com/2008/03/10/as-3-function-for-creating-text-fields/</link>
		<comments>http://manewc.com/2008/03/10/as-3-function-for-creating-text-fields/#comments</comments>
		<pubDate>Mon, 10 Mar 2008 17:52:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flash Text / HTML / CSS]]></category>

		<guid isPermaLink="false">http://manewc.com/2008/03/10/as-3-function-for-creating-text-fields/</guid>
		<description><![CDATA[Nothing exciting today as I am getting sidetracked with another web project. Anyways I found this nice little function for creating text fields over at Adobe. I thought I would just add it here to my Actionscript library.

private function createTextField(x:Number, y:Number, width:Number, height:Number,border:Boolean=false):TextField {
            [...]]]></description>
			<content:encoded><![CDATA[<p>Nothing exciting today as I am getting sidetracked with another web project. Anyways I found this nice little function for creating text fields over at Adobe. I thought I would just add it here to my Actionscript library.</p>
<pre name="code" class="c-sharp">
private function createTextField(x:Number, y:Number, width:Number, height:Number,border:Boolean=false):TextField {
            var result:TextField = new TextField();
            result.x = x;
            result.y = y;
            result.width = width;
            result.height = height;
            result.background = false;
            result.border = border;
            addChild(result);
            return result;
        }</pre>
<p>You can call the function like:</p>
<pre name="code" class="c-sharp">
var myTxt:TextField = createTextField(10, 10, 100, 20, false);
myTxt.type = TextFieldType.DYNAMIC; // or TextFieldType.INPUT
myTxt.text = "Here is some random text";</pre>
<p>This will place a 100px (w) x 20px (h) text field at location x=100 and y=20 and will render without a border.</p>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/03/10/as-3-function-for-creating-text-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[AS 3] Loading an External .HTML File</title>
		<link>http://manewc.com/2008/03/07/as-3-loading-an-external-html-file/</link>
		<comments>http://manewc.com/2008/03/07/as-3-loading-an-external-html-file/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 18:52:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flash Text / HTML / CSS]]></category>

		<guid isPermaLink="false">http://manewc.com/2008/03/07/as-3-loading-an-external-html-file/</guid>
		<description><![CDATA[A little snippet of code to pull in an html file and place the html content to a text field.

package
{
	import flash.display.Sprite;
	import flash.text.*;
	import flash.net.*;
	import flash.events.*;

	public class loadHTML extends Sprite
	{
		private var txtField:TextField;
		private var HTMLData:String;
		private var myHTMLFile:URLLoader;

		public function loadHTML()
		{
			myHTMLFile = new URLLoader();
			myHTMLFile.addEventListener(Event.COMPLETE, onLoadHTML, false, 0, true);
			myHTMLFile.addEventListener(IOErrorEvent.IO_ERROR, ioError, false, 0, true);
			myHTMLFile.load(new URLRequest("/path/to/html/file"));
		}

		private function onLoadHTML(e:Event):void
		{
			HTMLData = e.target.data;
			initTextField();
		}

		private function initTextField():void
		{
			txtField = [...]]]></description>
			<content:encoded><![CDATA[<p>A little snippet of code to pull in an html file and place the html content to a text field.</p>
<pre name="code" class="c-sharp">
package
{
	import flash.display.Sprite;
	import flash.text.*;
	import flash.net.*;
	import flash.events.*;

	public class loadHTML extends Sprite
	{
		private var txtField:TextField;
		private var HTMLData:String;
		private var myHTMLFile:URLLoader;

		public function loadHTML()
		{
			myHTMLFile = new URLLoader();
			myHTMLFile.addEventListener(Event.COMPLETE, onLoadHTML, false, 0, true);
			myHTMLFile.addEventListener(IOErrorEvent.IO_ERROR, ioError, false, 0, true);
			myHTMLFile.load(new URLRequest("/path/to/html/file"));
		}

		private function onLoadHTML(e:Event):void
		{
			HTMLData = e.target.data;
			initTextField();
		}

		private function initTextField():void
		{
			txtField = new TextField();
			txtField.x = txtField.y = 20;
			txtField.width = stage.stageWidth;
			txtField.multiline = true;
			txtField.wordWrap = true;
			txtField.autoSize = TextFieldAutoSize.LEFT;
			txtField.selectable = false;
			txtField.htmlText = HTMLData;

			addChild(txtField);

			myHTMLFile.removeEventListener(Event.COMPLETE, onLoadHTML);
			myHTMLFile.removeEventListener(IOErrorEvent.IO_ERROR, ioError);
		}

		private function ioError(e:IOErrorEvent):void
		{
			trace ("Error: File " + e.text + " could not be loaded");
		}
	}
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/03/07/as-3-loading-an-external-html-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[AS 3] CSS and Flash: Adding Styles to a Text Field</title>
		<link>http://manewc.com/2008/03/06/as-3-css-and-flash-adding-styles-to-a-text-field/</link>
		<comments>http://manewc.com/2008/03/06/as-3-css-and-flash-adding-styles-to-a-text-field/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 13:56:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flash Text / HTML / CSS]]></category>

		<guid isPermaLink="false">http://manewc.com/2008/03/06/as-3-css-and-flash-adding-styles-to-a-text-field/</guid>
		<description><![CDATA[I thought it was interesting that we could add some CSS to the content in our Flash movies. Although there aren&#8217;t a lot of  styles that can be applied, the basic styles are applicable. Here is a little demo of adding styles to html tags and CSS classes.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_FlashCSS_183550946"
			class="flashmovie"
			width="600"
			height="200">
	<param name="movie" value="/projects/flash/FlashCSS/FlashCSS.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flash/FlashCSS/FlashCSS.swf"
			name="fm_FlashCSS_183550946"
			width="600"
			height="200">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
Here is the [...]]]></description>
			<content:encoded><![CDATA[<p>I thought it was interesting that we could add some CSS to the content in our Flash movies. Although there aren&#8217;t a lot of  styles that can be applied, the basic styles are applicable. Here is a little demo of adding styles to html tags and CSS classes.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_FlashCSS_107186392"
			class="flashmovie"
			width="600"
			height="200">
	<param name="movie" value="/projects/flash/FlashCSS/FlashCSS.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flash/FlashCSS/FlashCSS.swf"
			name="fm_FlashCSS_107186392"
			width="600"
			height="200">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Here is the document class:</p>
<pre name="code" class="c-sharp">
package
{
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFieldType;
	import flash.text.StyleSheet;

	public class FlashCSS extends Sprite
	{
		private var css:StyleSheet;
		private var body:Object;
		private var headerOne:Object;
		private var headerTwo:Object;
		private var paragraph:Object;
		private var myTextField:TextField;

		public function FlashCSS()
		{
			var css:StyleSheet = new StyleSheet();

			// create the styles
			var body:Object = new Object();
			body.fontFamily = "Arial";

			var headerOne:Object = new Object();
			headerOne.fontSize = 20;
			headerOne.fontWeight = "bold";
			headerOne.color = "#336699";
			headerOne.leading = 12;

			var headerTwo:Object = new Object();
			headerTwo.fontSize = 16;
			headerTwo.color = "#333333";

			var paragraph:Object = new Object();
			paragraph.color = "#000000";

			// set the styles
			css.setStyle("body", body);
			css.setStyle(".headerOne", headerOne);
			css.setStyle(".headerTwo", headerTwo);
			css.setStyle(".paragraph", paragraph);

			// generate the text field
            var myTextField:TextField = new TextField();
            myTextField.autoSize = TextFieldAutoSize.LEFT;
            myTextField.multiline = true;
			myTextField.width = stage.stageWidth;
			myTextField.wordWrap = true;

			// THIS IS IMPORTANT HERE TO CALL THE CSS BEFORE YOU PPO
			myTextField.styleSheet = css;

            myTextField.htmlText = "&lt;body&gt;";
			myTextField.htmlText += "<span class="headerOne">Welcome To My Site</span>";
			myTextField.htmlText += "<span class="headerTwo">Here Is My Subtitle</span>

";
			myTextField.htmlText += "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus varius eleifend tellus. Suspendisse potenti. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nulla facilisi. Sed wisi lectus, placerat nec, mollis quis, posuere eget, arcu.

";
			myTextField.htmlText += "Donec euismod. Praesent mauris mi, adipiscing non, mollis eget, adipiscing ac, erat. Integer nonummy mauris sit amet metus. In adipiscing, ligula ultrices dictum vehicula, eros turpis lacinia libero, sed aliquet urna diam sed tellus. Etiam semper sapien eget metus.";
			myTextField.htmlText += "&lt;/body&gt;";

			addChild(myTextField);
		}
	}
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/03/06/as-3-css-and-flash-adding-styles-to-a-text-field/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>[AS 3] Text Links calling Actionscript Functions</title>
		<link>http://manewc.com/2008/03/04/as-3-text-links-calling-actionscript-functions/</link>
		<comments>http://manewc.com/2008/03/04/as-3-text-links-calling-actionscript-functions/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 13:38:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flash Text / HTML / CSS]]></category>

		<guid isPermaLink="false">http://manewc.com/2008/03/04/as-3-text-links-calling-actionscript-functions/</guid>
		<description><![CDATA[In this demo I have utilized the Button and the Yahoo! AlertManager component. I simply created a textfield in the upper left corner with an html anchor tag that calls a function within the Actionscript code.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_TextHTMLLinks_1556312698"
			class="flashmovie"
			width="600"
			height="200">
	<param name="movie" value="/projects/flash/TextHTMLLinks/TextHTMLLinks.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flash/TextHTMLLinks/TextHTMLLinks.swf"
			name="fm_TextHTMLLinks_1556312698"
			width="600"
			height="200">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
Here is my Document Class file TextHTMLLinks.as:

package
{
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFieldType;
	import flash.text.TextFormat;
	import flash.events.TextEvent;
	import com.yahoo.astra.fl.managers.AlertManager;
   [...]]]></description>
			<content:encoded><![CDATA[<p>In this demo I have utilized the Button and the Yahoo! AlertManager component. I simply created a textfield in the upper left corner with an html anchor tag that calls a function within the Actionscript code.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_TextHTMLLinks_805753625"
			class="flashmovie"
			width="600"
			height="200">
	<param name="movie" value="/projects/flash/TextHTMLLinks/TextHTMLLinks.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flash/TextHTMLLinks/TextHTMLLinks.swf"
			name="fm_TextHTMLLinks_805753625"
			width="600"
			height="200">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Here is my Document Class file TextHTMLLinks.as:</p>
<pre name="code" class="c-sharp">
package
{
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFieldType;
	import flash.text.TextFormat;
	import flash.events.TextEvent;
	import com.yahoo.astra.fl.managers.AlertManager;
    import fl.events.ComponentEvent;
	import flash.events.MouseEvent;

	public class TextHTMLLinks extends Sprite
	{
		private var myFormat:TextFormat;
		private var myTextField:TextField;

		public function TextHTMLLinks():void
		{
			// format the text
			var myFormat:TextFormat = new TextFormat();
			myFormat.size = 16;
			myFormat.font = "Arial";
			myFormat.color = 0xffffff;

			// create the text field and add the link
			var myTextField:TextField = new TextField();
			myTextField.autoSize = TextFieldAutoSize.LEFT;
			myTextField.multiline = true;
			myTextField.defaultTextFormat = myFormat;
			myTextField.htmlText = "

<strong>Here is my title</strong>

";
			myTextField.htmlText += "

<font color="#336699"><a href="http://manewc.com/wp-admin/event:alert">Click here</a></font> for the alert box

";

			// add the listener for the link
			myTextField.addEventListener(TextEvent.LINK, clickLink);

			// add the object to the stage
			addChild(myTextField);
		}

		private function clickLink(e:TextEvent):void
		{
			if (e.text == "alert")
			{
				AlertManager.createAlert(this, "Here is my message", "My Title: Alert Box",["close alert"]);
			}
		}
	}

}</pre>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/03/04/as-3-text-links-calling-actionscript-functions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
