Actionscript

Total 6 Posts

AS3: Regular Expression Basics

Here are some Regular Expression basics in Actionscript 3. RegExp.text(string) returns a BooleanRegExp.exec(string) returns an ObjectString.search(pattern) returns an intString.match(pattern) returns an ArrayString.replace(pattern, replace) returns a String//Using Replace var toungeTwister:String = "Peter Piper Picked a peck of pickled peppers"; //g

AS3: Use HTML and JavaScript to send Text to Flash

This is the first of two ways to send Text to Flash using HTML and JavaScript. To follow my example, you must download and link to [SWFObject](http://blog.deconcept.com/swfobject/). <!-- /******************************* This Code Goes inside your FLA *******************************/ import flash.external.ExternalInterface; import flash.events.Event; ExternalInterface.addCallback(

AS3: Regular Expression Basic example

The first example strips out the HTML. The second example shows how to target a single quote using unicode. //////////////////////////////////////////// //Example 1: //////////////////////////////////////////// var re:RegExp = /<font face=\u0022(.*)\u0022 >(.*)<\/font>/i; var str:String = '<P ALIGN="LEFT"><FONT FACE="Arial" >this is

AS2: Inline CSS

This shows how to create Cascading Style Sheets using ActionScript. /************************** CSS Translation of Properties **************************/ /* HTML ActionScript color color display display font-family fontFamily font-size fontSize font-weight fontWeight margin-left marginLeft margin-right marginRight text-align textAlign text-decoration textDecoration */ //A. Create a new Style Sheet var ss = new TextField.StyleSheet(); ss.setStyle(".headline", {color:"#FFCCCC"

AS1: Swap Numbers

Needed a way to mix up the order of questions and answers for a Flash quiz. MovieClip.prototype.swapNumbers = function(numOfDigits:Number) { //1. Construct a temporary array var newOrder:Array = new Array(); //2. Build a condition where the array must have a specified number of digits while (newOrder.length != numOfDigits)

AS3: Placing an Overlay Over an Image

So here's the scenario, suppose your loading an image, SWF, etc., but if any other kind of error occurs in your application, you want an error message to display above the image. There are many different ways to accomplish this task, so I thought it would be helpful to show