Flash Q
- Started
- Last post
- 5 Responses
- NegativeSpace
Still have much to learn in Flash w/ ActionScript and I always feel like I am doing things the long and tedious ways.
I have a menu and when you click a button, a little half circle slides up to show that you are in that section. I have made an mc and inside I have an animation of it sliding up, and sliding down, with stop actions placed appropriately. Then when you click on another menu item, its half circle slides up, and it tells the other mc to slide down. Obviously I want to do this for any button that is clicked, its half circle mc will slide up and the previous section that was selected will have its half circle slide down.
I was doing this with variables and long if statements for each button, but for some reason it would not work and before I went any further I wanted to see if there were any different methods that others who are more knowledgable in AS than myself might use in a situation like this.
Thanks in advance.
- cinder0
give the animations all instance names
then when one is clicked set a variable
this.onrelease = function(){
_root[_root.lastClicked].play();
_root.lastClicked = this._name;
}basically, the first part inserts the clips name inbetween the brackets
and then makes itself the last clicked item for when you click the next button.
- System-Idle0
functions and for loops are also useful to set lots of mc's.
eg. if you had 20 buttons named 'btn1' - 'btn20' you can target these using the for loop and an incrementing variable.
script on btn: on(press){
resetfunc(this._name)
}this passes the name of the mc to the funtion
script for function:
function resetfunc(mcName){
for(i=0; i
- System-Idle0
cont...
script for function:
function resetfunc(mcName){
for(i=0; i
- System-Idle0
mmm doesnt like the less than operator!
- NegativeSpace0
Thanks for the help!
Couldn't quite get those scripts to work but cinders code led me in the right direction and i did something very similar after leaning how to do functions.
thanks again!