02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Button Instance Names

Ok we have a button on the stage now... Actually we have two buttons on the stage... so how are we going to be able to differentiate between them?

Video Transcript

00:00We want to give a name to our element so even though we have your to btn right to btn ovals
00:05We still need to have a way to differentiate between these two right and give them a name to do that
00:10I'm going to go into my properties panel again, and then I'm going to give my property
00:15I'm going to give a name to my first button. I'm going to call it btn
00:18We're going to call it btn
00:22move
00:24One and I'm going to go to the second item, and I'm going to call it
00:30btn
00:33move
00:35two and
00:36I'm going to save my fla the next step the same way as we did with our
00:42Same way as we did with our text field. We want to actually now add and we could delete this line because it's not needed
00:50We want to delete our property, so I want to add our property, so we're going to add a new public
00:56Variable just before our main constructor, and we're going to give it our name which was btn move one
01:03Which was a type of what?
01:05simple button and
01:09Same thing again. We want to create a public
01:12var
01:14btn
01:15move two
01:17Which again is a type of simple button?
01:21Let's just run our application to make sure that it really was a simple button and that everything is connecting and we're
01:27Not getting any errors so far so good, and if we roll over our button
01:31We're going to see that automatically it has an arrow which indicates that it's going to be an interactive button
01:37clickable button more accurately

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!