PDA

View Full Version : mc and multiple buttons


friz2002
10-27-2002, 09:57 PM
Hi,

when my page loads there's some text. When user clicks a button, the text should dissappear.
so I put this code on the main timeline (changing button1 into button2, etc for each button)

button1.onRelease = function (){
tekst_mc._visible = false;
movieHolder.loadmovie ("home.swf");
}

Do I have to put this code for each button or is it possible to have something like:
if any button is clicked - remove tekst_mc
then load the external swf for that button

farafiro
10-28-2002, 08:56 AM
if u r on MX, make them dynamicly and then u can call them to do that

friz2002
10-28-2002, 01:27 PM
Hi,
yes, I'm using MX.
I don't understand what you mean.
Do I make the text_mc dynamic (this text is not on buttons, but a seperate mc)???
Maybe a bit of code to explain???

thx in advance.

farafiro
10-28-2002, 02:27 PM
//creating the text field
_root.createTextField ("myText",100,10,30,100,30)
//put our text in the text box
myText.text = "ActionScript.org"
//making out buttons, three buttons
for(i=0;i<3;i++){
myButton = _root.createEmptyMovieClip("but"+i,i+10)
myButton.lineStyle(1)
myButton.beginFill(0x336699)
myButton.lineTo(20,0)
myButton.lineTo(20,7.5)
myButton.lineTo(0,7.5)
myButton.lineTo(0,0)
this["but"+i]._x = i*myButton._width*2
//putting the actions to the buttons
myButton.onPress = function(){
this._alpha = 50
}
myButton.onRelease = function(){
this._alpha = 100
//here is what makes the text box disappear
myText.text =""
}
}

friz2002
11-02-2002, 02:52 PM
thx for the quick answer :)