Skip to main content
Participant
August 1, 2009
Question

PLEASE HELP - Duplicate Function Definition

  • August 1, 2009
  • 1 reply
  • 711 views
Hello -
I am a beginner when it comes to ActionScript. I am currently working on a Slide Show Pro project. Specifically SSP for Flash (AS3) and Director.

I have 4 custom buttons at the bottom of the slide show. When I try to place ActionScript on my Action layer for let's say two of the buttons I get an error that says "Duplicate Function Definition." Here is the code I am using:

function loadAlbum18(event:Event):void { my_ssp.loadAlbum("album-18","616"); }
photogallery_btn.addEventListener("click",loadAlbu m18);

function loadAlbum18(event:Event):void { my_ssp.loadAlbum("album-18","615"); }
highlights_btn.addEventListener("click",loadAlbum1 8);


Can anyone tell me what I am missing?  The button instance names are different AND the image numbers are different.

Thanks so much!!
This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
August 1, 2009

why are you duplicating that function?  the error message is pretty clear.  use:


function loadAlbum18616(event:Event):void { my_ssp.loadAlbum("album-18","616"); }
photogallery_btn.addEventListener("click",loadAlbum18616);

function loadAlbum18615(event:Event):void { my_ssp.loadAlbum("album-18","615"); }
highlights_btn.addEventListener("click",loadAlbum18615);

Participant
August 1, 2009

Thank you kglad.  Okay - I think I get it now.  I kept thinking that if I changed function loadAlbum18 that it would not work.  I understand now how Flash was seeing it as a duplicate because I was using this on both button actions.  I guess as long as I have it specified within the quotes for the Album-number it will understand which Album to pull from.

However, now I have a new problem.  If you click on the "Highlights" button it works great.  BUT if you click on the "Getting There" button it shows the image but then loops to the next image in the Album.

Can I put some sort of "stop" function so that it does not do that?  Not sure why the "Highlights" button does NOT do this other than the fact that I have it as the last action under the "Getting There" one.

Here is a link to the test page:  http://www.pandenwolf.com/quail/qh_slideshow_gallery.html

P.S.  I understand that you may not be able to help with this since it is working with SSP for Flash.  I have also posted in their forum but have not been able to get help.

Thanks!

Denise

Participant
August 2, 2009

One solution that I found does work is to put each one of the 4 images in their own Album.  This way there are no other images to loop.  A bit extreme I guess but it does work.  Will be interesting to see if SSP Support comes back with any answers for me.