How to Import an HTML Into a Flash Movie With AS3

The ActionScript 3 "URLLoader" class imports HTML from a website into your Flash animation. ActionScript lets you create dynamic Flash SWF projects, so you can use this language to set up websites that use Flash to interact with users. The URLLoader class opens the Web page and reads its content. Display the content in your animation file, or use the content for other string manipulation processes.

Instructions

    • 1

      Launch the ActionScript editor, then open your Flash project.

    • 2

      Double-click the code file you want to use to import the HTML content. Create and instantiate a URLLoader class variable. The following code instantiates the class:

      var html:URLLoader = new URLLoader();

    • 3

      Open the HTML page you want to import. The following code imports the "index.html" page from a domain named "mysite":

      var content:URLRequest = new URLRequest(“http://mysite.com/index.html”);

      Replace "mysite.com" and page name in the URL with your own website domain and file name.

    • 4

      Display content to the user using a text box. The following code creates a text box and adds the content to it:

      var importedText:TextField = new TextField();
      importedText.Text = content;

Related Searches:

References

Comments

Related Ads

Featured