A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: AS3 stop(); code not working??

  1. #1
    Member
    Join Date
    Oct 2001
    Location
    Southampton, England
    Posts
    83

    AS3 stop(); code not working??

    Hi all,

    Real simple but cant figure it out.
    Just trying out flash cs3 and I cant seem to get the main timeline to stop looping as the stop(); command will not work at all.

    Does anyone know how to stop the timeline in CS3...its driving me potty.

    Many thanks

    Jay

  2. #2
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    Well, stop() didn't change in CS3, nor did it in AS 3.0 ; it should stop.
    Maybe post your .fla or something, it should work...



    | Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro |
    WebLog: http://blog.wisebisoft.com/ |
    | Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
    |
    Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/
    | By perseverance the snail reached the ark. |


  3. #3
    Member
    Join Date
    Oct 2001
    Location
    Southampton, England
    Posts
    83
    thanks for the reply I will have to re check what the hell Im doing wrong.

    Thanks for confirming anyway.
    Jay

  4. #4
    http://pat.theorigin.net cresquin's Avatar
    Join Date
    Jun 2003
    Location
    Los Angeles, CA
    Posts
    685
    if there are any other errors on the timeline, the compiler may ignore your stop();

  5. #5
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    As far as I'm concerned the movie won't even compile if he has errors in his code.



    | Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro |
    WebLog: http://blog.wisebisoft.com/ |
    | Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
    |
    Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/
    | By perseverance the snail reached the ark. |


  6. #6
    Junior Member
    Join Date
    Aug 2008
    Posts
    5
    Check to make sure that you didn't set that layer to invisible. Your code will NOT run if the layer is invisible.

    Stupid, yes.
    Useless, yes.
    Annoying, yes.

    Why does the visibility of the layer even matter? I don't know....

  7. #7
    Junior Member
    Join Date
    Sep 2008
    Posts
    16
    I'm having the same problem with stop(). Stop() won't work in frame 1 (or any other frame for that matter) on the main timeline. Keep in mind that this only occurs when I'm playing my movie within Flash (Control Menu > Play). If I choose the Test Movie option, it works. But I should be able to play this within Flash too. Furthermore, I copied the same code into a new AS2 file and it works fine. So something is wrong with AS3 or it requires additional code. I have nothing else in my file besides stop() so it's not conflicting with anything. The layer is visible too. Any ideas? Thanks!

  8. #8
    Junior Member
    Join Date
    Aug 2008
    Posts
    5
    The CONTROL->PLAY feature (same as pressing ENTER) in Flash does not run any actionscript. The sole purpose is to move the playhead. It is the same in AS2, so the real question here is "How are you getting it to stop in AS2 by using the CONTROL->PLAY feature?"

  9. #9
    Junior Member
    Join Date
    Sep 2008
    Posts
    16
    wessidemd, if you go to Control, check "enable simple frame actions", and then Control > Play, it will acknowledge the stop() in AS2 (and I assume other actionscript as well). I haven't used Flash CS3 much but I remember this working back in Flash 5 as well. I have more experience using Director where it's common practice to test on the timeline like this. I don't know why this feature would be removed in Flash CS3.

  10. #10
    Junior Member
    Join Date
    Aug 2008
    Posts
    5
    Very interesting, I've never even considered testing my movie on the timeline. I've only used it to see where a particular tween would be at a particular time. I do know that playing the movie that way consumes a ridiculous amount of CPU resources.

    I guess I'm not the person to ask in this case. Sorry I couldn't help.

  11. #11
    Junior Member
    Join Date
    Sep 2008
    Posts
    16
    Thanks anyway, wessidemd. I still haven't found a solution, but I'm making do without.

  12. #12
    Junior Member
    Join Date
    Sep 2008
    Posts
    2
    I was able to duplicate this issue with a nested MovieClip with just 2 frames. Both frames have a stop();.

    If I were to drag the MC manually onto the stage, the stop(); method would work and stop at the first frame. However if I were to add to the stage dynamically with addChild(), it won't.

    When tracing in the frames, I found that the first frame has been skipped , none of the trace from the first frame showed up and went straight to the second. I solved it by adding an extra frame before the first stop();, it works and tracing shows that I'm on the first stopped frame.

    Now, the question here is, why does this happen?

    P.S.:
    I've made a simple Test.fla to show how the issue can be reproduced.

    Basically, there's a button to add the container from the library. Container has a nested movieclip with 2 frames, a stop(); on each. I've placed one of the Container onto the stage and when the button is clicked, it'll add Container (again) and Container2 onto the stage as well. All for comparison purposes only. I duplicated a Container2 with a MovieClipwith 3 frames, but stop(); on the last 2 only to show what I was talking about as a solution(?).

    Code:
    button.buttonMode = true; 
    button.addEventListener(MouseEvent.CLICK, clickListener); 
    
    function clickListener(e:MouseEvent) 
    {     
        var container:Container = new Container();     
        container.x = 150;     
        container.y = 150;     
        addChild(container);         
    
        var container2:Container2 = new Container2();     
        container2.x = 150;     
        container2.y = container.y + container.height + 20;     
        addChild(container2); 
    }
    I've made a similar post here:
    http://www.actionscript.org/forums/s....php3?p=794148

    I hope cross-posting would be ok, otherwise I'll apologise in advance.
    Attached Files Attached Files

  13. #13
    Junior Member
    Join Date
    Sep 2008
    Posts
    16
    Thanks for looking into that issue, haplodotx. Your example also gave me a better understanding of how to pull items in from the library which I've been struggling to grasp, so I appreciate the test file as well. Thanks!

  14. #14
    Junior Member
    Join Date
    Oct 2008
    Posts
    1

    Question more stop problems

    I am making animations in Flash CS3. I do not know how to use Actionscript yet but I want to stop my animations so they do not loop in the swf files. I have added stop(); to a keyframe at the end of my timeline. Sometimes it works but most often it does not. Have tried this over and over again. What am I doing wrong? I am really tired of looking at the whole animation in test movie just to see if it is going to repeat.

  15. #15
    Junior Member
    Join Date
    Sep 2008
    Posts
    16
    nancyh, I tried a test and had the same problem with animation looping repeatedly as well. Other people have had the same problem too.

    You might check out this post though:

    http://www.actionscript.org/forums/s...=159484&page=2

    The person named "Mazoonist" provided an example which worked and didn't loop. But he put his movie clip animation inside another movie clip on the main timeline. So perhaps in order for this to work, you must create your animation inside another movie clip rather than directly on the main timeline.

    I wish I knew more myself.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center