---
id: 617
title: ActionScript Enums
slug: actionscript-enums
date: '2008-10-26T19:30:16Z'
modified: '2008-10-26T19:30:16Z'
status: publish
type: post
author: pmoelgaard
categories:
  - ActionScript 3.0
tags: []
excerpt: null
canonicalPath: /posts/actionscript-enums
featuredImage: null
commentCount: 3
wordCount: 124
readingTimeMinutes: 1
hasMedia: false
hasVideos: false
url: 'https://forwardthinking.pemo.me/posts/actionscript-enums'
---
I found myself almost posting an article about how to fake Enum's in ActionScript, when Sam Rivello pointed me to an existing and very lightweight implementation by Scott Bilas.

[http://scottbilas.com/2008/06/01/faking-enums-in-as3/](http://scottbilas.com/2008/06/01/faking-enums-in-as3/)

Browsing around a little bit more, I found a couple of more details relating to Scott's implementation and things that could be added to the lightweight implementation by Scott.

One is Barney Boisvert's addition of having the static constructor to prohibit the construction of instances other than the static constants instantiated at class loading time.

[http://www.barneyb.com/barneyblog/2007/11/02/enums-and-actionscripts-static-initializers/](http://www.barneyb.com/barneyblog/2007/11/02/enums-and-actionscripts-static-initializers/)

Both of these suggestions definitely beat the default implementations for Enums which involve using value types such as string and numeric values… so check it out if you are tired of using string literals in place of Enums.
