A reader recently inquired if it was necessary to remove previously created class instances which were no longer being used. The simple answer is yes because it frees up memory – but there may be other reasons as well.
Entries Tagged as 'Tutorials'
Sorting and combining arrays: sortOn( ) and concat( )
April 6th, 2010 · No Comments · Tutorials
In this post, the sorting of indexed arrays using the sortOn method is discussed. Sorting options Array.CASEINSENSITIVE, DESCENDING and NUMERIC, are also defined. Finally, we’ll use concat to combine two arrays into a new array.
Tags:arrays·caseinsensitive·concat·descending·numeric·sort·sorton
Replacing swapDepth in Actionscript 3: setChildIndex, swapChildren, swapChildrenAt
March 29th, 2010 · 2 Comments · Tutorials
I recently needed to rearrange the depths – z-order – of a number of objects on the stage. I tried the swapDepth() method from Actionscript 2 and got the “call to a possibly undefined function…” error. After a little reasearch – with Google’s assistance – I found solutions using the setChildIndex(), swapChildren() and SwapChildrenAt() methods [...]
Tags:depth·setchildindex·swapchildren·swapchildrenat·swapdepth·z-order
Using updateAfterEvent with mouse events as an alternative to StartDrag
March 18th, 2010 · 2 Comments · Tutorials
If you have ever used the StartDrag method you have probably noticed that if a user drags an object too quickly its movement becomes erratic and jumpy. This is because dragging an object initiated by startDrag is synced to the frame rate – normally 30 frames per second.
Using caurina Tweener to tween text movement
March 11th, 2010 · 2 Comments · Tutorials
A reader requested a very simple solution for moving text so I decided to respond with this short tutorial on using the caurina Tweener library to move a block of text. (To repeat tween reload page.)
Saving XML to disk using ByteArray and FileReference
February 18th, 2010 · 1 Comment · Tutorials
This post examines a method for saving a modified XML file to disk. To accomplish this task, the XML is first converted to binary data using byteArray – and then saving the byteArray to disk using fileReference.
Modifying XML files
February 16th, 2010 · No Comments · Tutorials
In earlier posts, I discussed various methods to read XML data (here, here). In this post we’ll look at various means of modifying existing XML files.
Tags:appendchild·edit·insertchildafter·insertchildbefore·xml
Generating random numbers with Math.random()
January 19th, 2010 · No Comments · Tutorials
Last week I was working on a project that relied on generating random numbers. I went online to research the Math.random() function but could not find a single, definitive site explaining the many variations of the random function. I thought it might be of some value to consolidate the variety of forms I found.
Using Actionscript 3 …(rest) to pass optional parameters
January 5th, 2010 · 2 Comments · Tutorials
This post examines several methods for passing optional parameters to functions and class constructors. Using …rest allows an arbitrary number of parameters to be passed to the function. The list of comma delimited arguments (often called the rest parameter) is treated as an array by the function.
Setting Color Profiles in Flash Player 10
January 4th, 2010 · No Comments · Tutorials
Most browsers, today, rely on the host device to determine how colors are rendered. The result is that photographs processed with great care in Photoshop will appear different from one display to another. This problem is further compounded by the newest, high-end, wider gamut displays which further exaggerate the appearance of images displayed on them. [...]