JackBreech
11-05-2005, 05:25 PM
I'm trying to do some simple Actionscript, I think, to randomly take an equasion to play certain movies. I have ZERO understanding of Actionscript and it's functions, so I am at the mercy of the community. I downloaded a FLA from flashkit.com and it's one of those over used matrix code things and I want to add more characters. So, I have everything setup except getting Actionscript to randomly use the rest of the characters. So I'm just going to upload the fla and see if someone can take 5 minutes to figure it out for me. I've included the code below. Please take mercy on an ignorant yet ambitions flash animator. THANKS in advance!!!
Jack :cool:
This is the original code:
SSX = 30;
SSY = 30;
XSPACING = 20;
YSPACING = 20;
spans = new Array(SSX);
for (y=0; y<SSY; y++) {
for (x=0; x<SSX; x++) {
n = y*SSX+x;
if ((((x*5 ^ y*3)) & 3) == 0) {
duplicateMovieClip("0", "c"+n, n);
} else {
duplicateMovieClip("1", "c"+n, n);
}
with (this["c"+n]) {
_x = x*XSPACING+XSPACING;
_y = y*YSPACING;
}
}
}
for (x=0; x<SSX; x++) {
y = Math.Random()*SSY*8;
spans[x] = -(int(y));
}
I tried to change it to this to make it work:
SSX = 30;
SSY = 30;
XSPACING = 20;
YSPACING = 20;
spans = new Array(SSX);
for (y=0; y<SSY; y++) {
for (x=0; x<SSX; x++) {
n = y*SSX+x;
if ((((x*5 ^ y*3)) & 3) == 0) {
duplicateMovieClip("0", "c"+n, n);
}
if ((((x*5 ^ y*3)) & 3) == 0) {
duplicateMovieClip("1", "c"+n, n);
}
if ((((x*5 ^ y*3)) & 3) == 0){
duplicateMovieClip("2", "c"+n, n);
}
if ((((x*5 ^ y*3)) & 3) == 0){
duplicateMovieClip("3", "c"+n, n);
}
if ((((x*5 ^ y*3)) & 3) == 0){
duplicateMovieClip("4", "c"+n, n);
}
else {
duplicateMovieClip("5", "c"+n, n);
}
with (this["c"+n]) {
_x = x*XSPACING+XSPACING;
_y = y*YSPACING;
}
}
}
for (x=0; x<SSX; x++) {
y = Math.Random()*SSY*8;
spans[x] = -(int(y));
}
Jack :cool:
This is the original code:
SSX = 30;
SSY = 30;
XSPACING = 20;
YSPACING = 20;
spans = new Array(SSX);
for (y=0; y<SSY; y++) {
for (x=0; x<SSX; x++) {
n = y*SSX+x;
if ((((x*5 ^ y*3)) & 3) == 0) {
duplicateMovieClip("0", "c"+n, n);
} else {
duplicateMovieClip("1", "c"+n, n);
}
with (this["c"+n]) {
_x = x*XSPACING+XSPACING;
_y = y*YSPACING;
}
}
}
for (x=0; x<SSX; x++) {
y = Math.Random()*SSY*8;
spans[x] = -(int(y));
}
I tried to change it to this to make it work:
SSX = 30;
SSY = 30;
XSPACING = 20;
YSPACING = 20;
spans = new Array(SSX);
for (y=0; y<SSY; y++) {
for (x=0; x<SSX; x++) {
n = y*SSX+x;
if ((((x*5 ^ y*3)) & 3) == 0) {
duplicateMovieClip("0", "c"+n, n);
}
if ((((x*5 ^ y*3)) & 3) == 0) {
duplicateMovieClip("1", "c"+n, n);
}
if ((((x*5 ^ y*3)) & 3) == 0){
duplicateMovieClip("2", "c"+n, n);
}
if ((((x*5 ^ y*3)) & 3) == 0){
duplicateMovieClip("3", "c"+n, n);
}
if ((((x*5 ^ y*3)) & 3) == 0){
duplicateMovieClip("4", "c"+n, n);
}
else {
duplicateMovieClip("5", "c"+n, n);
}
with (this["c"+n]) {
_x = x*XSPACING+XSPACING;
_y = y*YSPACING;
}
}
}
for (x=0; x<SSX; x++) {
y = Math.Random()*SSY*8;
spans[x] = -(int(y));
}