Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 09-19-2011, 06:15 AM   #1
psfream5
Registered User
 
Join Date: Sep 2011
Posts: 8
Default pic slideshow - loop problem

Hi,
I want to do a simple slideshow in flash where the images fade into each other when the user clicks on the image. I have 4 images and I'm using labels and telling flash to go to the next label on each click. However, the problem is that it does not loop properly. I want it to cycle the 4 images in the order I specify indefinitely, should the viewer keep clicking. It's supposed to go 1-2-3-4-1-2-3-4-1-2-etc..., but right now it just goes 1-2-3-4-1-2-3 and stops at the 3rd image on the second pass.

I'm confused why this is because it played through once fine and the same instructions are there to tell it to continue but it stops on the 2nd pass through.

I did try to link the FLA and SWF file in this post but it seems I cannot because I don't have the requisite number of posts. I have a JPEG attached to show what I have in my FLA file if anyone can see anything obvious that would fix this problem.

Any idea on how to solve this seemingly simple problem? I tried everything I could think of to no avail. I would appreciate any help.

Thank you.
Attached Thumbnails
Click image for larger version

Name:	Untitled-1.jpg
Views:	51
Size:	481.8 KB
ID:	37509  

Last edited by psfream5; 09-19-2011 at 06:17 AM.
psfream5 is offline   Reply With Quote
Old 09-19-2011, 09:21 AM   #2
xdeath
Deaths touch!!!
 
xdeath's Avatar
 
Join Date: Mar 2008
Posts: 776
Default

i'm not sure if your aware but the frame labels are a frame ahead of the code. also your picture doesn't show the code for the last frame...
xdeath is offline   Reply With Quote
Old 09-20-2011, 01:32 AM   #3
psfream5
Registered User
 
Join Date: Sep 2011
Posts: 8
Default

I checked and the pic does show the last frame?

Also, I believe it's okay the way the labels and frames are set as there's a stop command at the end of the animation and the code is there to tell it on click to go to the next label. I believe that part is set okay because the first pass (1-2-3-4) looks as intended, only that on the 2nd pass it locks up. It's curious because the 2nd pass is calling the same code as the 1st pass.

i have the SWF file here so you can see it in action:

tss2ml (dot) net16 (dot) net/test.swf

i also have the FLA (CS4) file here:

tss2ml (dot) net16 (dot) net/test-cs4.fla

I appreciate any help.
psfream5 is offline   Reply With Quote
Old 09-20-2011, 03:20 AM   #4
xdeath
Deaths touch!!!
 
xdeath's Avatar
 
Join Date: Mar 2008
Posts: 776
Default

well you had some code on the main timeline that was causing it to screw up.

other then that it seems fine. i've attached a fixed version for you.
(note i added numbers so it was easier to tell what square you were on)
and for the record that picture you had on your first post showed you selecting the last frame but didn't show the code for it.

i downloaded the picture and everything, so don't lie!
Attached Files
File Type: zip test-cs4.zip (8.2 KB, 38 views)
xdeath is offline   Reply With Quote
Old 09-20-2011, 03:40 AM   #5
psfream5
Registered User
 
Join Date: Sep 2011
Posts: 8
Default

thank you!

i think when i made this, i formatted it after something else i saw online and ran into some trouble. what you did here seems cleaner and much easier to read. i will spend some time to look at how you created it to better understand, but this is in fact what i wanted it to do, so thank you very much for this!

and the attachment jpeg file, i really didn't change the jpeg attachment? so i'm not sure what happened there. but in any case, this helped a lot for me and possibly others who are looking to do the same. we can look at the code to see the structure which helps us learn!

thank you sir!
psfream5 is offline   Reply With Quote
Old 09-20-2011, 03:55 AM   #6
xdeath
Deaths touch!!!
 
xdeath's Avatar
 
Join Date: Mar 2008
Posts: 776
Default

Quote:
Originally Posted by psfream5 View Post
thank you!

i think when i made this, i formatted it after something else i saw online and ran into some trouble. what you did here seems cleaner and much easier to read. i will spend some time to look at how you created it to better understand, but this is in fact what i wanted it to do, so thank you very much for this!

and the attachment jpeg file, i really didn't change the jpeg attachment? so i'm not sure what happened there. but in any case, this helped a lot for me and possibly others who are looking to do the same. we can look at the code to see the structure which helps us learn!

thank you sir!
no, prob. glad i could help
xdeath is offline   Reply With Quote
Old 09-24-2011, 10:04 AM   #7
psfream5
Registered User
 
Join Date: Sep 2011
Posts: 8
Default

Quote:
Originally Posted by xdeath View Post
no, prob. glad i could help
i ran into a new problem which i suspect is an easy fix but can't figure out.

so xdeath, once again, thanks so much for your earlier help - you got it to do what i wanted originally.

now, i want to make a slight tweak to the pic slideshow, where it shows pic 1 for X seconds, then automatically fades to pic 2 which shows for X seconds, and then fades to pic 3 which shows for X seconds, then fades back to pic 1 to start the whole process all over again.

you can see what i have here:

tss2ml.net16 (dot) net/test2.swf

i also have it set in the code that when someone clicks on the pic, it will automatically jump to the frame where the fade-in starts for the next pic so the viewer doesn't have to wait X seconds to advance.

as seen in the SWF file, the code works for only the 1st pass. after the 2nd pass, when you click the picture, it seems to jump back to the first frame. i seem to be having the same problem as earlier wherein that the code seems to work fine for only the first pass, and when it starts to loop, then the code doesn't function properly. i don't see why this is.

the FLA file is here:

tss2ml.net16 (dot) net/test2.fla

any help would be appreciated.

thanks.
psfream5 is offline   Reply With Quote
Old 09-25-2011, 07:47 AM   #8
ionLemming
Registered User
 
Join Date: Sep 2011
Location: SKYPE: ionLemming
Posts: 19
Default

>_< timeline code!

... you are adding event listeners without removing the previoius one and its messing up when it stacks...

remove the previous mouse event listener before adding another one...

and...

don't code on timeline : )

ex:

frame 1:
ActionScript Code:
removeEventListener(MouseEvent.CLICK, buttonClickslide4); addEventListener(MouseEvent.CLICK, buttonClickslide1); function buttonClickslide1(event:MouseEvent):void{     gotoAndPlay("F1"); }

frame 34:
ActionScript Code:
removeEventListener(MouseEvent.CLICK, buttonClickslide1); addEventListener(MouseEvent.CLICK, buttonClickslide2); function buttonClickslide2(event:MouseEvent):void{     gotoAndPlay("F2"); }

frame 77:
ActionScript Code:
removeEventListener(MouseEvent.CLICK, buttonClickslide2); addEventListener(MouseEvent.CLICK, buttonClickslide3); function buttonClickslide3(event:MouseEvent):void{     gotoAndPlay("F3"); }

ect...
ionLemming is offline   Reply With Quote
Old 09-25-2011, 08:43 AM   #9
psfream5
Registered User
 
Join Date: Sep 2011
Posts: 8
Default

great, it works! thank u ionlemming!

and what do u mean, don't code on timeline? how else would i do this?
psfream5 is offline   Reply With Quote
Old 09-25-2011, 05:06 PM   #10
ionLemming
Registered User
 
Join Date: Sep 2011
Location: SKYPE: ionLemming
Posts: 19
Default

made this kinda quick but just trying to show an example... might look like a lot at first ... but you don't have to have 10,000+ frames on your timeline to show a ton of images
Attached Files
File Type: zip Slideshow.zip (73.5 KB, 47 views)
ionLemming is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:41 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.