Hi all,
I have three placeholder images, the contents of which are populated by an array (“galleryArray”).
These three placeholders are titled “placeholderLeft”, “placeholderCentre” and “placeholderRight”.
the contents of “placeholderLeft” will be: “galleryArray[n-1]”
the contents of “placeholderCentre” will be: “galleryArray[n]”
the contents of “placeholderRight” will be: “galleryArray[n+1]”
basically, on clicking “placeholderRight”, I’m trying to increase the value of “n” by 1. By clicking placeholderLeft I’m trying to get the value of “n” to decrease by 1.
I have successfully done this within for loops and functions but can’t figure out how to extract & update the new value of the “n” variable .
Any help would be greatly appreciated, code below (function version):
as you will see below, the array length is calculated by “galleryNo”, I will need the value of “n” to reset to (galleryNo/galleryNo) if it exceeds this number or change to “galleryNo” if it drops below 0 - any tips on this would also be greatly appreciated.
[LEFT][COLOR=#993300]var[/COLOR] galleryArray:[COLOR=#993300]Array[/COLOR] = [COLOR=#993300]new[/COLOR] [COLOR=#993300]Array[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]“mc_01”[/COLOR],[COLOR=#0000FF]“mc_02”[/COLOR], [COLOR=#0000FF]“mc_03”[/COLOR], [COLOR=#0000FF]“mc_04”[/COLOR][COLOR=#000000])[/COLOR]; [COLOR=#993300]var[/COLOR] galleryNo:[COLOR=#993300]Number[/COLOR] = galleryArray.[COLOR=#993300]length[/COLOR]
[COLOR=#993300]var[/COLOR] n : [COLOR=#993300]Number[/COLOR]= galleryNo/galleryNo; [COLOR=#993300]
this[/COLOR].[COLOR=#993300]attachMovie[/COLOR][COLOR=#000000]([/COLOR]galleryArray[COLOR=#000000][[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]][/COLOR], [COLOR=#0000FF]“placeholderLeft”[/COLOR], [COLOR=#000000]1[/COLOR][COLOR=#000000])[/COLOR]; placeholderLeft.[COLOR=#993300]_x[/COLOR] = [COLOR=#000000]0[/COLOR];
placeholderLeft.[COLOR=#993300]_y[/COLOR] = [COLOR=#993300]Stage[/COLOR].[COLOR=#993300]height[/COLOR]/[COLOR=#000000]2[/COLOR];
[COLOR=#993300]this[/COLOR].[COLOR=#993300]attachMovie[/COLOR][COLOR=#000000]([/COLOR]galleryArray[COLOR=#000000][[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]][/COLOR], [COLOR=#0000FF]“placeholderCentre”[/COLOR], [COLOR=#000000]2[/COLOR][COLOR=#000000])[/COLOR]; placeholderCentre.[COLOR=#993300]_x[/COLOR] = [COLOR=#993300]Stage[/COLOR].[COLOR=#993300]width[/COLOR]/[COLOR=#000000]2[/COLOR];
placeholderCentre.[COLOR=#993300]_y[/COLOR] = [COLOR=#993300]Stage[/COLOR].[COLOR=#993300]height[/COLOR]/[COLOR=#000000]2[/COLOR];
[COLOR=#993300]this[/COLOR].[COLOR=#993300]attachMovie[/COLOR][COLOR=#000000]([/COLOR]galleryArray[COLOR=#000000][[/COLOR]n+[COLOR=#000000]1[/COLOR][COLOR=#000000]][/COLOR], [COLOR=#0000FF]“placeholderRight”[/COLOR], [COLOR=#000000]3[/COLOR][COLOR=#000000])[/COLOR]; placeholderRight.[COLOR=#993300]_x[/COLOR] = [COLOR=#993300]Stage[/COLOR].[COLOR=#993300]width[/COLOR];
placeholderRight.[COLOR=#993300]_y[/COLOR] = [COLOR=#993300]Stage[/COLOR].[COLOR=#993300]height[/COLOR]/[COLOR=#000000]2[/COLOR];
[COLOR=#993300]trace[/COLOR] COLOR=#000000[/COLOR];
placeholderRight.[COLOR=#993300]onRelease[/COLOR] = [COLOR=#993300]function[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR] [COLOR=#993300]
_root[/COLOR].[COLOR=#000000]n[/COLOR] ++;
[COLOR=#993300]trace[/COLOR] COLOR=#000000[/COLOR]; [COLOR=#000000]
}[/COLOR]
placeholderLeft.[COLOR=#993300]onRelease[/COLOR] = [COLOR=#993300]function[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]{
[/COLOR] [COLOR=#993300]_root[/COLOR].[COLOR=#000000]n[/COLOR] --; [COLOR=#993300]
trace[/COLOR] COLOR=#000000[/COLOR]; [COLOR=#000000]
}[/COLOR]
[/LEFT]
Thanks in advance!