FORUMS: list search recent posts

Sliding pictures with next and previous button

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Cam Vi
Sliding pictures with next and previous button
on Nov 9, 2010 at 11:24:36 am

Hello! Can someone please help me with the codes of sliding images?

Basically, I used tweenlite as3. I have 5 sliding boxes/panels and in each panel I created another movieclip with consecutive images, and with next and previous arrows, and put a mask so that a single image is seen at a time.

My code was:
var arrayX :Array = [-330,-1130, -1480 ];

var currentIndex : Number = 0;


left2_mc.buttonMode = true;
right2_mc.buttonMode = true;


function navigate(e:MouseEvent):void{
if(e.currentTarget == left2_mc) currentIndex --;
else currentIndex ++;
checkArrows();,.2 ,{x:arrayX[currentIndex]});

function checkArrows():void{
if(currentIndex == 0) left2_mc.visible = false;
else if (currentIndex == arrayX.length - 1) right2_mc.visible = false;
left2_mc.visible = true;
right2_mc.visible= true;

I based my codes on a flash file i found on the net:

I tried to apply the code on my other flash projects, with the same stage size as the above file, and was successful. But in this particular project I'm working on, which has a stage size of 1024x649,and the sliding images are inside a movieclip, I can't seem to do it properly. It's not that the codes are not working, but my images are not where it's suppose to be; like some of the pictures are only half-seen, some are skipped.

I hope someone can help me. Thanks in advance!

P.S: In case I'm not making myself clear, I attached a rough example of my project

Thanks again!

Return to posts index

demetri tashie
Re: Sliding pictures with next and previous button
on Nov 9, 2010 at 7:56:43 pm

hi cam-

it is just a matter of adding the correct x position numbers in your arrays.

the way your files are set up - you have actionscript buried inside of movieclips inside of movieclips- makes your code hard to find. but nevertheless that apepars to be the problem.

for instance your library mania/school boy game ( second panel from the right(Scene 1 --> print --> authormovieclip)) has 4 panels, yet your array only allowed for 3. i assume you do want to be able to see all 4.

i adjusted that array to reflect the correct positions for all 4 of those game panels.
you had var arrayX :Array = [-330,-1130, -1480 ]; and i changed it to
var arrayX :Array = [-423.1,-773.1,-1122.1, -1473.1 ];
the file is here:
i'll assume your other main panels have similar issues. you can look at them and adjust them as needed.

hope that helps

Return to posts index

Cam Vi
Re: Sliding pictures with next and previous button
on Nov 22, 2010 at 3:05:54 pm

I'll go ahead and work on it now...

Thank you so much, Demetri!

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved