<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Loading text files using the URLLoader class in ActionScript 3.0</title>
	<atom:link href="http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/feed/" rel="self" type="application/rss+xml" />
	<link>http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/</link>
	<description>A bunch of ActionScript 2.0 and ActionScript 3.0 examples*</description>
	<lastBuildDate>Thu, 22 Jul 2010 14:13:10 -0700</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Nancy</title>
		<link>http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/comment-page-1/#comment-613</link>
		<dc:creator>Nancy</dc:creator>
		<pubDate>Wed, 09 Dec 2009 14:21:45 +0000</pubDate>
		<guid isPermaLink="false">http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/#comment-613</guid>
		<description>I found your code to load an external text file  in actionscript 3.0. I am quite new to this but I did everything you mentioned in your post. As you can see below, here is my code.

First I have my imports at the top: 
	import flash.net.*;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.net.URLLoaderDataFormat;

Then i created the variables:

private var path:String = &quot;undergraduate.txt&quot;;
private var url:URLRequest = new URLRequest(path);
private var urlLoader:URLLoader = new URLLoader();

Then in my function to open a popup i inserted the following:

urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
urlLoader.addEventListener(Event.COMPLETE, urlloader_complete);
urlLoader.load(url);

here is the code for the entire function:

private function PopIt1(e:MouseEvent):void  {
			
			
			urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
			urlLoader.addEventListener(Event.COMPLETE, urlloader_complete);
			urlLoader.load(url);
			
			
			var h1:Object = new Object();
			h1.fontWeight = &quot;bold&quot;;
			h1.color = &quot;#000000&quot;;
			h1.fontSize = 20;
			h1.leading = 10;
			h1.fontFamily = &quot;Arial&quot;;
		


			var p:Object = new Object();
			p.fontWeight = &quot;bold&quot;;
			p.color = &quot;#000000&quot;;
			p.fontSize = 13;
			p.fontFamily = &quot;Arial&quot;;
			

			var style:StyleSheet = new StyleSheet();
			style.setStyle(&quot;h1&quot;, h1);
			style.setStyle(&quot;p&quot;, p);
		
			
			
			txtUndergradDescription = new TextField();
			
			txtUndergradDescription.x=10, txtUndergradDescription.y=13;
			txtUndergradDescription.width=550,txtUndergradDescription.height=300;
			txtUndergradDescription.wordWrap = true;
			txtUndergradDescription.selectable = true;
			txtUndergradDescription.styleSheet = style;
			
			txtUndergradDescription.htmlText = urlLoader;
			
			/*txtUndergradDescription.htmlText = &quot;Undergraduate Medical Education&quot;;
			txtUndergradDescription.htmlText = txtUndergradDescription.htmlText + &quot;Quisque non purus lectus. Curabitur at pellentesque quam. Donec suscipit leo sit amet magna sodales eu laoreet odio varius. Aliquam faucibus libero vitae sapien convallis imperdiet. Nunc lacinia justo in quam suscipit ac elementum sem sodales. Proin a euismod enim. Vestibulum vel dui quis libero adipiscing scelerisque at a massa. Nulla eleifend libero at ligula vulputate non porta lectus placerat. Maecenas sagittis gravida neque non tincidunt. Aenean nec diam justo. Nullam eu quam ligula. Quisque tristique tristique dui sodales elementum. Proin dictum interdum tincidunt. Fusce volutpat enim eu nisl sodales fringilla in non dolor. Praesent mauris risus, porttitor a semper nec, fermentum quis risus. Quisque iaculis luctus enim, sit amet lobortis mi sodales id. Duis lacus eros, feugiat id pulvinar a, tincidunt nec diam. Integer in metus orci. Donec id lacus arcu.&quot;;
			*/
			
			
			mc_pop1=new mcPopup();
			mc_pop1.x=0.6,mc_pop1.y=0.6;
			mc_pop1.width=573.5,mc_pop1.height=248.8;
			
			TransitionManager.start(mc_pop1, {type:Zoom, direction:Transition.IN, duration:1, easing:Bounce.easeOut});
			
			addChild(mc_pop1);
			mc_pop1.addChild(txtUndergradDescription);
			
		}

Than I added the your function called urlloader_complete: 

	private function urlloader_complete(evt:Event):void {
			
			txtUndergradDescription.text = urlLoader;
			
		}

And it keeps giving me the type was not found or was not a compile-time constant : Event

Seems to me it does not recognize Event

I tried to put MouseEvent instead

And then I get this error:

1067: Implicit coercion of a value of type flash.net:URLLoader to an unrelated type String.

What am I doing wrong?

