To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Actionscript 3.0

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 01-24-2009, 02:18 PM   #1
the last stand
Junior Member
 
Join Date: Jan 2009
Posts: 1
ActionScript "3" Button help!!

I just switched from Action Script 2 to Action Script 3 to test a bit. But now I am sitting firmly on a really annoying problem.

I was going to make a small game and to do so, I created a Start button and then 3 buttons to choose which level to begin on. simply made a text in frame "1" and the converted it into a button with <Instance name> START_BUTTON. in frame 1 This is the code:

Code:
stop();

START_BUTTON.addEventListener(MouseEvent.CLICK, clickedButton);

function clickedButton (event:MouseEvent)
{
        gotoAndStop(2);
}
on frame "2" so I crerated 3 buttons with <Instance name> EASY_BUTTON, NORMAL_BUTTON and HARD_BUTTON. The code to this is:

Code:
EASY_BUTTON.addEventListener(MouseEvent.CLICK, clickedButton);

function clickedButton3 (event:MouseEvent)
{
        gotoAndStop(3);
}

NORMAL_BUTTON.addEventListener(MouseEvent.CLICK, clickedButton);

function clickedButton4 (event:MouseEvent)
{
        gotoAndStop(4);
}

HARD_BUTTON.addEventListener(MouseEvent.CLICK, clickedButton);

function clickedButton5 (event:MouseEvent)
{
        gotoAndStop(5);
}
when I click on START_BUTTON it takes me from frame "1" to frame "2" and thats great. BUT on frame "2" none of the three buttons is working. I can see that there are buttons when I drag the mouse over them but nothing happens when I click on em. Ofcourse I have done something on frame 3,4,5 so the problem is not that the buttons has none frame to go to.

What do i do wrong?

I am very happy for all the answers!!!
the last stand is offline   Reply With Quote
Old 01-24-2009, 11:55 PM   #2
friedegg3
Member
 
Join Date: Dec 2004
Posts: 53
In all of your event listeners you are assigning the function 'clickedButton', so each button takes you to frame 2. Change the EASY_BUTTON event listener's function to 'clickedButton3', the NORMAL_BUTTON's function to 'clickedButton4', and so on.
friedegg3 is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Actionscript 3.0

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:55 AM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.