Join Login


Host Unlimited Domains on 1 Account
 AS3 Image Gallery issues
 by Vishni - May 10, 2011

Hello.

I just watched the tutorial on how to create an image gallery with next and previous buttons.
Everything worked fine when i tried it but when i work with several scenes it jumps to the last scene instead of going to the first frame in the scene where my image gallery is.

I'm really new to actionscripting so I really have no clue what to do.

Help is much appreciated!

Heres the code i used: (Can obviously be found on this website but i thought I'd post it anyway)

stop()

btn1.addEventListener(MouseEvent.CLICK,backward);
btn2.addEventListener(MouseEvent.CLICK,forward);

function forward(event:MouseEvent) {
if(this.currentFrame == this.totalFrames){
gotoAndStop(1);
}
else{
nextFrame();
}
}

function backward(event:MouseEvent){
if(this.currentFrame == 1){
gotoAndStop(this.totalFrames);
}
else{
prevFrame();
}
}



I tried adding the scene's name like this: gotoAndStop(1, "Scene Name");
But it didnt work.



Vishni
Sweden
Posts:3
Joined:May 10, 2011
 RE: AS3 Image Gallery issues
 by RiverCityGraphix - May 10, 2011

So is you gallery not cycling correctly? Or are you trying to cycle through something that is not individual frames?

Also, welcome to the forums!


Be sure to subscribe on YouTube.

Do you take great photos? Consider selling them on Dreamstime.
RiverCityGraphix
United States
Posts:327
Joined:Nov 21, 2009
 RE: AS3 Image Gallery issues
 by Vishni - May 10, 2011

Thank you!

I have 5pictures (5frames) and whenever I'm at the last frame and press the forward button it doesnt loop back to the first frame, instead it jumps to my last scene. So yes it's not cycling quite right.

I have a total of 11scenes and it jumps from my 6th scene(where i have my image gallery) to the last scene.


Vishni
Sweden
Posts:3
Joined:May 10, 2011
 RE: AS3 Image Gallery issues
 by RiverCityGraphix - May 10, 2011

Ok, it sounds like you are not running only the gallery in the timeline. There are two things you can do to fix the problem.

1.Use my Flash in Flash tutorial to put the gallery in its own movieclip that way it can run seperately from everything else.

2.Replace this.totalFrames with the number of the last frame you have in the gallery. That way it will not select other scenes and you can specify which one you want it to end on.


Be sure to subscribe on YouTube.

Do you take great photos? Consider selling them on Dreamstime.
RiverCityGraphix
United States
Posts:327
Joined:Nov 21, 2009
 RE: AS3 Image Gallery issues
 by Vishni - May 10, 2011

I cant thank you enough!

I watched the Flash in Flash tutorial and it worked perfectly!

And this could be the solution to some other problems I've had in the past!

You've opened up a whole new world for me!

And thank you for a very quick answer!


Vishni
Sweden
Posts:3
Joined:May 10, 2011
 RE: AS3 Image Gallery issues
 by RiverCityGraphix - May 10, 2011

No problem. I'm glad I could help!


Be sure to subscribe on YouTube.

Do you take great photos? Consider selling them on Dreamstime.
RiverCityGraphix
United States
Posts:327
Joined:Nov 21, 2009
  
Home About Contact Forum Youtube Privacy Policy
Copyright © 2009-2011 RiverCityGraphix.All Rights Reserved.