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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extra actions on a rollover button (LINGO)

Status
Not open for further replies.

ursonyc

Programmer
May 24, 2004
2
US
I have a 5 button horizontal menu designed with a 2 rollover state and when any button is clicked opens a new movie with the same menu structure but with the clicked button on selected.
The issue comes when i go over the other buttons and they highlight too... but my selected button is still in the same state!!!, looks kinda redundant.
Could anybody give me a hand on how to switch that button wich is not the current sprinte but i know for sure its name on the Cast library, here is sample of one of the buttons code:


on mouseUp me
set the member of sprite the currentSpriteNum to member "menu_02-over"
cursor 280

end

on mouseDown me
set the member of sprite the currentSpriteNum to member "menu_02"
cursor 260

/* here is where i would like to able to switch the already hihhlihted button into the off state, so it wont look horrid */


play movie "why.dir"


end

on mouseLeave me
set the member of sprite the currentSpriteNum to member "menu_02"
cursor -1

end


 
When mouseDown occurs reset all other buttons to normal state.

If you want to do it properly, try this:
- Create buttons with 3 states (normal, over, down/selected).
- Name them using a convention such as "menu_1", "menu_1_over", "menu_1_down", "menu_2"...
- Place them in consecutive sprite channels. I'll use channel 1 to 5 in this example.

Then write a button behaviour script something like this. You'll need just one behaviour - attach it to all 5 buttons:

-- Button behaviour
on mouseEnter me
if not(sprite(me.spriteNum).member.name contains "down") then
sprite(me.spriteNum).member = member("menu_" & me.spriteNum & "_over")
cursor 280
end if
end mouseEnter me

on mouseLeave me
if not(sprite(me.spriteNum).member.name contains "down") then
sprite(me.spriteNum).member = member("menu_" & me.spriteNum)
end if
cursor 0
end mouseLeave

on mouseDown me
repeat with i = 1 to 5
if i <> me.spriteNum then
sprite(me.spriteNum).member = member("menu_" & me.spriteNum)
end if
end repeat
sprite(me.spriteNum).member = member("menu_" & me.spriteNum & "_down")
case me.spriteNum of
1: go movie "who.dir"
2: go movie "why.dir"
3: go movie "when.dir"
4: go movie "where.dir"
5: go movie "what.dir"
end case
end mouseDown
--
Hope this will give you basic idea.
 
Hey kenneth thanks for your input, but i am not getting to the point with my problem.
I have gfigured out the mouseover, mouseleave and mousedown for the current button but i need and extra action to change other button(not current) while mouse is over current button:
Heere is an example of what i want and is not working

on mouseUp me
sprite(4).member = 11
set the member of sprite(4) to member "menu_03"
set the member of sprite the currentSpriteNum to member "menu_04-over"

updatestage
cursor 280

end
 
OK, let's look at your code.
--
on mouseUp me
sprite(4).member = 11
set the member of sprite(4) to member "menu_03"
set the member of sprite the currentSpriteNum to member "menu_04-over"

updatestage
cursor 280

end
--
In this behaviour, what you're doing is:

When the mouse is up on Sprite(x) - Sprite(x) is the Sprite, which this behaviour is attached:
1. Change the Sprite(4) to Member #11
2. Change the Sprite(4) to Member "menu_03"
3. Change the Sprite(x) to Member "menu_04-over"
4. Redraw the Stage
5. Change the cursor to "Finger"

1 and 2 are the same actions so you'll only see the result of action 2. 4 is not necessary at all. Apart from that, this behaviour should do what it is supposed to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top