A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: my button doesnt work

  1. #1
    Junior Member
    Join Date
    Jan 2006
    Posts
    7

    my button doesnt work

    ive had probelms all day about a button at the end of my intro animation.... the second to last frame (132) has:

    Code:
    gotoAndStop(133);
    which seems to work fine

    the problem lays with the button on frame 133:

    Code:
    on (release) {
    	gotoAndPlay("2", 1);
    }
    i thought using scenes would make it more organized. also, when i play the animation and it stops on frame 133 with the button, i can click the button all i want and nothing happens, but if i right click and hit play the movie moves onto the second scene. plz help

  2. #2
    Senior Member EQFlash's Avatar
    Join Date
    Jun 2002
    Location
    where i'm at
    Posts
    2,735
    Rename your scene to something with a word in it, say, "Scene 2"
    and the code would be
    on(release){
    _root.gotoAndPlay("Scene 2",1);
    }
    If you don't think you're going to like the answer, then don't ask the question.

  3. #3
    An FKer
    Join Date
    Sep 2005
    Location
    Ontario
    Posts
    1,167
    EQFlash is right, you cant start a instance or scene name with a number,

    But theres another solution to your problem. Instead of telling the movie to go to a scene and a frame number, you can tell it to go to and play from a frame name.

    Open up your second scene and click on the first frame. At the bottom you will see a spot where you can name this frame. Give it a frame label of something like secondScene

    So now all you do is change the code to:

    code:

    on (release){
    _root.gotoAndPlay ("secondScene");
    }



    It searches the movie for a frame label with that name, and since its on your second scene , frame 1 , it will play at the right spot.

    This does the same, but for some reason is more reliable

  4. #4
    Junior Member
    Join Date
    Jan 2006
    Posts
    7
    Thanks for your help guys, nice and quick. I like this site already

    I tried to do what you said, but the problem I think lays with the button. so i took it out and I'm just gonna use a trigger that makes hitting the right arrow go to the next scene as shown with this code:

    Code:
    on (keyPress "<Right>") {
    	_root.gotoAndPlay("location");
    }
    I have no idea what is wrong with the button, its a symbol and has different frames for "up" "down" "hit" and "over" but I'm not 100% sure what those mean.
    For this project I can leave it to using the arrow keys, but some other project I do might need a button. Further help will be appreciated on the button.

  5. #5
    Senior Member
    Join Date
    Jun 2005
    Posts
    132
    keypresses are used for keyboard control presses, not an actually button, just in case you dsont realize (i think you do)

    The frames on a button are sort of a special frame, and tell the button what it should look like for those varying conditions. So if you have a button that is up and not moused over, it will look like one thing,if you mouse over it, it will look like something else, and if you press down on the button, it changes to something else entirely. "Hit" is what is used to define the area that you can click in and "hit" the button. Thats the most important one, as without that, the button wont work too well

  6. #6
    Junior Member
    Join Date
    Jan 2006
    Posts
    7
    i had a different frame for each of those 4 conditions but only "up" showed up even when moused over or even pressed...

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