Code: Select all
function changePoly fPoly,fStyle,fSides,fAngle,fBGColor
set the style of graphic fPoly to fStyle
set the polySides of graphic fPoly to fSides
set the angle of graphic fPoly to fAngle
set the backgroundColor of graphic fPoly to fBGColor
end changePoly
-- on mouseUp and all that jazz
switch
case tButtonLabel = "Red"
--changePoly("changeling","regular",8,68, red)
-- currently, I'm using the same handlers in every part of my switch.
-- I'd like to write a function like the one commented out to simplify things greatly.
set the style of graphic "changeling" to "regular"
set the polySides of graphic "changeling" to 8
set the angle of graphic "changeling" to 68
set the backgroundColor of graphic "changeling" to red
break
When I uncomment the changePoly("changeling","regular",8,68, red) function and click my button, I get the error "Handler: Can't find handler" on the line where I call the function. Is there any way I can fix this, or do I have to violate DRY in the case of modifying graphics?