Can i turn vars into a link/button
I have this textfield in wich i load some vars when a button is clicked.
How can i make a sort of button of the loaded vars?
So if i click on the first title; i go to the right txt-file!?
Here's the code so far:
code:
//vars instellen
//titels
var title1:String = "Maan Fotografie";
var title2:String = "Vertigo-/zoomeffect-fotografie";
//datums
var date1:String = "16-03-2009";
var date2:String = "xx-xx-xxxx";
//categorien
var cat1:String = "Technieken";
var cat2:String = "Achtergronden";
var cat3:String = "Tips & Trucs";
//programma
var content_lv:LoadVars = new LoadVars ();
content_lv.onLoad = function (success:Boolean) {
if (success) {
content_txt.html = true;
content_txt.htmlText = this.ms;
}
else {
trace ("Error loading text file!");
}
};
home_btn.onRelease = function () {
content_txt.text = title1 + "\n" + date1 + " | " + cat1 + "\n\n" + title2 + "\n" + date2 + " | " + cat1;
}
date_btn.onRelease = function () {
content_lv.load ("Maan Fotografie.txt");
};
var cat_lv:LoadVars = new LoadVars ();
cat_lv.onLoad = function (success:Boolean) {
if (success) {
content_txt.html = true;
content_txt.htmlText = this.ms;
}
else {
trace ("Error loading text file!");
}
};
cat_btn.onRelease = function () {
content_txt.text = cat1 + "\n\n" + cat2 + "\n\n" + cat3;
};
Can it be done!?
Please help?
Maybe you can adapt this...
Code:
//vars instellen
//titels
var title1:String = "Maan Fotografie";
var title2:String = "Vertigo-/zoomeffect-fotografie";
//datums
var date1:String = "16-03-2009";
var date2:String = "xx-xx-xxxx";
//categorien
var cat1:String = "Technieken";
var cat2:String = "Achtergronden";
var cat3:String = "Tips & Trucs";
//
var link1:String = "Maan.txt";
var link2:String = "Vertigo.txt";
//programma
var content_lv:LoadVars = new LoadVars();
content_lv.onLoad = function(success:Boolean) {
if (success) {
content_txt.html = true;
content_txt.htmlText = this.ms;
} else {
trace("Error loading text file!");
}
};
function loadTxt(file){
content_lv.load(_root[file]);
}
home_btn.onRelease = function() {
content_txt.html = true;
content_txt.htmlText = "<a href=\"asfunction:loadTxt,link1\">"+ title1 + "\n" + date1 + " | " + cat1 + "</a>\n\n <a href=\"asfunction:loadTxt,link2\">" + title2 + "\n" + date2 + " | " + cat2 + "</a>";
};