functions in array

Hey guys, is het possible to put the following in a loop so I have less lines of code? Because I need to do the following times 10.

function anchor10_Over(e:MouseEvent){;
function anchor11_Over(e:MouseEvent){;
function anchor12_Over(e:MouseEvent){;

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Antonio EstradaTech Leader / Senior Web DeveloperCommented:

anchor10.addEventListener(MouseEvent.MOUSE_OVER, anchor_Over);
anchor11.addEventListener(MouseEvent.MOUSE_OVER, anchor_Over);
anchor12.addEventListener(MouseEvent.MOUSE_OVER, anchor_Over);
//etc, or this could be a for loop

function anchor_Over(e:MouseEvent) {;

Open in new window

Good luck,


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Optimization of Vulturous script

for(var i:uint = 0; i < 15; i++){
    this["anchor" + i ].addEventListener(MouseEvent.MOUSE_OVER, function(e:MouseEvent) {;
ErnstJacobsAuthor Commented:
Hey guys, I''ve got a little problem with that code, which is a conflict with earlier written code, I didnt show so thats my fault...

for(var i = 0; i < anchors.length; i++){
	var overName:Function = this[anchors[i]+"_Over"];
	var outName:Function = this[anchors[i]+"_Out"];
	var upName:Function = this[anchors[i]+"_Up"];

Open in new window

And when I use your code, it gives a conflict. Ofcourse because the eventhandler is already there but I dont know how to change it so it works.
ErnstJacobsAuthor Commented:
Nevermind,. got it working! Great, thanks
Antonio EstradaTech Leader / Senior Web DeveloperCommented:
Glad to help :)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.