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!

5 buttons + control

Status
Not open for further replies.

sixk

Programmer
Jan 24, 2007
2
SI
hi

I have on a main panel 5 buttons. The idea is that if i press all of them, some text shows up,.i've tried everything, but it won't work, because the program can't remember which button was pressed,..

Do i have to write actionscript or it can be done in some other way ,..

thanks

lp,alen
 
so not sure if you want all the buttons pressed before the text shows up, of if you want each button pressed to show some text. so here you go:

(to have each button press present with some text)
Assuming text box is on main timeline.

give the textbox an instance name "mytext_tb".
on button one, click on the button, go to code window, type:

on(press) {
_root.mytext_tb.text = "enter your text here for button 1";
}

do this for each button.

(to have all buttons need to be pressed before this text will appear).
Assuming text box is on main timeline.
Give text box instance name "mytext_tb".
give your buttons instance names of button1, button2, etc.
on button1 in code box type:

on(press) {
_root.button1hit = "yes";
if (_root.button1hit == "yes" && _root.button2hit == "yes" && _root.button3hit == "yes" && _root.button4hit == "yes" && _root.button5hit == "yes") {
_root.mytext_tb.text = "input your text here";
}
}

do this for each button except use "button2hit" for button 2 etc.

on main timeline in first frame in code box type:

_root.button1hit = "no";
_root.button2hit = "no";
_root.button3hit = "no";
_root.button4hit = "no";
_root.button5hit = "no";

Used this example as it is pretty simple (though there are a number of ways you can do this that others might indicate might be simpler).

Hope this helped in any manner.
Jonathan

 
Tnx,..it helps a lot,...


i just nedded idea,..exept i didn't write code to each button, but i wrote it to layer 1, frame 1,..

looks like this________

var b1:Boolean = false;

button1.onRelease = function () : Void { b1 = true;}


and so on,...

tnx again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top