Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

1126: Function does not have a body.

Status
Not open for further replies.

brwnsuga21

Technical User
Aug 23, 2007
15
US
I am trying to use a ranomizer effect in Flash CS 3 using the following code:

desiredText = "Destination: WLS";
dt.text = "";
function randomizer() {
(i<desiredText.length) ? go() : clr();
function go() {
if (dt.text.charAt(i) != desiredText.charAt(i)) {
j++;
dt.replaceText(i, i+1, String.fromCharCode(j));
} else {
i++;
j = 0;
}
}
function clr() }{
clearInterval(intID)
}
intID = setInterval (randomize,10);

When I test the movie I recieve the error message "1126: Function does not have a body.". Since I am new to this I cant seem to figure out what I am doing wrong. Please help.
 
How do I fix it? I will actually be using Flash 8 to publish. I tried setting it back to both AS1 and AS2 and I still get errors. Please help.
 
Flash 8 means no AS3, so it needs to be in AS1/2.

If you define variables i and j, it should work:
Code:
var i = 0;
var j = 0;
var desiredText = "Destination: WLS";
dt.text = "";
function randomizer() {
	i<desiredText.length ? go() : clr();
	function go() {
		if (dt.text.charAt(i) != desiredText.charAt(i)) {
			j++;
			dt.replaceText(i,i+1,String.fromCharCode(j));
		} else {
			i++;
			j = 0;
		}
	}
	function clr() {
		clearInterval(intID);
	}
}
var intID = setInterval(randomizer, 10);

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top