View Full Version : Array question
DrewJitsu
August 7th, 2003, 01:02 AM
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:
myArray = new Array("name1", "name2", "name3");
myArray.onRollOver = function() {
trace("Blah");
};
I have tried a loop to get it to work, but to no avail...
Any ideas?
Drew
lostinbeta
August 7th, 2003, 01:04 AM
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 ;)
DrewJitsu
August 7th, 2003, 01:08 AM
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
claudio
August 7th, 2003, 01:15 AM
Hmmm im confused :-\
DrewJitsu
August 7th, 2003, 01:23 AM
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....
manybuttons=new Array("60 button names in here")
function buttonRollover(x){
manybuttons.onRollover= function(){
buttonAnim[x].gotoAndPlay(2)
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
lostinbeta
August 7th, 2003, 01:32 AM
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.
DrewJitsu
August 7th, 2003, 01:36 AM
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
lostinbeta
August 7th, 2003, 01:38 AM
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.
just be warned, I am sick right now so my explanations might be kind of confusing and jumbled...lol
DrewJitsu
August 7th, 2003, 01:39 AM
appreciated ;)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.