-
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! ;]
-
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.COMPLETE, getHTML, false, 0, true); 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.
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|