PDA

View Full Version : Load files with more html/xml-code, is it possible?


Tune
01-12-2008, 07:31 PM
Hi!

I have managed to get my site working with loading textfiles when I click a button. But it does not support much html. (only bold and a href what I know)
I want to load files files with more HTML-code like <table>, different size snd so on....is this possible???

The code I use now is like this

var htmlText:String="valkommen.txt";
var request:URLRequest = new URLRequest(htmlText);
var loader:URLLoader = new URLLoader();
loader.load(request);
loader.addEventListener(Event.COMPLETE,completeHan dler);

function completeHandler(event:Event):void {
var loader:URLLoader = URLLoader(event.target);
var htmlText:String = loader.data;
this.pageText_txt.htmlText = htmlText;
}

b1.addEventListener(MouseEvent.CLICK,b1Listener);
b2.addEventListener(MouseEvent.CLICK,b2Listener);

function b1Listener(event:MouseEvent):void {
loadFile("content_sektionen.txt");
}

function b2Listener(event:MouseEvent):void {
loadFile("content_styret.txt");
}

function loadFile(htmlText:String):void{
request.url = htmlText;
loader.load(request);
}

coreman2200
01-12-2008, 08:24 PM
Yeah I've been running into a lot of those same limitations - there's not much available..
(See Here: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/ --> TextField --> htmlText for the list)
But a lot of things would best and most completely be expressed through AS, anyway.. I don't exactly understand what you mean by 'different size s[ou]nd'?? But tables, for example, could be done with a few bordered text fields OR another pretty cool idea is using CSS and breaking your sections up into <div> or <span>'s, giving each a border of your choosing (that works on flash)..