Answered
Long switch statement - am I illogical?
Hi
I've attached code to show what I mean:
In a function setAlpha, I am trying to alter the alpha level of movieclips depending on the returned value "num". ie if num = x then a corresponding movieclip will have its alpha reduced by a value also carried in the function.
Do I have to use a case by case switch statement as below or is there an easier way to do this. It seems very labor intensive - especially as the executing code is virtually identical save for the target.
I've explored equating the "num" value with the instance name but can't work out how to do this: something like if movieclip name is string+"num" then execute code
I'd appreciate any help,
db
I've attached code to show what I mean:
In a function setAlpha, I am trying to alter the alpha level of movieclips depending on the returned value "num". ie if num = x then a corresponding movieclip will have its alpha reduced by a value also carried in the function.
Do I have to use a case by case switch statement as below or is there an easier way to do this. It seems very labor intensive - especially as the executing code is virtually identical save for the target.
I've explored equating the "num" value with the instance name but can't work out how to do this: something like if movieclip name is string+"num" then execute code
I'd appreciate any help,
db