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);
}
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);
}