A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Button only works when clicked twice

  1. #1
    Junior Member
    Join Date
    Apr 2003
    Posts
    4

    Button only works when clicked twice

    I created a simple button which works fine in the .fla file. It has a "go to frame 2 and play" action. Whenever I export the file, the button does not work on the first click. It shows the down state fine, but you have to click twice to activate the action.

    Please help.

    Yes, I'm more or less a beginner.

  2. #2
    Senior Member ikaros's Avatar
    Join Date
    Aug 2002
    Location
    Approaching the Sun
    Posts
    480
    This shouldn´t be possible. I´m afraid I don´t have a solution. Does it work when previewing in Flash but not in the published swif? Have you tried viewing it in browser?
    If you have Flash MX try exporting as Player5 and see if it work then.

    Many strange things can happen in FLash. Such as image shifting i.e. (but that can be avoided by using 1% and 99% etc.). I sometimes quote Sherlock Holmes: "When you exclude the impossible remains the unlikely". Sorry I couldn´t quite help, but I hope others can...

    regards
    ik.
    I cannot live without dreaming, but maybe it is just a dream that I am living...

  3. #3
    Junior Member
    Join Date
    Apr 2003
    Posts
    4
    Thanks for responding ik. It works fine in the .fla file preview with buttons enabled. It does not work in the .swf preview file or in any browser, same double click problem.

    The thing is, I know that it's something on my end, because, I made a completely different movie - starting from scratch, and had the same problem.

    Anybody?

  4. #4
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    I've had this happen before. I have no idea what it was. Sometimes, fla files or symbols get corrupted and you have to delete them and rebuild them. Can you attach the fla with the bad button?

    Some things to doublecheck. Is the code on the button instance itself, or in a frame? Did you publish in flash 6, or 5? Copy and paste the exact code you used on the button, in here so we can see it.

  5. #5
    Junior Member
    Join Date
    Apr 2003
    Posts
    4
    The code was definitely on the button instance. Anyway since I last posted, I rebuilt the file from scratch, and the problem has been solved.

    But if you're curious, here's the bad (and good) button instance code pasted below. The bad code was generated by following tutorial instructions. The good was arrived at by trial and error.I don't understand why the bad one worked in the .fla file preview mode, though.

    *Bad code*

    on (release) {
    ShowMe.onPress = function() {
    gotoAndPlay(2);
    };
    }


    *Good code*

    on (release) {
    ShowMe.onPress = function() {
    };
    }
    on (release) {
    gotoAndPlay(2);
    }

  6. #6
    FK's Geezer Mod Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Yup, the code was wrong, sort of. The bad code is not meant for a button, but for a frame action. This part of it:

    ShowMe.onPress = function() {
    gotoAndPlay(2);
    };

    Would have worked fine in a frame, if the button was given an instance name of ShowMe and was published in F6/

    In fact, it's the preferred way to go if you can publish in 6. You could use that code on a button, a movie clip, anything you can give an instance name to. I've found that using frame code get's rid of a lot of the 'sticky button' problem too.
    Last edited by iaskwhy; 04-20-2003 at 11:07 PM.

  7. #7
    Junior Member
    Join Date
    Apr 2003
    Posts
    4
    It's all starting to sink in. Thanks for your help, iask.

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