Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

My document plays as a continous loop even with the stop(); code at the start of the document HELP!

New Here ,
Jan 06, 2013 Jan 06, 2013

I really need help for a school project im working on, it seems as though flash doesnt even recognise the actions in the layers, the codes in the first frame are as follows:

stop();

/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

Can be used on the main timeline or on movie clip timelines.

Instructions:

1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.

*/

btnOS.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);

function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void

{

    gotoAndStop(8);

}

/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

Can be used on the main timeline or on movie clip timelines.

Instructions:

1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.

*/

btnia.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_2);

function fl_ClickToGoToAndStopAtFrame_2(event:MouseEvent):void

{

    gotoAndStop(41);

}

/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

Can be used on the main timeline or on movie clip timelines.

Instructions:

1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.

*/

btnDD.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_3);

function fl_ClickToGoToAndStopAtFrame_3(event:MouseEvent):void

{

    gotoAndStop(64);

}

/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

Can be used on the main timeline or on movie clip timelines.

Instructions:

1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.

*/

btnCA.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_4);

function fl_ClickToGoToAndStopAtFrame_4(event:MouseEvent):void

{

    gotoAndStop(2);

}

/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

Can be used on the main timeline or on movie clip timelines.

Instructions:

1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.

*/

btnSpt.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_5);

function fl_ClickToGoToAndStopAtFrame_5(event:MouseEvent):void

{

    gotoAndStop(3);

}

/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

Can be used on the main timeline or on movie clip timelines.

Instructions:

1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.

*/

btnent3.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_6);

function fl_ClickToGoToAndStopAtFrame_6(event:MouseEvent):void

{

    gotoAndStop(4);

}

/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

Can be used on the main timeline or on movie clip timelines.

Instructions:

1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.

*/

btntvf.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_7);

function fl_ClickToGoToAndStopAtFrame_7(event:MouseEvent):void

{

    gotoAndStop(5);

}

/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

Can be used on the main timeline or on movie clip timelines.

Instructions:

1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.

*/

btnmus.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_8);

function fl_ClickToGoToAndStopAtFrame_8(event:MouseEvent):void

{

    gotoAndStop(6);

}

/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

Can be used on the main timeline or on movie clip timelines.

Instructions:

1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.

*/

btntrans.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_9);

function fl_ClickToGoToAndStopAtFrame_9(event:MouseEvent):void

{

    gotoAndStop(7);

}

/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

Can be used on the main timeline or on movie clip timelines.

Instructions:

1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.

*/

btnHome.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_10);

function fl_ClickToGoToAndStopAtFrame_10(event:MouseEvent):void

{

    gotoAndStop(1);

}

Surely this should stop the document from looping when tested, when testing the images and buttons ect seem to be distorted and in different positions.

if it helps here is a download of the document:

http://www.sendspace.com/file/oxqciv

TOPICS
ActionScript
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 06, 2013 Jan 06, 2013

Chances are you're not paying attention to errors. Any scripting errors will disable scripting and your stop() will be ignored until you fix them all. Can you verify you have no errors when testing?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 06, 2013 Jan 06, 2013

There doesn't seem to be any errors apart from a syntax error which occured after i placed an mp3 player component into the document but this was after the document looped

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 06, 2013 Jan 06, 2013

If there are any syntax errors it will neglect your code. You must resolve the syntax error.

It's telling you there's extra characters, e.g.:

mcPlayer.init(componentWidth, componentHeight, pathToFiles, xmlPath, songURL, artistName, songName);}

You should not have that brace at the end of that line. It's not inside a function or have any valid starting brace. Remove the braces.

e.g.

mcPlayer.init(componentWidth, componentHeight, pathToFiles, xmlPath, songURL, artistName, songName);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 06, 2013 Jan 06, 2013

i just checked and the syntax error doesnt occur anymore, but in the output panel there is an error: "The font named Times New Roman is not compatible with TLF text. TLF text using this font will not display properly."

could this be the problem? How do i resolve it?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 06, 2013 Jan 06, 2013

No that won't cause it to stop. You have tons of errors (snippits causing you issues) of duplicate function definitions and about 9 million errors due to using that mp3 player improperly. You're duplicating the code to use it over and over, even on the same timeline. After you define the component variables on a frame and move to another frame, those variables you previously instantiated still exist. You then try to recreate them but the compiler is telling you "they already exist". You should revert back to a previous version before that mp3 player if it's used a ton or you're going to need to strip all the code you created for it and use the component correctly anyhow.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 06, 2013 Jan 06, 2013

but even after i delete the entire mp3 component with the codes the problem is still there

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 06, 2013 Jan 06, 2013

Upload the file without the component please. Chances are you may have left some code fragments from it. If you still have any syntax errors they will lead you to them, and/or any other issues. All syntax errors must be fixed. You can safely ignore all font warnings, they won't cause this issue. Just know that for the most part, code being ignored completely is usually a syntax error somewhere that needs to be resolved.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 06, 2013 Jan 06, 2013

Sorry for the long wait here is the file without the mp3 component: http://www.mediafire.com/?44s97r2f3yedo30

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 06, 2013 Jan 06, 2013

Again, you must read your "Compiler Errors" panel and fix the issues in there. Exporting clearly states:

Scene 1, Layer 'Actions', Frame 8, Line 711021: Duplicate function definition.

So go to scene 1, in the layer named "Actions", on frame #8, code line 71 and check the function name there which is: fl_ClickToGoToAndStopAtFrame_3. It tells you there's a duplicate function definition which means the function name needs to be changed because it's colliding with another function that has already used the same name. The timeline remembers functions and variables frame to frame so you can't use define the same function or variable twice without errors.

Change the function name to something you know will be unique like: fl_ClickToGoToAndStopAtFrame_999999999 on both that line and the function below it to match (2 occurances of it in that script) and the error goes away.

After that it compiled and ran fine but I received errors as I clicked through other pages. Your job is to read those syntax errors, go to the place specified and fix it until you no longer get errors.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 06, 2013 Jan 06, 2013

After this did the document run while in SWF?

i changed the action for that piece of code to 99999999 as you suggested but when i test the document it still runs all the frames, could you upload the document you have?, i believe the problem may be my flash

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 06, 2013 Jan 06, 2013
LATEST

The FLA worked for me fine although it's an older version of Flash (CS5 I believe?). I saved my copy up to CS5.5.. It's not really worth uploading as it's the same thing you have with that single change. Just fixing that wasn't enough to correct all the errors although it did play fine. I was exporting for Flash Player 11.5 though.

The 99999999's were just an example, not really literal. It just meant to make sure the function names don't already exist so I used something silly. You can name it something reasonable (or use letters instead of numbers, as long as it's unique). I doubt it's your Flash, you just more errors to fix.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 06, 2013 Jan 06, 2013

i deleted the extra brace but after exporting as SWF to test it still loops

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 06, 2013 Jan 06, 2013

Are you getting any error messages?

Some helpful advice...

1) You should remove all of the directions that using script assist adds to your code.  It becomes very hard to read when so much of it is just commentary repeating over and over.

2)  If you want to make files available, some people are willing to take a look, other are not and for good reasons... try to find a better service than one where you cannot tell which will be downloading your files versus whatever else they are trying to lure you into.  If you visit the link you provided you can probably see why I am not going to chance selecting any one of the various download buttons that appear.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 06, 2013 Jan 06, 2013

Sorry, is this any better: http://www.mediafire.com/?u1ddftnp3ffodum

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines