# Constants in ActionScript

**URL:** <https://forum.kirupa.com/t/constants-in-actionscript/146375>\
**Category:** Uncategorized\
**Created:** [April 30, 2005, 4:36pm UTC](https://forum.kirupa.com/t/constants-in-actionscript/146375 "2005-04-30T16:36:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![foodpk](https://avatars.discourse-cdn.com/v4/letter/f/0ea827/32.png) [@foodpk](https://forum.kirupa.com/u/foodpk)\
**Post date:** [April 30, 2005, 4:36pm UTC](https://forum.kirupa.com/t/constants-in-actionscript/146375/1 "2005-04-30T16:36:58Z")

</div>

You know, I’ve always wondered how to make constants in ActionScripts. For instance, in some languages when you write

```auto

const CUBE_SIDES = 6;

```

then whenever you would use CUBE\_SIDES in the code, it would interpret it as 6. The trick is that you can’t change a constant, so you couldn’t do it by accident.  
How to do that with ActionScript? The only way I know is that you store your constants as variables in the \_global object.

```auto

_global.CUBE_SIDES = 6;

```

But then you could change CUBE\_SIDES if you wanted to.  
Catch my drift?
