Links are useful to lead the user to a destination. On this Flash ActionScript 3.0 High Definition (HD) tutorial we show how to embed links and HTML from a text file and make them clickable on a dynamic text box using the htmltext property in ActionScript.
HERE IS THE SOURCE CODE
//by AVRAHAM SALTOUN
// solutions at say-web dot com
// FREE TO USE AND DISTRIBUTE
/* To load text we will need to create
two variables:
1) URL Request – with text location
2) URL Loader, that will contain the text, after loading */
var req:URLRequest = new URLRequest(“Secret.txt”) ;
var loader:URLLoader = new URLLoader();
// We are supposing the TEXT file is in the same folder
//as the FLA File….
// The Loader Event Listener:
loader.addEventListener(Event.COMPLETE, fileLoaded);
/* This will fire after loading is complete, the
fileLoaded function, that we will soon create. */
loader.load(req);
//This will place the text into the loader.
function fileLoaded(event:Event):void {
// Let’s Append some text using the append text method
external_txt.htmlText= loader.data;
external_txt.appendText(” Here is my appended text !!”);
// Sweet and easy
// Thanks for watching!
}






27 Responses to “ActionScript 3.0 Video Lesson 25: Embedding Links and HTML on Flash”
Trackbacks/Pingbacks