[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

Array to call sequential clip numbers

I have clips that are numbered sequentially that i call in actionscript as:

this.showback.onRollOver = function(){
      fadeout(clip1);
      fadeout(clip2);
      fadeout(clip3);
      fadeout(clip4);
      fadeout(clip5);
      fadeout(clip6);
      fadeout(clip7);
      fadeout(clip8);

is there anyway create an array of other method that would enable me to call the function once, and fillin the numbers (1-8).  Something like

fadeout(clip[num])  ?
0
bjv211
Asked:
bjv211
1 Solution
 
SavongCommented:
Best way I know of is to reference them from the parent movie scope, you can then reference them as:
for(var i = 0;  i<5; i++){
     fadeout(holdingClip["clip"+i]);
}

as I mentioned the holdingClip reference just has to be the next movie up your chain, which could very well be _root.
0
 
vickerleungCommented:
BJV~

Better suggested code will be using an extra variable to store the value first before using
You may say is only fancy stuff, but it worths, especially for debugging purpose

temp_clip_name = ""
for(var i = 0;  i<5; i++)
{
     temp_clip_name = "clip" add i;
     fadeout(holdingClip[temp_clip_name]);
}

Vicker
0
 
bjv211Author Commented:
Savong, works great and the coding is basic enough not to have debugging issues...woo
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now