View Full Version : Invisible Hit State/Hit Area in Flash Button Movie?
burroughs23
02-28-2004, 07:02 PM
I'm using a movie with three states to create a button, and I'm wondering if there is any way to duplicate the "Hit State" in a Button Symbol in a Movie? The button is text, and it fades in, so using the same color as the background won't work (the background fades in also, making the effect not so smooth). I like how the "Hit State" in a button is invisible...is there something comparitive I can do for this movie?
Thank you!
you could just make a square, turn it into a movieclip and reduce the _alpha to 0 making it invisible :)
burroughs23
02-29-2004, 04:11 PM
Thank you! Works perfectly...I'm still working on the whole button thing, though...
The buttons I'm working have two states (Up(1), Over(2)). They need to stay in the Over state after being clicked, while their subject is being viewed. Then, when another button is clicked, the first button needs to go back to the up state, while the second button stays down, and so on. The buttons also move around the stage and fade in and out occassionaly. The problem I'm having now, is that after a button is clicked, and then another button is clicked (sending the first button back into Up state), the first button stays in the Over state after being rolled over, instead of returning to the Up state. I think it has to do with the fact that I changed the rollOut value to the same as the release value in the onRelease section (this is how I got the button to stay Down while the item is being viewed). For some reason, after the button is clicked and the onRelease value is triggered, the button is never the same again :cry: Is there a way to tell the button "OK, another button is clicked, you can go back to your orginal state now." Am I making this more complicated than it needs to be? Here's a sample of code:
on the button itself:
on (release) {
_root.clients1.gotoAndStop(1);
_root.coo.gotoAndStop(1);
_root.riv.gotoAndStop(1);
this.onRollOut=function(){
this.gotoAndStop(2);
};
_root.gotoAndPlay(55);
}
and on the same frame in the timeline:
port1.onRollOut = function() {
this._parent.port1.gotoAndStop(1);
}
port1.onRollOver = function() {
this._parent.port1.gotoAndStop(2);
}
port1.onRollOut = function() {
this._parent.port1.gotoAndStop(1);
}
I always make a little function, dont actually use button symbols as of MX, just a movieClip with a over state (lets say in frame 2) and a stay state (lets say in frame 3). So we name our buttons numerically btn1 thru (however many we have :)) lets say 4.
we then use an for loop so when a button is clicked it goes thru the loop resetting all the buttons, then just changes the button that was clicked.
//no of buttons
for (i=0; i<4; i++) {
//the buttons function
this["btn"+i].onRelease = function() {
//firstly we need to set all buttons back to normal, using another for loop
for (j=0; j<myBtn.length; j++) {
//send all buttons to their normal position
this._parent["btn"+j].gotoAndStop("normal");
}
//send the one being clicked to the frameLabel "depressed"
this.gotoAndStop("depressed");
};
//when we rollOver the button with the mouse:
this["btn"+i].onRollOver = function() {
//send it to the frameLabel "over"
this.gotoAndStop("over");
//create an onRollOut function sending the playhead to "Normal"
this.onRollOut = function() {
this.gotoAndStop("normal");
};
};
}
Something like this maybe
Taff
burroughs23
03-04-2004, 03:57 AM
I get the following error message:
Scene=Scene 1, Layer=1, Frame=1: Line 2: Statement must appear within on/onClipEvent handler
for (i=0; i<4; i++) {
I'm also using movies also, not buttons...they are text combined with "hit states" defined as alpha 0% to be invisible..does the "length" reference in the code refer to the size of the button?
burroughs23
03-04-2004, 05:08 AM
But I was wondering: myBtn is ? The actual name of my movie button instance? or do I type myBtn in the code...and "btn"...same question...
Sorry for the (very) late reply.
myBtn is as you guessed the instance name of the button.
Powered by vBulletin™ Version 4.1.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.