+Majesticmerc 871

EDIT: Disregard this post. I'll keep the content, but it's wrong. I misunderstood the question.

Depends one what "UpgradeList" is. If UpgradeList is a class name, then you'll have to make _type static as well as public. If UpgradeList is a variable name, then your code is fine as long as it's public.

HOWEVER, public variables are bad form. You should prefer properties over public variables.

Share this post

Link to post

Share on other sites

+Andre S. 1,687

I just want to create around 20 buttons each with pre done text , values , positions of the button.

But I want the button to be a object.

Well it's not difficult to have something be an object, you just create a class that defines what that thing is and instantiate it.

class Button { // what a button is and does goes here}

...

var myButton = new Button(); // button object![/CODE]

Of course the tricky part is implementing a button that works and responds to mouse clicks. You'll have to define bounds in x and y for the button, and check whether the cursor is within these bounds when the user clicks.