Array question

I have a question regarding Arrays.

if i create an Array of instance names how can i get a function to work on everything in the Array?

eg:

[AS]myArray = new Array(“name1”, “name2”, “name3”);
myArray.onRollOver = function() {
trace(“Blah”);
};[/AS]

I have tried a loop to get it to work, but to no avail…

Any ideas?

Drew

1)You posted this in the wrong section, I am moving it to Flash Actionscript now.

2)What exactly are you trying to do with the instanced held in the array? Accroding to your script the array isn’t even referenced :wink:

sorry, bout that… :tb:

I am trying to find an easy way to code a series of buttons with frame animation for each of the states.

a button that triggers AnimIn (frame 1), AnimOut (frame 2) states of an instance name say… buttonAnim1…2…3…etc

make any sence?

Drew

Hmmm im confused :-\

yeah… mee too let me try again:

I have 60 or so buttons that i want all to use the function: this wont make much sence but…
[AS]manybuttons=new Array(“60 button names in here”)
function buttonRollover(x){
manybuttons.onRollover= function(){
buttonAnim[x].gotoAndPlay(2)[/AS]

at the end of the day all i really want to know is how do you get all of the contents of an array(being instance names of existing buttons) to do an onRollover or similar function.

???

Drew

Ok, well I whipped up a quick example of targeting buttons from instance names in arrays.

This is what I originally thought you were trying to do, but then claudio posted and you cleared things up a bit more, then I realized what I was working on what wrong, but I was too tired to start over so I just kept going with the example I was working on.

Attached is the fully commented .fla, let me know if it is of any use for you.

cheers,

Yeah… that is what i was talking about.

I have just got into actionscript and have found this website the best of the lot…

Thanks

Drew(itWontbetheLastTime)Jitsu

I am glad I could help, if you need me to explain anything in my script I will, I added the comments to help guide you, but I didn’t want to clutter the file with explanations. If there is anything you don’t understand feel free to ask.

[size=1]just be warned, I am sick right now so my explanations might be kind of confusing and jumbled…lol[/size]

appreciated :wink: