What does this mean for me? You will always be able to play your favorite games on Kongregate. However, certain site features may suddenly stop working and leave you with a severely degraded experience.
What should I do? We strongly urge all our users to upgrade to modern browsers for a better experience and improved security.
We suggest you install the latest version of one of these browsers:
Kongregate is a community-driven browser games portal with an open platform for all web games.
Get your games in front of thousands of users while monetizing through ads and virtual goods.
Learn more »
I tried for a long time to have it work, but I always get errors. I know its an easy question, but can someone help me. I have an upgrade menu for my game. Inside my upgrade menu, I have a button ( Upgrade). I try to add an eventListener ( when mouse click) to the button inside my menu, but I don’t know how to add it to the button, I always get errors.
Thanks, But I still have the problem. Because what I want to know is how to add the eventListener to my upgradeButton who is inside my Menu. Do I have to create a var for it? Or do I have to refer to it like Menu.upgradeButton.addEventListener …..
\*With the last line, I get error 1119 and 1120.
Let’s assume that where you put the eventListener, you have the menu as a variable ‘menu’. Also, the upgradeButton should be a public variable of the menu class, so it can be accessed from outside.
Then you can just write:
var button:WhateverClassThisIs = menu.upgradeButton;
There are tons of ways to do it, but this is the way I’d use.
…. In your menu class make sure to reference the instance variable names not the name of the movieclip but the name of its instantation inside of your menu MovieClip.
Go to your menu MC and select your upgrade button inside of the menu MC and go to properties pane and give it an instance name of (whatever you want, lets say Cheese).
so back in your menu class it should be Cheese.addEventListener(MouseEvent.CLICK, upgrade);
I still do something wrong. Sorry this is my first game. Here is my code:
static var menuInGame:MovieClip;
var upgradeButton:MenuInGame = menuInGame.UpgradeButton;
menuInGame = new MenuInGame();
menuInGame.x = 0;
menuInGame.y = 700;
edit\* And trying the last line like this also give me error 1120 : upgradeButton.addEventListener(MouseEvent.CLICK, clickUpgradeButton);