[Tutorial] Buttons (Beginner) page 2

36 posts

Flag Post

IndieFlashArcade: I’ve heard that from a lot of video tutorials and whatnot recently, but why is it recommended to use MovieClips over Buttons? Is it just that Buttons are redundant when MovieClips can do the same things or is there some other reason?

 
Flag Post

It’s because MovieClips have a lot of useful functions (or methods) that buttons do not have. You just don’t have the same level of control over it if it’s a Button.

I didn’t make this stuff up, it’s just a best practices thing.

 
Flag Post

I didn’t make this stuff up, it’s just a best practices thing.

Yeah, I believe you. I’ve noticed from your posts that you definitely seem to know your ActionScript.

And thanks for posting the tutorial on Buttons. I’ll definitely take it into account in the future.

 
Flag Post

It depends on the circumstances. Sometimes you dont want those extra methods; and they become baggage; other times they are useful. Generally, its not wise to make use of a heavier class if it contains unneeded functionality that a lighter class doesnt. Most of the general functionality used with MovieClips are also accessible to the button class. They are very similar for the most part; the button class is like a toned down version of the MovieClip class that automatically reacts visually to mouse events without the need to code it.

 
Flag Post

Yeah that makes sense… I don’t think about the size of the class when I create MoveClips, but mostly it wouldn’t make much of a difference unless it was in a game.

But that’s the way that I’ve been told is the ‘right’ way to make a button. Lately though, in my personal work, I’ve been more focused on creating custom UI with classes (so I can just use one line of code to initialize an entire menu), and I end up using MovieClips anyway.

In many cases Buttons are prollie fine.

 
Flag Post

Your method is interesting, but I’m still sticking to my method, which I think is a lot quicker to do. My tutorial was meant more for animators rather than ActionScripters anyway, as it doesn’t need as much understanding or work. I personally prefer to use movieclips when I need a button as part of a game :)

 
Flag Post

I think that this guide is a good start no need t spam it with other version of you own tuts for that you might use thehandy dandy new topic button

 
Flag Post

It’s not spam, genious boy, it’s a discussion of how you could do it better. Whether or not you use the Button class (which I’ve been told not to do by industry professionals), you should be using dot notation and avoiding use of the

 on( ) 

keyword, because that way of programming is the very outdated, AS 1 way.


My method of making buttons does happen to be more cumbersome, but like I said I don’t even really make buttons that way anymore, I use classes.

Just try making the really cool buttons that you see on many high-end Web sites with the Button class. It works okay for beginners but I’m just trying to help you guys do it better.

 
Flag Post

editundo:

Yeah I’m glad we agree about using MovieClip buttons in games… Since this is a games site, and a games programming forum, I thought it might be approros.

 
Flag Post

Good point, it honestly only just occured to me that animators wouldn’t come here :p

 
Flag Post

Thanks indie. I still used that on handler lolz :)