[thelist] dynamic text boxes

shortestpath shortestpath at yahoo.com
Thu Sep 4 21:55:58 CDT 2003


what do you mean by TextField.variable? Maybe show us 
your code and we can try it out? Here's an example of 
creating a textfield, and setting/unsetting its text 
bold: 

<html>
<head>
<script type="text/javascript">
function createTxtfld() {
	var tf = document.createElement("input");
	tf.setAttribute("type", "text");
	tf.setAttribute("id", "txtfld");
	tf.setAttribute("style", "width:180px");

	var f = document.forms[0];
	f.appendChild(tf);
}

function makeBold() {
	var tf = document.getElementById("txtfld");
	tf.style.fontWeight = "bold";
}

function makeNormal() {
	var tf = document.getElementById("txtfld");
	tf.style.fontWeight = "normal";
}
</script>
<style type="text/css">
button { display: block; width: 120px; }
</style>
</head>

<body>

<form id="theForm">
<button onclick="createTxtfld()">create textfield</button>
<button onclick="makeBold()">make bold</button>
<button onclick="makeNormal()">make normal</button>
</form>

</body>
</html>

-alex

--- Mark Joslyn <Mark.Joslyn at SolimarSystems.com> wrote:
I in a little bit of a bind...

Situation:
I have a dynamic text box (field1) that is inside a movie clip 
(recordMC)
that is populated from an external .txt file. Everything is loading
perfectly, Now comes the tricky part - I want to now add formatting to 
the
text. I want the text to come in bold. Then when a user clicks a 
button, the
bold is turned off.

Problem:
I cannot get the dynamic text box to accept any formatting commands. It
seems like the only way to get formatting to work is if I created a 
text box
with actionscript instead of drawing one on the stage.

I have tried setTextFormat, but this seems to be ignored. Also, through
testing, the TextField.variable command is quirky. I have one movie 
that
uses TextField.variable and works fine, and I have another that uses 
the
exact same code, and it does not work - it requires an "_" to work 
(i.e.
TextField._variable). Has anyone else experienced this "bug".

Is there a way to get a dynamic text box - that is drawn on the stage -

to
accept new formatting commands (bold, color, size) - without using HTML
commands in the external text file (I want to keep the external text 
file
super user-friendly - non-HTML users - for editing purposes)?

Any and all help appreciated.

mj

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


More information about the thelist mailing list