PDA

View Full Version : Animated slides worked fine, added simple actionscript, now won't play?


kapricious
03-28-2012, 09:24 PM
This is my first day with actionscript and I am really stumped here. Basically I have 4 slides which contain objects in motion that come to rest, they fade out, next slide objects come in, etc. All was fine and playing perfectly until I tried to add navigation dots (so a user could select a specific slide).

All I've done was add actionscript to frame 1 which contains the default code snipet for "Go To a Frame and Play", which is:

nav1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);

function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):v oid
{
gotoAndPlay(1);
}

(4 times over, with the correct button names and frames for each)

When I publish the SWF, the animation no longer begins unless I click one of the buttons, and then it plays the entire thing. I even tried (foolishly, I'm sure) adding play() to the very top of my actionscript.

I'm STUMPED! What am I missing here??? Nothing in the above code seems like it should halt the playing of the animation which, prior to trying to add this nav, played just fine.

Really hope someone can explain what little thing I am missing... google has failed me for the last hour+ :( Thank you in advance!!

P.S. I also tried moving my actionscript in the timeline to frame 20 and, low and behold, the animation begins to play until it reaches frame 20. It has to be something in my code????

kapricious
03-28-2012, 09:31 PM
My full actionscript code:

/* ------nav buttons------- */

nav1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);

function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):v oid
{
gotoAndPlay(1);
}

nav2.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_2);

function fl_ClickToGoToAndPlayFromFrame_2(event:MouseEvent) :void
{
gotoAndPlay(126);
}

nav3.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_3);

function fl_ClickToGoToAndPlayFromFrame_3(event:MouseEvent) :void
{
gotoAndPlay(251);
}




/* ------more info buttons------ */


button_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);

function fl_ClickToGoToWebPage(event:MouseEvent):void
{
navigateToURL(new URLRequest("oursite"), "_blank");
}

aj_chichi
03-30-2012, 07:54 AM
base on your script there is nothing wrong. in
the listener and function

try uploading the file so we can see whether its the other part of the code
or maybe the placement of the code..

maybe it is inside some mc or it is in the parent and your are targetting a child?