PDA

View Full Version : somebody shoot me



inVZbl
August 27th, 2003, 03:41 AM
Alo

Having problems with the following script. What the script is supposed to do is, first find out if the variable name text is the length of for letters, then if it is check to see if the 4 letters is found in an array called buttons. If yes added one to attempts, if not add one to ****e.

At the moment its adding 2 to attempts everytime i click a button, and the array check doesnt work.

here is the code for the frame:

// Defines array buttons
var buttons = new Array("b1b2","b2b1");

//Checks to see if text equals array
clickaction = (text == buttons[i])

//Function for clicked buttons
clickedbutton = function (){
if (text.length == 4){
for (var i=0 ; i < buttons.length ; i++){
if (clickaction){
trace("attempt is good");
attempts++
text = ""
}else{
****e++;
text = ""
}}}}


On the buttons i have added this script:
on (release) {
text = text + "b1";
clickedbutton();
}

Where am i going wrong?? i am so baffeled at the moment

:q:

blah-de-blah
August 27th, 2003, 09:37 AM
I havn't looked at your fla...but i'm not sure if you can use stars (*) as part of a variable...unless ****e is not a variable. Can't you give it a better name?!?! Oh yea try to use AS tags next time :P

inVZbl
August 27th, 2003, 07:40 PM
Sorry there not actual stars, i just called something that the swear filter on this board picked up.

blah-de-blah
August 27th, 2003, 11:28 PM
i'm not really sure what you want to do, but i think the problem is:

if (text.length == 4)

Where do you input your text length or somethign?! i'm sorta confused...

inVZbl
August 28th, 2003, 12:20 AM
Sorry, i think i confused myself on this one... i found out an easier way to do it from another other post. Thanks though