A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: MC problems [HELP]

  1. #1
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870

    MC problems [HELP]

    I got a MC here and it's gonna be a tic-tac-toe game, I put "stop" AS on all 3 Frames in the movieclip.
    The First frame is empty, The second is cross, and the third is circle.
    I placed the MC onto the stage, but now i face a AS error, I am using a made-up AS:

    Code:
    On(Press)
         This.gotoAndStop("2")
         If(This.gotoAndStop("2")
                GotoAndStop("3")

    Nope it's not working.

    Anyone got some fresh ideas?
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  2. #2
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    Hey

    Ok, first of all remember that when you gotoAndStop(); to a frame, its a number. This means that there is no " " around it

    Secondly, "This" should be "this" (it will turn blue).

    Finally, if thats on a movieclip, it needs to be in a handler.



    Ok now try this, place the following code on the first frame of your actions layer:
    code:
    mcInstance.onPress = function(){
    this.gotoAndStop(2);
    if (this._currentframe ==2){
    this.gotoAndStop(3);
    }
    }
    }



    Another few reminders. Put ; after your code lines and remember that IF statments must be wrapped in {} brackets. Finally its gotoAndStop() not GotoAndStop();

    If your using a premade code such as "if" , "this" , "gotoAndStop();" it will turn blue , thats a way of making sure you typed it correctly
    Last edited by Osteel; 11-25-2005 at 10:02 AM.

  3. #3
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    Cool, Thanks.
    You are saving my life here man!
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  4. #4
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    No I got it blue alright, but its quite stupid sometimes and it don't work on me...
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  5. #5
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    Haha, well good to know you got it now

  6. #6
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    Quote Originally Posted by Osteel
    Hey

    Ok, first of all remember that when you gotoAndStop(); to a frame, its a number. This means that there is no " " around it

    Secondly, "This" should be "this" (it will turn blue).

    Finally, if thats on a movieclip, it needs to be in a handler.



    Ok now try this, place the following code on the first frame of your actions layer:
    code:
    mcInstance.onPress = function(){
    this.gotoAndStop(2);
    if (this._currentframe ==2){
    this.gotoAndStop(3);
    }
    }
    }



    Another few reminders. Put ; after your code lines and remember that IF statments must be wrapped in {} brackets. Finally its gotoAndStop() not GotoAndStop();

    If your using a premade code such as "if" , "this" , "gotoAndStop();" it will turn blue , thats a way of making sure you typed it correctly
    Wait a minuit, Flash don't reconise my instance name... What should I name it?
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  7. #7
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    I added a stop in front of that AS mind
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  8. #8
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    It doesnt recognize your instance name?

    Give it something like 'test' and then change the code accordingly

    code:
    _root.test.onPress = function(){
    this.gotoAndStop(2);
    if (this._currentframe ==2){
    this.gotoAndStop(3);
    }
    }
    }


  9. #9
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    stop();
    _root.test.onPress = Function(){
    this.gotoAndStop(2);
    if(this._currentframe ==2){
    this.gotoAndStop(3);
    }
    }
    }

    Still don't, the bold bit's still black....
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  10. #10
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    Maybe i should test the movie.. I didn't bother to do that yet...
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  11. #11
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    Haha tongxn - it wont turn blue ...

    Instance names will remain black. BLUE lettering is for premade built in Flash functions such as gotoAndStop(), stop(), trace();

    Things like that

    Sorry to confuse you

  12. #12
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    Nope the stop function is not working!!!

    EVERYTHING HAPPENS TOOOO MEEEEEEEEEE! WYYYYYYYY?!
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  13. #13
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    And the AS u gave me!
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  14. #14
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    Oh wait I see your mistake

    Remember, function is LOWER CASE

    Spelling counts


    Also there is a mistake in my code too , there should only be two closing brackets:

    code:
    _root.test.onPress = function(){
    this.gotoAndStop(2);
    if (this._currentframe ==2){
    this.gotoAndStop(3);
    }
    }

    Last edited by Osteel; 11-25-2005 at 01:54 PM.

  15. #15
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    No I don't think that works.....
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  16. #16
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    Really, I tested it and it worked fine for me ...

    1) Make a movieclip and give change its instance name to test
    2) On the very first frame of your main timeline, paste that code ...
    3) Run the program and click on your movieclip


    By the way, go to www.carpages.ca and click the games link at the top. Check out my very first (pretty cheap) car racing game

  17. #17
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    ... mmm... Ok!
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  18. #18
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    They are amazing.. How did u do the hittest on the forest bit?
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

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