Welcome to Dream.In.Code
Getting Help is Easy!

Join 117,610 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,963 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Action Script 3

 
Reply to this topicStart new topic

Action Script 3, how to load dynamic text with the push of a button

oskarubio
post 9 Jun, 2008 - 04:17 PM
Post #1


New D.I.C Head

*
Joined: 9 Jun, 2008
Posts: 1

var content_req:URLRequest = new URLRequest ("myTextFile.txt");
var content_ldr:URLLoader 0 new URLLoader(content_req);

content_ldr.addEventListener(Event.COMPLETE, onComplete);
function onComplete(event:Event):void
{
content_txt.text = event.target.data;
}
User is offlineProfile CardPM

Go to the top of the page


BetaWar
post 9 Jun, 2008 - 09:48 PM
Post #2


#include <soul.h>

Group Icon
Joined: 7 Sep, 2006
Posts: 1,569



Thanked 62 times

Dream Kudos: 975
My Contributions


Well, I haven't used AS3, but from looking at your code I think I see at least one error:

QUOTE
var content_req:URLRequest = new URLRequest ("myTextFile.txt");
var content_ldr:URLLoader 0 new URLLoader(content_req);

content_ldr.addEventListener(Event.COMPLETE, onComplete);
function onComplete(event:Event):void
{
content_txt.text = event.target.data;
}


Should look like:

CODE
var content_req:URLRequest = new URLRequest ("myTextFile.txt");
var content_ldr:URLLoader = new URLLoader(content_req);

content_ldr.addEventListener(Event.COMPLETE, onComplete);
function onComplete(event:Event):void
{
content_txt.text = event.target.data;
}


Hope that helps, though I wouldn't be suprised if it doesn't.

Here are 2 websites that may be able to help you out:
http://www.actionscript.org
http://www.kirupa.com
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/7/08 11:48PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month