dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: how to load HTML file

  1. #1
    Junior Member
    Join Date
    Oct 2008
    Posts
    20

    how to load HTML file

    Hi,
    I'm trying to load HTML file but unfortunately I can see only text not images or another elements from this file. Can someone help me with that.
    In html file I have complete path to objects.
    This is my code:

    myHTMLFile = new URLLoader();
    myHTMLFile.addEventListener(Event.COMPLETE, onLoadHTML, false, 0, true);
    myHTMLFile.load(new URLRequest("path_to_file"));
    .
    .
    .
    function onLoadHTML(e:Event):void {
    HTMLData = e.target.data;
    initTextField();
    }

    function initTextField():void {
    txtField = new TextField();
    txtField.x = txtField.y = 50;
    txtField.width = stage.stageWidth;
    txtField.multiline = true;
    txtField.wordWrap = true;
    txtField.autoSize = TextFieldAutoSize.LEFT;
    txtField.selectable = false;
    txtField.htmlText = HTMLData;

    html_container.addChild(txtField);
    myHTMLFile.removeEventListener(Event.COMPLETE, onLoadHTML);
    }

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    The htmlText of a TextField only supports a very limited subset of html. There is no complete solution for embedding a full html page in flash. There are a few projects which are working towards that goal, but generally, you will be better off bringing up an actual html window or div for that content.

    Some flash projects for rendering full html:
    http://code.google.com/p/htmlwrapper/
    http://code.google.com/p/as3cannonball/
    http://as3htmlparser.sourceforge.net/

  3. #3
    Junior Member
    Join Date
    Oct 2008
    Posts
    20
    It's not something what I expected but thank you for reply.

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