<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr</title>
<link>http://snipplr.com/popular/language/actionscript-3</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Mon, 20 May 2013 13:15:53 GMT</pubDate>
<item>
<title>(ActionScript 3) Randomize an Array - Activetuts</title>
<link>http://snipplr.com/view/47052/randomize-an-array/</link>
<description><![CDATA[ <p>To randomize an array we loop over the length of the array, removing an object chosen at random and then adding it back onto the Array's end position. Think of this as having a deck of cards where you pick a card at random from the deck and move it to the top of the stack repeated for the total number of cards in the deck. It's important to note that the splice method returns an Array containing the removed object and not the object itself hence adding the [0] after the splice call to reference the contained object.</p> ]]></description>
<pubDate>Thu, 13 Jan 2011 22:48:04 GMT</pubDate>
<guid>http://snipplr.com/view/47052/randomize-an-array/</guid>
</item>
<item>
<title>(ActionScript 3) Position Display Objects in a Grid Layout - Activetuts</title>
<link>http://snipplr.com/view/47053/position-display-objects-in-a-grid-layout/</link>
<description><![CDATA[ <p>This is a short way of positioning display objects in a grid layout. It makes use of the modulo operator (%) to position each display object along the x axis and the floor method of the Math class for the y position.

This example creates 20 instances of a custom display object called MyDisplayObject positioning each instance in a grid 5 columns wide. As you may have guessed, the two 5's in the snippet represent the number of columns in the grid.</p> ]]></description>
<pubDate>Thu, 13 Jan 2011 22:52:51 GMT</pubDate>
<guid>http://snipplr.com/view/47053/position-display-objects-in-a-grid-layout/</guid>
</item>
<item>
<title>(ActionScript 3) AS3: Save JPEG's from Flash - chrisaiv</title>
<link>http://snipplr.com/view/6653/as3-save-jpegs-from-flash/</link>
<description><![CDATA[ <p>I found this excellent tutorial on how to save JPEG images from Flash.  You will need the Adobe JPEG Encoder class which can be found here: http://code.google.com/p/as3corelib/.  You will also need some server-side action which in this case was done in PHP</p> ]]></description>
<pubDate>Wed, 11 Jun 2008 11:05:41 GMT</pubDate>
<guid>http://snipplr.com/view/6653/as3-save-jpegs-from-flash/</guid>
</item>
<item>
<title>(ActionScript 3) Email Validation - Activetuts</title>
<link>http://snipplr.com/view/47064/email-validation/</link>
<description><![CDATA[ <p>When accepting input from a user through a form it is often necessary to validate data before allowing it to be sent to a back-end script. This is most true for email addresses as they are often the only point of contact between yourself and the user and are important to get right. The below function makes use of a regular expression to confirm the email is of a valid format.</p> ]]></description>
<pubDate>Thu, 13 Jan 2011 23:29:27 GMT</pubDate>
<guid>http://snipplr.com/view/47064/email-validation/</guid>
</item>
<item>
<title>(ActionScript 3) AS3: Regular Expression Basics - chrisaiv</title>
<link>http://snipplr.com/view/6608/as3-regular-expression-basics/</link>
<description><![CDATA[ <p>1. RegExp.text(string) returns a Boolean
2. RegExp.exec(string) returns an Object
3. String.search(pattern) returns an int
4. String.match(pattern) returns an Array
5. String.replace(pattern, replace) returns a String</p> ]]></description>
<pubDate>Fri, 06 Jun 2008 13:12:47 GMT</pubDate>
<guid>http://snipplr.com/view/6608/as3-regular-expression-basics/</guid>
</item>
<item>
<title>(ActionScript 3) AS3: Using Loader for SWFs, JPEGs, GIF, and PNGs - chrisaiv</title>
<link>http://snipplr.com/view/4995/as3-using-loader-for-swfs-jpegs-gif-and-pngs/</link>
<description><![CDATA[ <p>The Loader class is used for handling Bitmap data such as jpegs, pngs and gifs.  The only handlers most will find relevant are progressHandler and onCompleteHandler but I listed all of the available ones for people interested in creating bulletproof apps.</p> ]]></description>
<pubDate>Mon, 11 Feb 2008 17:33:38 GMT</pubDate>
<guid>http://snipplr.com/view/4995/as3-using-loader-for-swfs-jpegs-gif-and-pngs/</guid>
</item>
<item>
<title>(ActionScript 3) AS3: Sending Data using POST - chrisaiv</title>
<link>http://snipplr.com/view/4487/as3-sending-data-using-post/</link>
<description><![CDATA[ <p>This function also shows how to pass variables to a REST service.  This could also be used to pass vars that PHP can later collect as $_POST['params'].</p> ]]></description>
<pubDate>Thu, 10 Jan 2008 14:42:56 GMT</pubDate>
<guid>http://snipplr.com/view/4487/as3-sending-data-using-post/</guid>
</item>
<item>
<title>(ActionScript 3) Random Number Between Two Values - Activetuts</title>
<link>http://snipplr.com/view/47058/random-number-between-two-values/</link>
<description><![CDATA[ <p>Generating a random number is often useful when developing applications in AS3 (more so when developing games). AS3 has a built in random number method as a part of it's Math class which generates a number less than 1 and greater than or equal to 0. We can use this to create a useful function for generating a random number between two other numbers.</p> ]]></description>
<pubDate>Thu, 13 Jan 2011 23:00:12 GMT</pubDate>
<guid>http://snipplr.com/view/47058/random-number-between-two-values/</guid>
</item>
<item>
<title>(ActionScript 3) AS3: Scroller - visualadvance</title>
<link>http://snipplr.com/view/16776/as3-scroller/</link>
<description><![CDATA[ <p>This may not be useful to anyone else as is, but I wanted to keep my typical scrolling code somewhere for easy access. This uses TweenMax as well which obviously isn't included.
This assumes you have content_mc for the stuff to be scrolled, scrollArrow as your dragger, scrollerTrack as the bar the dragger follows, and contentMask to mask your content within a certain area.</p> ]]></description>
<pubDate>Wed, 08 Jul 2009 11:35:45 GMT</pubDate>
<guid>http://snipplr.com/view/16776/as3-scroller/</guid>
</item>
<item>
<title>(ActionScript 3) AS3: My favorite helper functions - chrisaiv</title>
<link>http://snipplr.com/view/10204/as3-my-favorite-helper-functions/</link>
<description><![CDATA[ <p>These are my favorite helper functions.   getFlashVars() is used to quickly pull out variables from SWFObject2, getDevelopmentMode() is used to determine whether you are working locally on your machine or if the SWF is hosted on a server,  getContextPath() is used to determine what directory the SWF is located</p> ]]></description>
<pubDate>Tue, 02 Dec 2008 11:29:30 GMT</pubDate>
<guid>http://snipplr.com/view/10204/as3-my-favorite-helper-functions/</guid>
</item>
<item>
<title>(ActionScript 3) AS3: Basic Timer example - chrisaiv</title>
<link>http://snipplr.com/view/4563/as3-basic-timer-example/</link>
<description><![CDATA[ <p>Flash's Timer Class requires two parameters. The first is the delay (in milliseconds), the second is the amount of times you want the delay to fire.</p> ]]></description>
<pubDate>Mon, 14 Jan 2008 15:15:22 GMT</pubDate>
<guid>http://snipplr.com/view/4563/as3-basic-timer-example/</guid>
</item>
<item>
<title>(ActionScript 3) Reading a file Asynchronously with ActionScript 3 - mswallace</title>
<link>http://snipplr.com/view/2937/reading-a-file-asynchronously-with-actionscript-3/</link>
<description><![CDATA[ <p>This code shows you how to load large files using as3. This is good for loading in large files. Flash Player will fire events as the data becomes available.</p> ]]></description>
<pubDate>Tue, 19 Jun 2007 05:35:01 GMT</pubDate>
<guid>http://snipplr.com/view/2937/reading-a-file-asynchronously-with-actionscript-3/</guid>
</item>
<item>
<title>(ActionScript 3) Slugify - Activetuts</title>
<link>http://snipplr.com/view/47066/slugify/</link>
<description><![CDATA[ <p>Wikipedia describes a slug as "part of a URL which identifies a page using human-readable keywords". A slug is usually a few words with each word separated by a delimiting character, usually an underscore or hyphen. A slugified version of the string "10 Tips to a Better Life!" would be "10-tips-to-a-better-life".

This function takes an arbitrary string and converts in for use as a slug. We use two regular expressions to accomplish this, the first is used to remove any character which is not a word character, space or hyphen, the second replaces any spaces with a single hyphen. Finally we convert the string to lowercase. This returns a new string, leaving the input string unchanged.</p> ]]></description>
<pubDate>Thu, 13 Jan 2011 23:31:29 GMT</pubDate>
<guid>http://snipplr.com/view/47066/slugify/</guid>
</item>
<item>
<title>(ActionScript 3) Converting Between Radians and Degrees - Activetuts</title>
<link>http://snipplr.com/view/47062/converting-between-radians-and-degrees/</link>
<description><![CDATA[ <p>When dealing with equations involving angles you will often be dealing in radians and not degrees. Display objects in Flash use degrees when dealing with their rotation property so we need a way to convert between the two. These helper function are useful for accomplishing just that; one for converting radians to degrees and the other degrees to radians.</p> ]]></description>
<pubDate>Thu, 13 Jan 2011 23:28:17 GMT</pubDate>
<guid>http://snipplr.com/view/47062/converting-between-radians-and-degrees/</guid>
</item>
<item>
<title>(ActionScript 3) Remove All Children From a DisplayObjectContainer - Activetuts</title>
<link>http://snipplr.com/view/47054/remove-all-children-from-a-displayobjectcontainer/</link>
<description><![CDATA[ <p>DisplayObjectContainer, a parent class of the more common container classes such as MovieClip and Sprite, does not have a built in method to immediately remove all children. To remove all children we simply use a while loop to remove the child which occupies index 0 in the stack until no children remain.</p> ]]></description>
<pubDate>Thu, 13 Jan 2011 22:54:53 GMT</pubDate>
<guid>http://snipplr.com/view/47054/remove-all-children-from-a-displayobjectcontainer/</guid>
</item>
<item>
<title>(ActionScript 3) Get URL of the Page Where SWF is Embedded - Activetuts</title>
<link>http://snipplr.com/view/47055/get-url-of-the-page-where-swf-is-embedded/</link>
<description><![CDATA[ <p>To get the complete URL as it appears in your web browser's address bar we use AS3's ExternalInterface class. Without going into too much detail, know that in this example we use ExternalInterface to access the DOM (Document Object Model) of the HTML page which contains our Flash. A downside of ExternalInterface is that the SWF must be embedded in the HTML page with the "allowscriptaccess" parameter set to either "sameDomain" or "always". This is OK when you control the embedding of a SWF but unfortunately cannot be relied upon if the SWF may be run on third party websites. Don’t forget to add import flash.external.ExternalInterface at the top of your document.</p> ]]></description>
<pubDate>Thu, 13 Jan 2011 22:56:11 GMT</pubDate>
<guid>http://snipplr.com/view/47055/get-url-of-the-page-where-swf-is-embedded/</guid>
</item>
<item>
<title>(ActionScript 3) AS3: Creating a Gradient Rectangle - chrisaiv</title>
<link>http://snipplr.com/view/7050/as3-creating-a-gradient-rectangle/</link>
<description><![CDATA[ <p>So I've always found gradients to be confusing until I found this great tutorial online.</p> ]]></description>
<pubDate>Tue, 01 Jul 2008 12:17:08 GMT</pubDate>
<guid>http://snipplr.com/view/7050/as3-creating-a-gradient-rectangle/</guid>
</item>
<item>
<title>(ActionScript 3) AS3 Video Skeleton - kungpoo</title>
<link>http://snipplr.com/view/11606/as3-video-skeleton/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 28 Jan 2009 08:16:57 GMT</pubDate>
<guid>http://snipplr.com/view/11606/as3-video-skeleton/</guid>
</item>
<item>
<title>(ActionScript 3) AS3: Drag n Drop - chrisaiv</title>
<link>http://snipplr.com/view/4256/as3-drag-n-drop/</link>
<description><![CDATA[ <p>Lee is a genious</p> ]]></description>
<pubDate>Mon, 03 Dec 2007 15:36:33 GMT</pubDate>
<guid>http://snipplr.com/view/4256/as3-drag-n-drop/</guid>
</item>
<item>
<title>(ActionScript 3) Find the Angle Between Two Points - Activetuts</title>
<link>http://snipplr.com/view/47060/find-the-angle-between-two-points/</link>
<description><![CDATA[ <p>This is another common snippet used by game developers for finding the angle between two points on a plane. This function has four parameters, the first pair is the x and y values of your first point and the second pair the x and y values of your second point. It's important to note this function returns the angle in radians NOT degrees.</p> ]]></description>
<pubDate>Thu, 13 Jan 2011 23:02:22 GMT</pubDate>
<guid>http://snipplr.com/view/47060/find-the-angle-between-two-points/</guid>
</item>
<item>
<title>(ActionScript 3) Round the Positional Values of a DisplayObjectContainer and its Children - Activetuts</title>
<link>http://snipplr.com/view/47057/round-the-positional-values-of-a-displayobjectcontainer-and-its-children/</link>
<description><![CDATA[ <p>This is a recursive function which takes a DisplayObjectContainer (such as a Sprite or MovieClip) and rounds the x and y values of it and it's children. It's recursive as the function calls itself when it encounters a child which is also a DisplayObjectContainer so it's children also get rounded. This recurses the entire display list beneath the passed DisplayObjectContainer, it's children, it's children's children etc.

The point of this function is to make sure the passed DisplayObjectContainer and all it's children sit on whole pixels. This can be important when dealing with graphics which aren't sitting on whole pixels as it will cause them to appear blurry. This is probably most noticeable when dealing with pixel fonts.</p> ]]></description>
<pubDate>Thu, 13 Jan 2011 22:58:52 GMT</pubDate>
<guid>http://snipplr.com/view/47057/round-the-positional-values-of-a-displayobjectcontainer-and-its-children/</guid>
</item>
<item>
<title>(ActionScript 3) AS3 Easy Mouse Panning - adamcoulombe</title>
<link>http://snipplr.com/view/36349/as3-easy-mouse-panning/</link>
<description><![CDATA[ <p>A simple demo that shows how to pan from one side of an object to another dynamically in actionscript 3.

demo at: http://www.adamcoulombe.info/lab/as3/sliderbox.html</p> ]]></description>
<pubDate>Sat, 26 Jun 2010 04:46:28 GMT</pubDate>
<guid>http://snipplr.com/view/36349/as3-easy-mouse-panning/</guid>
</item>
<item>
<title>(ActionScript 3) Upload, download images and other files with AS3 - picardo</title>
<link>http://snipplr.com/view/19778/upload-download-images-and-other-files-with-as3/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Tue, 15 Sep 2009 18:20:56 GMT</pubDate>
<guid>http://snipplr.com/view/19778/upload-download-images-and-other-files-with-as3/</guid>
</item>
<item>
<title>(ActionScript 3) AS3: Sending and Recieving Data using a GET Request - chrisaiv</title>
<link>http://snipplr.com/view/5124/as3-sending-and-recieving-data-using-a-get-request/</link>
<description><![CDATA[ <p>I needed a way to do a Database lookup using GET.  This simple example sends a GET requests and shows how to collect a response that would look like this "success=true&amp;path=xyz.flv"</p> ]]></description>
<pubDate>Tue, 19 Feb 2008 18:13:33 GMT</pubDate>
<guid>http://snipplr.com/view/5124/as3-sending-and-recieving-data-using-a-get-request/</guid>
</item>
<item>
<title>(ActionScript 3) AS3: Custom Preloader - chrisaiv</title>
<link>http://snipplr.com/view/4955/as3-custom-preloader/</link>
<description><![CDATA[ <p>Create a 100 frame MovieClip animation in companion with this code to create a preloader. Place the rest of your Flash application on the following Scene or Frame</p> ]]></description>
<pubDate>Fri, 08 Feb 2008 18:17:07 GMT</pubDate>
<guid>http://snipplr.com/view/4955/as3-custom-preloader/</guid>
</item>
</channel>
</rss>