I really am confused, perhaps it is just a stupid thing, but I can&#039;t figure it out.</description>
		<content:encoded><![CDATA[<p>I found your code to load an external text file  in actionscript 3.0. I am quite new to this but I did everything you mentioned in your post. As you can see below, here is my code.</p>
<p>First I have my imports at the top:<br />
	import flash.net.*;<br />
	import flash.net.URLLoader;<br />
	import flash.net.URLRequest;<br />
	import flash.net.URLLoaderDataFormat;</p>
<p>Then i created the variables:</p>
<p>private var path:String = &#8220;undergraduate.txt&#8221;;<br />
private var url:URLRequest = new URLRequest(path);<br />
private var urlLoader:URLLoader = new URLLoader();</p>
<p>Then in my function to open a popup i inserted the following:</p>
<p>urlLoader.dataFormat = URLLoaderDataFormat.TEXT;<br />
urlLoader.addEventListener(Event.COMPLETE, urlloader_complete);<br />
urlLoader.load(url);</p>
<p>here is the code for the entire function:</p>
<p>private function PopIt1(e:MouseEvent):void  {</p>
<p>			urlLoader.dataFormat = URLLoaderDataFormat.TEXT;<br />
			urlLoader.addEventListener(Event.COMPLETE, urlloader_complete);<br />
			urlLoader.load(url);</p>
<p>			var h1:Object = new Object();<br />
			h1.fontWeight = &#8220;bold&#8221;;<br />
			h1.color = &#8220;#000000&#8243;;<br />
			h1.fontSize = 20;<br />
			h1.leading = 10;<br />
			h1.fontFamily = &#8220;Arial&#8221;;</p>
<p>			var p:Object = new Object();<br />
			p.fontWeight = &#8220;bold&#8221;;<br />
			p.color = &#8220;#000000&#8243;;<br />
			p.fontSize = 13;<br />
			p.fontFamily = &#8220;Arial&#8221;;</p>
<p>			var style:StyleSheet = new StyleSheet();<br />
			style.setStyle(&#8220;h1&#8243;, h1);<br />
			style.setStyle(&#8220;p&#8221;, p);</p>
<p>			txtUndergradDescription = new TextField();</p>
<p>			txtUndergradDescription.x=10, txtUndergradDescription.y=13;<br />
			txtUndergradDescription.width=550,txtUndergradDescription.height=300;<br />
			txtUndergradDescription.wordWrap = true;<br />
			txtUndergradDescription.selectable = true;<br />
			txtUndergradDescription.styleSheet = style;</p>
<p>			txtUndergradDescription.htmlText = urlLoader;</p>
<p>			/*txtUndergradDescription.htmlText = &#8220;Undergraduate Medical Education&#8221;;<br />
			txtUndergradDescription.htmlText = txtUndergradDescription.htmlText + &#8220;Quisque non purus lectus. Curabitur at pellentesque quam. Donec suscipit leo sit amet magna sodales eu laoreet odio varius. Aliquam faucibus libero vitae sapien convallis imperdiet. Nunc lacinia justo in quam suscipit ac elementum sem sodales. Proin a euismod enim. Vestibulum vel dui quis libero adipiscing scelerisque at a massa. Nulla eleifend libero at ligula vulputate non porta lectus placerat. Maecenas sagittis gravida neque non tincidunt. Aenean nec diam justo. Nullam eu quam ligula. Quisque tristique tristique dui sodales elementum. Proin dictum interdum tincidunt. Fusce volutpat enim eu nisl sodales fringilla in non dolor. Praesent mauris risus, porttitor a semper nec, fermentum quis risus. Quisque iaculis luctus enim, sit amet lobortis mi sodales id. Duis lacus eros, feugiat id pulvinar a, tincidunt nec diam. Integer in metus orci. Donec id lacus arcu.&#8221;;<br />
			*/</p>
<p>			mc_pop1=new mcPopup();<br />
			mc_pop1.x=0.6,mc_pop1.y=0.6;<br />
			mc_pop1.width=573.5,mc_pop1.height=248.8;</p>
<p>			TransitionManager.start(mc_pop1, {type:Zoom, direction:Transition.IN, duration:1, easing:Bounce.easeOut});</p>
<p>			addChild(mc_pop1);<br />
			mc_pop1.addChild(txtUndergradDescription);</p>
<p>		}</p>
<p>Than I added the your function called urlloader_complete: </p>
<p>	private function urlloader_complete(evt:Event):void {</p>
<p>			txtUndergradDescription.text = urlLoader;</p>
<p>		}</p>
<p>And it keeps giving me the type was not found or was not a compile-time constant : Event</p>
<p>Seems to me it does not recognize Event</p>
<p>I tried to put MouseEvent instead</p>
<p>And then I get this error:</p>
<p>1067: Implicit coercion of a value of type flash.net:URLLoader to an unrelated type String.</p>
<p>What am I doing wrong?</p>
<p>I really am confused, perhaps it is just a stupid thing, but I can&#8217;t figure it out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/comment-page-1/#comment-546</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sat, 27 Jun 2009 14:40:07 +0000</pubDate>
		<guid isPermaLink="false">http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/#comment-546</guid>
		<description>Very useful thanks!</description>
		<content:encoded><![CDATA[<p>Very useful thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/comment-page-1/#comment-491</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sun, 19 Apr 2009 23:08:27 +0000</pubDate>
		<guid isPermaLink="false">http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/#comment-491</guid>
		<description>this is braindead!</description>
		<content:encoded><![CDATA[<p>this is braindead!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ali Rathore</title>
		<link>http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/comment-page-1/#comment-488</link>
		<dc:creator>Ali Rathore</dc:creator>
		<pubDate>Thu, 16 Apr 2009 11:49:19 +0000</pubDate>
		<guid isPermaLink="false">http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/#comment-488</guid>
		<description>b1.addEventListener(MouseEvent.MOUSE_UP,fetchData); 
function fetchData(event:Event):void { 

// ActionScript 3.0
var PATH:String = &quot;Vision.txt&quot;;
var urlRequest:URLRequest = new URLRequest(PATH);
var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.TEXT; // default
urlLoader.addEventListener(Event.COMPLETE, urlLoader_complete);
urlLoader.load(urlRequest);
 
function urlLoader_complete():void {
    this.txt.text = urlLoader.data;
}

}

it gives the error

TypeError: Error #1010: A term is undefined and has no properties.
	at MethodInfo-1()
	at flash.events::EventDispatcher/dispatchEventFunction()
	at flash.events::EventDispatcher/dispatchEvent()
	at flash.net::URLLoader/onComplete()</description>
		<content:encoded><![CDATA[<p>b1.addEventListener(MouseEvent.MOUSE_UP,fetchData);<br />
function fetchData(event:Event):void { </p>
<p>// ActionScript 3.0<br />
var PATH:String = &#8220;Vision.txt&#8221;;<br />
var urlRequest:URLRequest = new URLRequest(PATH);<br />
var urlLoader:URLLoader = new URLLoader();<br />
urlLoader.dataFormat = URLLoaderDataFormat.TEXT; // default<br />
urlLoader.addEventListener(Event.COMPLETE, urlLoader_complete);<br />
urlLoader.load(urlRequest);</p>
<p>function urlLoader_complete():void {<br />
    this.txt.text = urlLoader.data;<br />
}</p>
<p>}</p>
<p>it gives the error</p>
<p>TypeError: Error #1010: A term is undefined and has no properties.<br />
	at MethodInfo-1()<br />
	at flash.events::EventDispatcher/dispatchEventFunction()<br />
	at flash.events::EventDispatcher/dispatchEvent()<br />
	at flash.net::URLLoader/onComplete()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roshan</title>
		<link>http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/comment-page-1/#comment-400</link>
		<dc:creator>Roshan</dc:creator>
		<pubDate>Wed, 04 Mar 2009 05:05:30 +0000</pubDate>
		<guid isPermaLink="false">http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/#comment-400</guid>
		<description>Hi Peter,

  Thanks for the example. It worked and I&#039;m modifying the code for advanced text search. 

Regards,
Roshan</description>
		<content:encoded><![CDATA[<p>Hi Peter,</p>
<p>  Thanks for the example. It worked and I&#8217;m modifying the code for advanced text search. </p>
<p>Regards,<br />
Roshan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bhavya Technologies</title>
		<link>http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/comment-page-1/#comment-376</link>
		<dc:creator>Bhavya Technologies</dc:creator>
		<pubDate>Sun, 08 Feb 2009 17:54:14 +0000</pubDate>
		<guid isPermaLink="false">http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/#comment-376</guid>
		<description>What is the content should be there in &quot;lorem.txt&quot; file.

&lt;a href=&quot;http://www.bhavyatechnologies.com&quot; rel=&quot;nofollow&quot;&gt;website design hyderabad&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>What is the content should be there in &#8220;lorem.txt&#8221; file.</p>
<p><a href="http://www.bhavyatechnologies.com" rel="nofollow">website design hyderabad</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mitch</title>
		<link>http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/comment-page-1/#comment-334</link>
		<dc:creator>Mitch</dc:creator>
		<pubDate>Wed, 07 Jan 2009 05:14:21 +0000</pubDate>
		<guid isPermaLink="false">http://actionscriptexamples.com/2008/02/26/loading-text-files-using-the-urlloader-class-in-actionscript-30/#comment-334</guid>
		<description>okay, so how can i get the urlLoader.data into a variable for use in other functions? this problem has been bugging me for ~6 hours.</description>
		<content:encoded><![CDATA[<p>okay, so how can i get the urlLoader.data into a variable for use in other functions? this problem has been bugging me for ~6 hours.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
