Hi all!
I am creating a navigational menu in flash and decided importing HTML with CSS formatting would be the easiest way to go. I took a GREAT tutorial called Using CSS Styles in Flash MX 2004 and got it all working well if I followed the instructions exactly.
The catch is that I need to import a second external .txt file (that uses the same CSS) because it needs 2 columns. I simply gave the new text box an instance name of “kirupa2” and duplicated the AS code provided in the tutorial. But when I did so, the first column disappeared.
I think it’s just an easy AS fix, so here’s the code:
var format = new TextField.StyleSheet();
var path = "flash.css";
format.load(path);
format.onLoad = function(loaded) {
if (loaded) {
output.styleSheet = format;
myLoadVar = new LoadVars ();
myLoadVar.load("kirupa.txt")
myLoadVar.onLoad = function (success){
if (success == true) {
output.variable = "kirupa"
output.htmlText=myLoadVar.kirupa;
}
}
} else {
output.text = "Error loading CSS file!";
}
};
format.load(path);
format.onLoad = function(loaded) {
if (loaded) {
output2.styleSheet = format;
myLoadVar = new LoadVars ();
myLoadVar.load("kirupa2.txt")
myLoadVar.onLoad = function (success){
if (success == true) {
output2.variable = "kirupa2"
output2.htmlText=myLoadVar.kirupa2;
}
}
} else {
output.text = "Error loading CSS file!";
}
};
You can view the movie as it stands here.
Let me know if you need me to upload the .fla file!
Thank you in advance for you help!!!