hi folks.
back again with another quick question!
a quick explanation of what I’m at… I’m working on something at the moment, basically what I have is an external textfile which contains several variables; I am loading these variables into flash using loadVariables().
one of these variables invokes the script to create several buttons on the stage using for() and attachMovie(), and add onRelease() actions for each. when each button is clicked, a new textfield for that button is created on the stage.
the other loaded variables contain appropriately named html-formatted strings of text, which are then loaded into their respective, newly created textFields. pretty straightforward, and everything’s working perfectly, the tags are being rendered etc. bold text is turning up bold and links are working correctly.
but, I know nothing about CSS and flash! here’s what I’m wondering… although my text is being rendered properly, I currently have no control over the style of my text, so it is rendering as black, times new roman etc. how can I apply CSS styles in order to control font size, type, colour etc.?
does this entail attaching an external stylesheet, or can CSS styles be defined within the movie?
here is my code at the moment:
// create box for textField for loadingMsg
_root.createTextField("loadingMsg", 20, 10, 60, 300, 100);
// create empty movie clip to store variables
_root.createEmptyMovieClip("myVariables_mc", 1);
loadVariables("text.txt", myVariables_mc);
function checkVariablesLoaded() {
if (myVariables_mc.myVariablesLoaded != "loaded") {
trace("variables still loading");
loadingMsg.text = "one moment. loading data...";
} else {
trace("variables loaded");
//remove loadingMsg
_root.loadingMsg.removeTextField();
for (i=1; i<=myVariables_mc.numberOfButtons; i++) {
// attach buttons
_root.attachMovie("clicky_mc", i, 3+i, {_x:i*21-20, _y:1});
eval(i).onRelease = function() {
// create new textField
_root.createTextField("myTextField"+this._name, 2, 1, 30, 300, 100);
// define textField properties
eval("_root.myTextField"+this._name).multiline = true;
eval("_root.myTextField"+this._name).wordWrap = true;
eval("_root.myTextField"+this._name).autoSize = "left";
eval("_root.myTextField"+this._name).html = true;
//
eval("_root.myTextField"+this._name).htmlText = eval(myVariables_mc+".myText"+this._name);
trace(this._name);
}
}
clearInterval(myInterval);
}
}
var myInterval:Number = setInterval(checkVariablesLoaded, 100);
and here are the variables, contained in text.txt:
numberOfButtons=3&myText1=<b>hi there</b>. text 1&myText2=hello. <b>text 2</b>&myText3=yo… <b>text three</b> <a href="#">this is a link</a>&myVariablesLoaded=loaded
yeesh… bit long, anyway if anyone has any suggestions as to how I can add a bit of CSS to these textFields I’d be seriously grateful!
thanks for reading! dar