[AS3] CS5 flash ignoring stop function. nextFrame becomes last frame

Discussion in 'Mixed Languages' started by pettersenper, Apr 17, 2011.

  1. pettersenper

    pettersenper MDL Novice

    Mar 17, 2011
    3
    1
    0
    #1 pettersenper, Apr 17, 2011
    Last edited by a moderator: Apr 20, 2017
    Hello, I am trying to make my first flash game but have a problem adding more levels. In main timeline I have a layer that contains my levels. So far 3 test levels. In the actions layer in the main timeline I have this code


    Code:
    if (circle_mc.hitTestObject(platforms.goal1))
    {
    nextLevel.alpha = 1.00
    nextLevel.addEventListener (MouseEvent.CLICK, nextLevel1);
    
    function nextLevel1(evt:MouseEvent):void
    {
    
    platforms1.nextFrame();
    
    }
    instead of sending me to the next frame in platforms layer it sends me to the last frame. This also happens if I add more frames. I've tried varying the placement of the eventlistener and function with no luck

    I've added the .fla file. Please take a look and please make the answer simple, i'm just a newbie and do not understand codes such as container and addChild();.
     

    Attached Files:

  2. pettersenper

    pettersenper MDL Novice

    Mar 17, 2011
    3
    1
    0
    Once again this forum fails to help me before my homecountry's small forum (not dedicated to computer) gives me a solution. Here I guess nobody cared as it was a quite easy solution , but it still might be someone in the future having the same problem so I post the solution here anyway.

    The old way apparently gave flash problems because it added a new listener everytime the circle hit the goal. This led to the ignoring of the stop function. Placing the function nextLevel1(evt:MouseEvent):void
    outside of the movecircle function solved the problem
     
  3. Calistoga

    Calistoga MDL Senior Member

    Jul 25, 2009
    421
    199
    10
    We failed him once again

    I would have answered if I knew the solution, and so would most other people. Want me to apologize for not being a flash developer?

    You're comparing the dedicated Flash and Animation section of diskusjon.no (which for your information is not a small forum) to the MDL 'general coding' section.

    Wow.
     
  4. pettersenper

    pettersenper MDL Novice

    Mar 17, 2011
    3
    1
    0
    Sorry

    No, I don't want you to apologize. And yes I beleived a norwegian forum had a lot smaller (atl least computer) community than a english more international one more dedicated to computers. That dedicated flash forum only has a few threads from this year.

    I see now that it was stupid of me to say that and I apologize.
    I just didn't get a very positive reply to my last question here neither, and.. I don't know, maybe I let that unreasonable affect my attitude here. Sorry...