Single script for all button rollovers


#1

I have 7 buttons. When I mouseover / mouseout each button I animate it so it slightly shifts its position. Currently I have to create a separate function each button, for example…

homeOver()

hypeDocument.setElementProperty(home, 'left', -200, 0.1, 'easeinout')

homeOut()

hypeDocument.setElementProperty(home, 'left', -210, 0.1, 'easeinout')

I would like to create a single custom behavior that can be used for all buttons. I would need to pass parameter such as left position though. Is this possible or am I stuck creating 14 different functions (7x2)?

Thanks.


(Greg) #2

If you use ‘element’ instead of ‘home’, you can assign the javascript to any object…

hypeDocument.setElementProperty(element, 'left', -200, 0.1, 'easeinout')