Snipplr - adrianparrhttp://snipplr.com/users/adrianparr/tags/as3
Recent snippets posted on Snipplr.comen-usWed, 01 Apr 2015 07:53:52 GMT(ActionScript 3) AS3 Drawing Shapes (ARC, BURST, DASHED-LINE, GEAR, POLYGON, STAR, WEDGE, LINE)http://snipplr.com/view/67582/as3-drawing-shapes-arc-burst-dashedline-gear-polygon-star-wedge-line/
Credit for this goes to Adobe, Ric Ewing, Kevin Williams, Aden Forshaw and Sidney de Koning. ]]>Wed, 03 Oct 2012 22:45:24 GMThttp://snipplr.com/view/67582/as3-drawing-shapes-arc-burst-dashedline-gear-polygon-star-wedge-line/(ActionScript 3) AS3 Remove Tabs and NewLine Charactershttp://snipplr.com/view/65761/as3-remove-tabs-and-newline-characters/
If you load text in from an XML file that is wrapped in CDATA tags using 'XML.ignoreWhitespace = true' does not work. This function removes the tabs and linebreaks. To have linebreaks use '' tags. ]]>Fri, 22 Jun 2012 19:30:41 GMThttp://snipplr.com/view/65761/as3-remove-tabs-and-newline-characters/(ActionScript 3) AS3 MathUtils static classhttp://snipplr.com/view/65581/as3-mathutils-static-class/
Credit goes to Bruno Imbrizi. ]]>Wed, 13 Jun 2012 02:56:19 GMThttp://snipplr.com/view/65581/as3-mathutils-static-class/(ActionScript 3) AS3 Map a Number within one range to another rangehttp://snipplr.com/view/65580/as3-map-a-number-within-one-range-to-another-range/
Credit goes to Bruno Imbrizi. ]]>Wed, 13 Jun 2012 02:53:34 GMThttp://snipplr.com/view/65580/as3-map-a-number-within-one-range-to-another-range/(ActionScript 3) AS3 Click-and-Rotate Contenthttp://snipplr.com/view/64747/as3-clickandrotate-content/
This code is taken from David Stiller's post on the CommunityMX website. All credit goes to him. ]]>Thu, 26 Apr 2012 19:47:01 GMThttp://snipplr.com/view/64747/as3-clickandrotate-content/(ActionScript 3) AS3 getVisibleBoundshttp://snipplr.com/view/63449/as3-getvisiblebounds/
All credit for this goes to Zach Foley (aka Plastic Sturgeon) ]]>Mon, 20 Feb 2012 21:09:35 GMThttp://snipplr.com/view/63449/as3-getvisiblebounds/(ActionScript 3) AS3 Convert TextField LineBreaks to CRLF for Display as Plain Text (Notepad) on Windowshttp://snipplr.com/view/61990/as3-convert-textfield-linebreaks-to-crlf-for-display-as-plain-text-notepad-on-windows/
Linebreaks differ between Flash TextField and a plain text file like Notepad. In this example we convert the html linebreaks in Flash to \r\n ]]>Tue, 20 Dec 2011 02:01:19 GMThttp://snipplr.com/view/61990/as3-convert-textfield-linebreaks-to-crlf-for-display-as-plain-text-notepad-on-windows/(ActionScript 3) AS3 Pie Charthttp://snipplr.com/view/61685/as3-pie-chart/
Credit goes to http://snipplr.com/users/MaRmAR/ ]]>Tue, 06 Dec 2011 03:00:46 GMThttp://snipplr.com/view/61685/as3-pie-chart/(ActionScript 3) AS3 Insert and Delete Characters at TextField CaretIndex Positionhttp://snipplr.com/view/60933/as3-insert-and-delete-characters-at-textfield-caretindex-position/
This code gets the current caretIndex in the textfield and then inserts the specified string at that point. The caretIndex position is then updated using setSelection, ready for the next insertion. This was developed to be used with an on-screen keyboard (for entering text into a textfield when the user is in fullscreen mode). The backspace button is intended to function in the same manner as pressing the delete key on your keyboard. ]]>Thu, 17 Nov 2011 22:09:46 GMThttp://snipplr.com/view/60933/as3-insert-and-delete-characters-at-textfield-caretindex-position/(ActionScript 3) AS3 Decimal To Hexhttp://snipplr.com/view/60387/as3-decimal-to-hex/
]]>Tue, 01 Nov 2011 04:22:10 GMThttp://snipplr.com/view/60387/as3-decimal-to-hex/(ActionScript 3) AS3 Left and Right Cursor Key Presseshttp://snipplr.com/view/60223/as3-left-and-right-cursor-key-presses/
]]>Thu, 27 Oct 2011 01:19:34 GMThttp://snipplr.com/view/60223/as3-left-and-right-cursor-key-presses/(ActionScript 3) AS3 Get Point Using Polar Co-ordinateshttp://snipplr.com/view/60222/as3-get-point-using-polar-coordinates/
This function returns a point object based upon the position, angle and distance of a starting point (polar co-ordinates). ]]>Thu, 27 Oct 2011 01:10:07 GMThttp://snipplr.com/view/60222/as3-get-point-using-polar-coordinates/(ActionScript 3) AS3 Getting the Distance Between Two Geographical Pointshttp://snipplr.com/view/58443/as3-getting-the-distance-between-two-geographical-points/
Full credit for this goes to Terrence Ryan who converted the JavaScript version to ActionScript. ]]>Mon, 05 Sep 2011 05:31:37 GMThttp://snipplr.com/view/58443/as3-getting-the-distance-between-two-geographical-points/(ActionScript 3) AS3 Truncating Decimal Numberhttp://snipplr.com/view/57204/as3-truncating-decimal-number/
Examples of different ways to truncate/round a decimal number. ]]>Wed, 27 Jul 2011 22:23:54 GMThttp://snipplr.com/view/57204/as3-truncating-decimal-number/(ActionScript 3) AS3 Create Random Passwordhttp://snipplr.com/view/56932/as3-create-random-password/
Based upon this (https://gist.github.com/988479) but made a few fixes. ]]>Thu, 21 Jul 2011 00:26:45 GMThttp://snipplr.com/view/56932/as3-create-random-password/(ActionScript 3) AS3 Loading and Accessing fonts in external SWF at Runtimehttp://snipplr.com/view/56917/as3-loading-and-accessing-fonts-in-external-swf-at-runtime/
These two classes demonstrate how to create an external font SWF that contains embedded fonts, and how to then load that external font SWF and access and use the fonts inside it. ]]>Wed, 20 Jul 2011 21:01:41 GMThttp://snipplr.com/view/56917/as3-loading-and-accessing-fonts-in-external-swf-at-runtime/(ActionScript 3) AS3 Example Font SWFhttp://snipplr.com/view/56912/as3-example-font-swf/
This font SWF was created using the handy tool FontSwffer (http://blog.madebypi.co.uk/2011/02/28/fontswffer-1-1/) ]]>Wed, 20 Jul 2011 19:43:00 GMThttp://snipplr.com/view/56912/as3-example-font-swf/(ActionScript 3) AS3 Post tinyurl to Twitter via Twitter webpagehttp://snipplr.com/view/56879/as3-post-tinyurl-to-twitter-via-twitter-webpage/
]]>Wed, 20 Jul 2011 01:28:06 GMThttp://snipplr.com/view/56879/as3-post-tinyurl-to-twitter-via-twitter-webpage/(ActionScript 3) AS3 Remove namespace from XMLhttp://snipplr.com/view/56876/as3-remove-namespace-from-xml/
If you don't deal with namespaces in XML correctly they can break your parsing in AS3. One way of getting around this is to remove the namespace from the XML a using regular expression. ]]>Wed, 20 Jul 2011 00:29:08 GMThttp://snipplr.com/view/56876/as3-remove-namespace-from-xml/(ActionScript 3) AS3 Get formatted time from dirty timestamp stringhttp://snipplr.com/view/56330/as3-get-formatted-time-from-dirty-timestamp-string/
I was working on a project where the timestamp string I was getting from the backend developer was pretty dirty in the way it was formatted. For example, it looked like "/Date(1310127448000+0100)/". I needed to get a nicely formatted time from it in the format hrs:mins ]]>Fri, 08 Jul 2011 23:20:17 GMThttp://snipplr.com/view/56330/as3-get-formatted-time-from-dirty-timestamp-string/