1 Replies - 13647 Views - Last Post: 24 June 2012 - 03:28 PM

#1 bdmullin   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 15-April 11

Can not figure out how to use urlloader correctly.

Posted 11 June 2012 - 07:46 PM

Hey guys, I am new to AS3 (actually developing mobile apps with flex in Flash Builder) and when I say new I mean a few days. I wrote a program in C# and want to turn it into a mobile app in flash builder. The part where I am struggling is grabbing the source html of a website and turning that into a string so I can search it for links. In C# the code I have is:
1	System.Net.WebClient webClient = new System.Net.WebClient();
2	string strSource = webClient.DownloadString(URL);
3	webClient.Dispose();
4	return strSource;

I have been reading about urlloader and urlrequest but not able to put anything together yet.

Is This A Good Question/Topic? 0
  • +

Replies To: Can not figure out how to use urlloader correctly.

#2 denting5   User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 84
  • Joined: 03-June 12

Re: Can not figure out how to use urlloader correctly.

Posted 24 June 2012 - 03:28 PM

The basics of URLLoader:
1. Create a text document, and put it in the same directory as your FLA file
2. The following is the code you need for the FLA file (where your text document is called document)
var myTextLoader:URLLoader = new URLLoader();

myTextLoader.addEventListener(Event.COMPLETE, onloaded);

function onloaded(e:Event):void {

myTextLoader.load(new URLRequest("document.txt"));

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1