-
Senior Member
SOLVED Array problem, can you spot a flaw?
Hi,
I have a problem with an function in my movie, I want to pick from an array but I need to choose the array dynamically. index [0] from my35Array or my1Array - I don't get it to work, can you spot an flaw or suggest something that works?
Code:
my35Array = ["1.0"]; // vildhet 35
my1Array = ["4.9","4","3.7","3.5","2.8","2.2","0.3","0.2","0.16","0.12"]; // vildhet 1
trace (dragg);
function vildhetsdragg(vildhet,fas4)
{
toNumber (vildhet);
toNumber (fas4);
arrayfighter = vildhet;
// trace (arrayfighter);
bonusfighter = "my" + arrayfighter + "Array";
extrafighter = bonusfighter;
// toString (bonusfighter);
trace (extrafighter);
trace (fas4);
if (fas4 > 89)
{
// trace (extrafighter[0]);
trace (my35Array[0]);
dragg = extrafighter[0];
}
}
bonusfighter and extrafighter becomes myXArray as it should (in this case 1 or 35 is the only Arrays created), but dragg = extrafighter[0]; does not pick e.g. my35Array[0] even if extrafighter is my35Array !
dragg = extrafighter[0] is always 109 for some reason I cannot understand!
Can you spot a flaw or tell me how to pick from the array with an dynamic way?
Last edited by SirN; 03-29-2010 at 05:54 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|