dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Generating random string off a hyperlink?

  1. #1
    Junior Member
    Join Date
    Nov 2010
    Posts
    4

    Generating random string off a hyperlink?

    So anyways,
    I have this hyperlink, but I want the program to look through the hyperlinked page and pick out random words within a certain perameter. So like, it has to have a noun, verb, and pretty much end up a normal sentence that is completely out of context. Something like, "The doppler effect enjoys pine needles in the cornfield."

    Is it even possible to get that? Can you even generate random string off a hyperlink? Can actionscript even browse through a hyperlinked file?

    Any help would be greatly appreciated, thank you! ;]

  2. #2
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    your question is a little unclear. i'll answer what i can.

    1. "can actionscript even browse through a hyperlinked file" - not sure what you mean by that, but you can load the html of a file using a URLLoader object with URLRequest:

    PHP Code:
    var request:URLRequest = new URLRequest("my-file.html");
    var 
    loader:URLLoader = new URLLoader();
    loader.addEventListener(Event.COMPLETEgetHTMLfalse0true);
    loader.load(request);
    function 
    getHTML(event:Event):void{
      
    trace(event.data);  // would trace the output of "my-file.html"

    2. Can actionscript pick out random words? Yes, but you need to supply the parameters of what you want to pick. You can use standard string methods (like indexOf and substr, slice, etc), or regular expressions. Regular expressions are used in a wide variety of programming languages, including AS3, and there are tons of tutorials on it.

    3. ActionScript - or any language, really - has no way of differentiating a noun from a verb, etc. You could potentially supply a dictionary of nouns and verbs, but this would likely be infeasible because of the amount of information you'd have to supply.

  3. #3
    Junior Member
    Join Date
    Nov 2010
    Posts
    4
    Thank you very very much! :] It's given me some line of thought to go from.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center