# Do I always have to create an instance of my class when I want to use code in it?

**URL:** <https://forum.kirupa.com/t/do-i-always-have-to-create-an-instance-of-my-class-when-i-want-to-use-code-in-it/325720>\
**Category:** flash\
**Created:** [November 1, 2011, 6:21pm UTC](https://forum.kirupa.com/t/do-i-always-have-to-create-an-instance-of-my-class-when-i-want-to-use-code-in-it/325720 "2011-11-01T18:21:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mufanza](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@Mufanza](https://forum.kirupa.com/u/Mufanza)\
**Post date:** [November 1, 2011, 6:21pm UTC](https://forum.kirupa.com/t/do-i-always-have-to-create-an-instance-of-my-class-when-i-want-to-use-code-in-it/325720/1 "2011-11-01T18:21:40Z")

</div>

Hi again 😃  
There’s another thing I don’t fully understand in ActionScript 3 yet…

Let’s say I have a class that takes care of certain things (KeyPress events, to be specific). But when I want to access the functions inside this class, do I have to create a new instance of it?  
I mean, I can do:

```auto
var myInstance = new myClass();
myInstance.myFunction();
delete myInstance

```

But that seems a little pointlessly complicated… For example, when I call Math.round() function, I don’t have to create a new instance of Math! Can’t I do this with my own classes as well?
