View Full Version : want to display html file in swf
missileh
02-05-2009, 09:22 AM
Is there any way to display an html file inside an swf?
daveystew
02-05-2009, 10:11 AM
You could use AIR to faithfully display an HTML Page, or just text and images with basic CSS styling in Flash:
import flash.text.TextField;
import flash.net.URLLoader;
function loadedHandler(evt:Event):void
{
var tf:TextField = new TextField();
addChild(tf);
tf.width = 600;
tf.height = 600;
tf.x = 0;
tf.y = 0;
tf.selectable = true;
tf.htmlText = evt.target.data;
}
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, loadedHandler);
loader.load(new URLRequest("http://www.actionscript.org"));
Scroll down to see the images and such like. You would also need to parse the loaded data using regular expressions to apply the stylesheets as well (which would help with text styling but only partially help the layout, as Flash's rendering engine is not that sophisticated).
missileh
02-05-2009, 10:43 AM
here i do get the contents of html file in textfield. But the contents also include an swf file. that swf file is not opening. Can that swf file embedded inside html, be viewed?
daveystew
02-05-2009, 01:25 PM
Nope, not like that. What's wrong with a regular old HTML page!?
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.