Select or create an HTML page to import into your Flash project. Name your HTML file "myhtmltestpage" for this example.
Start your Flash program. Select the "Actions" option from the "Window" menu on the main "Flash" menu bar.
Type the code to declare a "TextField" object in the first line of the "Actions" editor. Use the name "displayText" for the "TextField" object. Type this first line of code as:
var displayText:TextField = new TextField();
Type the following statements on lines two and three in the "Actions" editor to set the width and height dimensions of the "displayText" TextField to 500 pixels:
displayText.width = 500;
displayText.height = 500;
Type the following line in the fourth line of the "Actions" editor to declare an object named "importFile" as a "URLLoader" object, an object that stores a file's contents:
var importFile:URLLoader = new URLLoader();
Declare a "URLRequest" object -- an object that requests a file to import in the fifth line of the "Actions" editor. Use the name "requestedFile" for the "URLRequest" object. Specify the file name parameter as "myhtmltestpage.html" for the "URLRequest" object. Type the code into the fifth line of the editor as follows:
var requestedFile: URLRequest = new URLRequest("myhtmltestpage.html");
Instruct the "URLLoader" object to import the HTML file specified in the "URLRequest object (requestedFile)." Type the sixth line of code into the Flash ActionScript code statement as follows:
importFile.load(requestedFile);
Attach an "Event.Complete" event listener to the loader, "importFile," as part of the "addEventListener" method. Name the event handler called in the "addEventListener" method "htmlloaded_fn." Type this code into the seventh line of the Actions editor:
importFile.addEventListener(Event.Complete, htmlloaded_fn);
Type the code of the event handler function, "htmlloaded_fn", so that the loaded file's data is placed into the "displayText" text field. Use the "load" data property of the "URLLoader" and the "htmlText" property of the "TextField" object. Type the Flash ActionScript code statements starting at line eight in the "Actions" editor as:
function htmlloaded_fn(event: Event):
void {displayText.htmlText = importFile.data;}
Use the "addChild" method with the "displayText" parameter to display the "displayText" "TextField" object. Type the next line of Actions code as "addChild(displayText)."
Select the "Save" option from the "File" menu on the main Flash menu bar. Name the file and save it in the same file directory that your HTML file is saved in.
Select the "TestMovie" option from the "Control" menu on the main Flash menu bar to play the movie and display the HTML rendered text.