Kilometer0

Quick AS3 Tips

These are some small code snippets that I find useful and refer to often:

To instantiate a class when you only have the name of it as a string in ActionScript 3.0, you can use:

var myClass:Class = flash.utils.getDefinitionByName(myLinkage) as Class;
  1. var myVar = new myClass();

There is no standard way of converting an RGB value to Grayscale. However the following formula works well:
R * 0.30 + G * 0.59 + B * 0.11

share
 

Permalink: Quick AS3 Tips

Created:

« Back to Code Snippets

Leave a comment

You must be connected to post a comment.