# Extending Button Class?

**URL:** <https://forum.kirupa.com/t/extending-button-class/119866>\
**Category:** Uncategorized\
**Created:** [August 18, 2004, 6:16pm UTC](https://forum.kirupa.com/t/extending-button-class/119866 "2004-08-18T18:16:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sttuffy](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@sttuffy](https://forum.kirupa.com/u/sttuffy)\
**Post date:** [August 18, 2004, 6:16pm UTC](https://forum.kirupa.com/t/extending-button-class/119866/1 "2004-08-18T18:16:55Z")

</div>

Hi all, sorry if this has been answered somewhere else (I searched) or if the answer is super easy (It’s possible I’m just retarded).

I am working on an interface that will have literally hundreds of buttons, navigating back/forth/in-between dozens of sections and subsections. I love the ease of skinning/labeling the built-in button component, but my fingers are rebelling at the thought of typing(or at least copy/pasting) “on(release)/gotoandplay/lastSection=/etc”.

So, I figured since I was already planning on having extensive frame labeling, I would just make the instance name of the button the same as the frame label where I wanted it to go. Then just have “gotoAndPlay(this.\_name)” on each Button.

My question then is thus: How do i make the following a part of the button component (or a different version of it, so I still use the default component for the couple of buttons I don’t want to do this), everytime I drag one onto the stage?

```auto
on (click) {
	nextSection = this._name;
	lastSection = _root._currentframe;
	gotoAndPlay(nextSection);
}

```

Thanks so much to anyone who can help me out! And if there is a super easy way of doing this, please smack me, then let me know what it is 🙂

---

<div class="post-metadata">

**Author:** ![sttuffy](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@sttuffy](https://forum.kirupa.com/u/sttuffy)\
**Post date:** [August 19, 2004, 3:39pm UTC](https://forum.kirupa.com/t/extending-button-class/119866/2 "2004-08-19T15:39:27Z")

</div>

Just in case anyone cares, I figured this out, thanks to the new help files included in 7.2. It was actually pretty easy, I just duplicated both the button component and button.as, renamed them and added the extra bits to my new .as. Now all I have to do is put my new button on the stage, change the label, icon and instance name and my fingers are very greatful. :krazy:

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [August 19, 2004, 3:49pm UTC](https://forum.kirupa.com/t/extending-button-class/119866/3 "2004-08-19T15:49:52Z")

</div>

yeah thats breifly touched upon in the AS2.0 tutorial on kirupa. Sorry I didnt get here sooner or I could have told you without you having to look it up… though looking things up is always a good practice 😛

---

<div class="post-metadata">

**Author:** ![sttuffy](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@sttuffy](https://forum.kirupa.com/u/sttuffy)\
**Post date:** [August 19, 2004, 4:08pm UTC](https://forum.kirupa.com/t/extending-button-class/119866/4 "2004-08-19T16:08:27Z")

</div>

> [@senocular](#):
>
> though looking things up is always a good practice 😛

And pretty useless in this case before downloading 7.2, 😃 the help files in the first release were sorely lacking (I thought) when it came to explaining how to extend components, especially for a class noob like myself. 🍺

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [August 19, 2004, 4:14pm UTC](https://forum.kirupa.com/t/extending-button-class/119866/5 "2004-08-19T16:14:21Z")

</div>

Macromedia is definitely not known for their documentation 😉 … well that’s not entirely true since they _are_ known for _poor_ documentation :trout:

---

<div class="post-metadata">

**Author:** ![sttuffy](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@sttuffy](https://forum.kirupa.com/u/sttuffy)\
**Post date:** [August 19, 2004, 4:24pm UTC](https://forum.kirupa.com/t/extending-button-class/119866/6 "2004-08-19T16:24:36Z")

</div>

> [@senocular](#):
>
> Macromedia is definitely not known for their documentation 😉 … well that’s not entirely true since they _are_ known for _poor_ documentation :trout:

Indeed, I think if it weren’t for the Kirupa Krew (sorry… that was lame :sigh: ) I would have given up on Flash long ago. 😛

---

<div class="post-metadata">

**Author:** ![Dunga](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@Dunga](https://forum.kirupa.com/u/Dunga)\
**Post date:** [August 19, 2004, 10:04pm UTC](https://forum.kirupa.com/t/extending-button-class/119866/7 "2004-08-19T22:04:09Z")

</div>

I haven’t had that much trouble with the flash documentation… then again I did go and get a flash book.  
Truely bad documentation is found in the SWFKit helpfile. Barely any code snippets and the ones that are there use quotes like this: ``HI!’ '.
