PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
MX Strange problem with buttons and movie clips...
A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: Strange problem with buttons and movie clips...

  1. #1
    Junior Member
    Join Date
    Nov 2008
    Posts
    10

    Question Strange problem with buttons and movie clips...

    hey all,

    i've been having trouble with this all day, and i can't quite figure out what's wrong.

    there's an NPC in my game that is supposed to speak. right now, there's a button ("arrow_btn") inside the NPC movie clip ("evilulu_mc") that is supposed to progress the conversation when pressed.
    the conversation starts on frame 3 of evilulu_mc, so naturally the button on frame 3 is supposed to gotoAndStop to frame 4, and the button on frame 4 to frame 5, and so on. frame 3 to frame 4 works fine, but for some reason the arrow on frame 4 goes BACK to frame 3 instead of going to frame 5! why?

    code on evilulu_mc:
    Actionscript Code:
    on (release) {
        this.gotoAndPlay(3);
    }

    code on frame 3 button:
    Actionscript Code:
    on (release) {
    this._root.gotoAndPlay(4);
    }

    code on frame 4 button:
    Actionscript Code:
    on (release) {
    this._root.gotoAndPlay(5);
    }

  2. #2
    Senior Member
    Join Date
    Apr 2009
    Posts
    138
    when you go to a button's actionscript on the root level and put a code, that code will always run when initiated.

    Since you have

    Actionscript Code:
    on (release) {
        this.gotoAndPlay(3);
    }

    Every time you press and release this evilulu_mc (or what ever btn has the actionscript) it will run that command. You have two options.

    Actionscript Code:
    on (release) {
    if (!evilulu_once){
        this.gotoAndPlay(3);
    evilulu_once = true;
    }
    }

    or you can not have any commands on the btn, and inside it you can have a button that makes it go to the next frame. And on the next frame don.t include that code.

  3. #3
    Junior Member
    Join Date
    Dec 2010
    Location
    United States
    Posts
    10

    Strange problem with buttons and movie clips.

    Use this code for to solve your problem.

    on (release) {
    if (!evilulu_once){
    this.gotoAndPlay(3);
    evilulu_once = true;
    }
    }

  4. #4
    Junior Member
    Join Date
    Nov 2008
    Posts
    10
    i tried taking the code off evilulu_mc and putting a button inside it instead, but then it didn't do anything at all when clicked. and with the if (!evilulu_once){ code, it goes to frame 3 and stops. what am i doing wrong?

  5. #5
    Senior Member
    Join Date
    Nov 2004
    Posts
    928
    post the fla. perhaps you should be using gotoAndStop() instead so the playhead stops on frame 4 rather than gotoAndPlay() which plays from frame 4. but without the fla - who knows

  6. #6
    Junior Member
    Join Date
    Nov 2008
    Posts
    10
    here's a mediafire link to the .fla.

    sorry i had to upload it on another site, but it was 76.5 kb too big, even after i purged the library.

  7. #7
    Senior Member
    Join Date
    Nov 2004
    Posts
    928
    you are using an out of date way of writing code.
    - double click the evilulu_mc and on the first frame in the movieClips timeline write -
    - Frame1 -
    Actionscript Code:
    stop();
    this.onRelease = function() {
        this.gotoAndStop(3);
    }

    - Frame 3 -
    Actionscript Code:
    stop();
    this.onRelease = function() {
        this.gotoAndStop(4);
    }

    Frame 4 -
    Actionscript Code:
    stop();
    this.onRelease = function() {
        this.gotoAndStop(5);
    }

    I hope you see what I am doing. and so carry on for however long you need to.

  8. #8
    Junior Member
    Join Date
    Nov 2008
    Posts
    10
    same thing as before; it goes to frame 3 and stops. and when i take the code off of evilulu_mc nothing happens when i click it, even though the movie clip on frame 1 (within evilulu_mc) has the this.gotoAndStop(3); code.

    maybe i need to use an if(condition), else{null;} code or something so that after going to frame 3 it acts on the arrows' codes and not evilulu_mc's?

  9. #9
    Senior Member
    Join Date
    Nov 2004
    Posts
    928
    hope this works - it works for me. i wont be reading my emails for 2 or 3 days so if you have a problem let me know and when i can i will get back to you.
    Merry Christmas
    Last edited by gorlummeeguvnor; 04-19-2011 at 04:32 PM.

  10. #10
    Senior Member
    Join Date
    Nov 2004
    Posts
    928
    even though the movie clip on frame 1 (within evilulu_mc) has the this.gotoAndStop(3); code.
    rereading your post.
    Just in case you cant open the fla - its in flash8 - the code I gave you needs to be inside the evilulu_mc where you placed all the stop()'s. And delete the on(release) handler that you put on the evilulu_mc.
    good luck

  11. #11
    Junior Member
    Join Date
    Nov 2008
    Posts
    10
    Quote Originally Posted by gorlummeeguvnor View Post
    hope this works - it works for me. i wont be reading my emails for 2 or 3 days so if you have a problem let me know and when i can i will get back to you.
    Merry Christmas
    can you just tell me what codes go where? i can't open the file, and it seems like no one online is willing to convert it for me.

    thanks for helping.

  12. #12
    Senior Member
    Join Date
    Nov 2004
    Posts
    928
    what version of flash are you using?

  13. #13
    Junior Member
    Join Date
    Nov 2008
    Posts
    10
    Flash MX.

  14. #14
    Senior Member
    Join Date
    Nov 2004
    Posts
    928
    please post the flash mx fla

  15. #15
    Junior Member
    Join Date
    Nov 2008
    Posts
    10
    okay. and don't worry about the character with the blue hair; she's supposed to move using the arrow keys, and i got that code to work, but i had to take that out of this file so it would be less than 300kb.
    Attached Files Attached Files

Tags for this Thread

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