<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rss [<!ENTITY % HTMLlat1 PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">]>
<rss version="2.0" xml:base="http://codes.widged.com">
<channel>
 <title>codes - </title>
 <link>http://codes.widged.com</link>
 <description></description>
 <language>en</language>
<item>
 <title>Random Sort, No repetition</title>
 <link>http://codes.widged.com/?q=node/794</link>
 <description>A &lt;a href=&quot;http://board.flashkit.com/board/showthread.php?threadid=773616&quot;&gt;question on Flashkit&lt;/a&gt; on how to randomly sort a bank of items



&lt;code type=&quot;actionscript&quot;&gt;
// build an array with 12 times the values 1-8
var arrVal:Array = new Array()
for (i = 1; i &lt;= 8; i++) {
    for (j = 0; j &lt; 12; j++) {
        arrVal.push( i)
    }
}

// sort the array in random order, no repetition
arrRnd = randomSort(arrVal) // use the function given in the previous post

/** 
  randomSort, no repetition 
*/ 
function randomSort(itms) { 
    var oItem:Object = new Object() 
    var lastPos:Number = itms.length 
</description>
 <category domain="http://codes.widged.com/?q=taxonomy/term/13">Web</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/317">Actionscript</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/219">arrays</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/190">sorting text</category>
 <pubDate>Sat, 02 Aug 2008 06:25:20 +0100</pubDate>
</item>
<item>
 <title>Decimal Rounding</title>
 <link>http://codes.widged.com/?q=node/793</link>
 <description>To round a number at a given decimal:

&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span class=&quot;synFunction&quot;&gt;trace&lt;/span&gt;(roundDecimal(1.657777, 4))&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;synPreProc&quot;&gt;function&lt;/span&gt; roundDecimal(val, qty) {&lt;br /&gt;    f = Math.pow(10, qty)&lt;br /&gt;    &lt;span class=&quot;synPreProc&quot;&gt;return&lt;/span&gt; Math.round(val*f)/f&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;</description>
 <category domain="http://codes.widged.com/?q=taxonomy/term/13">Web</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/317">Actionscript</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/92">maths, equations</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/182">units conversion</category>
 <pubDate>Sat, 02 Aug 2008 05:37:01 +0100</pubDate>
</item>
<item>
 <title>AIR coming to Linux</title>
 <link>http://codes.widged.com/?q=node/792</link>
 <description>&lt;p&gt;&quot;Adobe announced today that the pre-release alpha version of AIR for Linux is available immediately on the Adobe Labs site. Adobe shipped the 1.0 version of AIR for Windows and Mac last month but was forced to delay the Linux release.&quot;&lt;/p&gt;
&lt;p&gt;Read the &lt;a href=&quot;http://www.readwriteweb.com/archives/adobe_air_linux.php&quot;&gt;article at readwriteweb.com&lt;/a&gt;&lt;/p&gt;
</description>
 <category domain="http://codes.widged.com/?q=taxonomy/term/318">Actionscript 3.0</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/105">Linux</category>
 <pubDate>Tue, 08 Apr 2008 10:56:45 +0100</pubDate>
</item>
<item>
 <title>HyperNext Creator now Freeware</title>
 <link>http://codes.widged.com/?q=node/791</link>
 <description>&lt;p&gt;HyperNext Creator is available as a freeware from&lt;br /&gt;
&lt;a href=&quot;http://www.tigabyte.com/&quot;&gt;Tigabyte.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;OS Classic, OSX and Windows version are available.&lt;/p&gt;
&lt;p&gt;HyperNext is a development environment for persons new to programming. It uses a language from the HyperCard/xTalk family.&lt;/p&gt;
</description>
 <category domain="http://codes.widged.com/?q=taxonomy/term/136">Media Manipulation</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/150">Education</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/227">IDE</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/24">Multiple</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/19">OSX</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/21">Windows</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/1">xTalk</category>
 <pubDate>Sun, 06 Apr 2008 07:57:17 +0100</pubDate>
</item>
<item>
 <title>Matching Learning Activity, new version uploaded in the gallery</title>
 <link>http://codes.widged.com/?q=node/790</link>
 <description>&lt;p&gt;A new version of the matching learning activity has been uploaded in the Flex Gallery, under &lt;a href=&quot;http://www.widged.com/labs/flex/gallery/?category=courseware&quot;&gt;courseware&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://www.widged.com/labs/flex/gallery/open/courseware/matching.jpg&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Demo and source code available. &lt;/p&gt;
&lt;p&gt;Changes: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Drop accepted when the mouse is anywhere on the target picture.
&lt;li&gt;Drop not accepted for an item that has already been attempted.
&lt;li&gt;Score updated after each attempt (number correct and number attempted).
&lt;li&gt;Code slightly reorganized to avoid the split into TargetList and TargetItem. &lt;/p&gt;
</description>
 <category domain="http://codes.widged.com/?q=taxonomy/term/318">Actionscript 3.0</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/127">Component-based</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/316">Flex</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/276">Teaching &amp; Training Tools</category>
 <pubDate>Sun, 06 Apr 2008 01:22:23 +0100</pubDate>
</item>
<item>
 <title>Adobe Flex Intro PPT</title>
 <link>http://codes.widged.com/?q=node/789</link>
 <description>&lt;p&gt;&lt;a href=&quot;http://flexed.wordpress.com/2008/03/11/adobe-flex-intro-ppt-posted/&quot;&gt;Adobe Flex Intro PPT posted&lt;/a&gt; @ flexed.wordpress.com&lt;/p&gt;
&lt;p&gt;Copied from blog entry &quot;[...] presentation for The Chennai Cold Fusion User Group (CCFUG Homepage). Am posting the ppt here. The presentation covered the basics - intro to RIAs, intro to Adobe Flex, a couple of examples and a little bit about Adobe AIR. Check it out… if you have nothing else to do  … The audience were cold fusion developers who were new to Adobe Flex and Adobe AIR. I touched the basics and then walked them through some code examples of Flex and Air.&quot;&lt;/p&gt;
</description>
 <category domain="http://codes.widged.com/?q=taxonomy/term/213">1 novice coder</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/318">Actionscript 3.0</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/316">Flex</category>
 <pubDate>Wed, 12 Mar 2008 19:35:45 +0000</pubDate>
</item>
<item>
 <title>Multiuser applications in ActionScript with Unity</title>
 <link>http://codes.widged.com/?q=node/788</link>
 <description>&lt;p&gt;lecture notes &lt;a href=&quot;http://moock.org/lectures/introToUnity/&quot;&gt;Introduction to Unity&lt;/a&gt; @ moock.org&lt;/p&gt;
&lt;p&gt;Unity is  a multiuser application development kit.&lt;/p&gt;
</description>
 <category domain="http://codes.widged.com/?q=taxonomy/term/317">Actionscript</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/318">Actionscript 3.0</category>
 <pubDate>Mon, 10 Mar 2008 10:02:48 +0000</pubDate>
</item>
<item>
 <title>MVC in actionscript</title>
 <link>http://codes.widged.com/?q=node/787</link>
 <description>&lt;p&gt;Lecture notes on &lt;a href=&quot;http://moock.org/lectures/mvc/&quot;&gt;MVC&lt;/a&gt; (in AS) @ moock.org&lt;/p&gt;
&lt;p&gt;mvc separates the code required to manage a user interface into three distinct classes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;model: stores the data and application logic for the interface
&lt;li&gt;view: renders the interface (usually to the screen)
&lt;li&gt;controller: responds to user input by modifying the model
&lt;/ul&gt;
</description>
 <category domain="http://codes.widged.com/?q=taxonomy/term/317">Actionscript</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/318">Actionscript 3.0</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/131">MVC</category>
 <pubDate>Mon, 10 Mar 2008 09:57:54 +0000</pubDate>
</item>
<item>
 <title>Event Model</title>
 <link>http://codes.widged.com/?q=node/786</link>
 <description>Source: &lt;a href=&quot;http://moock.org/lectures/introToAS3/&quot;&gt;Intro To AS3&lt;/a&gt; @ moock.org

&lt;h2&gt;Registration&lt;/h2&gt;

general code:
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;someObj.addEventListener(EventName, listenerFunction)&lt;br /&gt;public function listenerFunction (e:EventType):void {&lt;br /&gt;&amp;nbsp; trace(&quot;event fired&quot;);&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;

example code:
&lt;code&gt;
var s:Sprite = new Sprite();
s.addChild(new Rectangle(25, 25));
s.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownListener);
public function mouseDownListener (e:MouseEvent):void {
  trace(&quot;mouse down listener triggered);
  // Method bound to current object (delegation built in)
  trace(&quot;current object is: &quot; + this);
</description>
 <category domain="http://codes.widged.com/?q=taxonomy/term/317">Actionscript</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/318">Actionscript 3.0</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/83">events/messages</category>
 <pubDate>Mon, 10 Mar 2008 09:48:55 +0000</pubDate>
</item>
<item>
 <title>Vector drawing</title>
 <link>http://codes.widged.com/?q=node/785</link>
 <description>&lt;p&gt;&lt;code&gt;&lt;br /&gt;
var rect:Shape = new Shape();&lt;br /&gt;
rect.graphics.lineStyle(1);&lt;br /&gt;
rect.graphics.beginFill(0x0000FF, 1);&lt;br /&gt;
rect.graphics.drawRect(0, 0, 75, 50);&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;For the graphic to appear on stage, don&#039;t forget to add:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
addChild(rect);&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;At the top of the script, make sure you import the required libraries&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
import flash.display.Shape;&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
</description>
 <category domain="http://codes.widged.com/?q=taxonomy/term/201">2D</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/317">Actionscript</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/318">Actionscript 3.0</category>
 <pubDate>Mon, 10 Mar 2008 09:45:35 +0000</pubDate>
</item>
<item>
 <title>Display containers and children</title>
 <link>http://codes.widged.com/?q=node/784</link>
 <description>&lt;p&gt;&lt;code&gt;&lt;br /&gt;
DisplayObjectContainer.addChild()&lt;br /&gt;
DisplayObjectContainer.removeChild()&lt;br /&gt;
DisplayObjectContainer.addChildAt()&lt;br /&gt;
DisplayObjectContainer.removeChildAt()&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Note that depths auto-collapse when a child is removed&lt;/p&gt;
</description>
 <category domain="http://codes.widged.com/?q=taxonomy/term/317">Actionscript</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/318">Actionscript 3.0</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/45">basic objects</category>
 <pubDate>Mon, 10 Mar 2008 09:44:17 +0000</pubDate>
</item>
<item>
 <title>Accessing named stage instances from class script</title>
 <link>http://codes.widged.com/?q=node/783</link>
 <description>&lt;p&gt;Source : &lt;a href=&quot;http://moock.org/lectures/ActionScriptAndFlashCS3/&quot;&gt;ActionScript And FlashCS3&lt;/a&gt; @ moock.org&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;instances with names can be accessed via getChildByName()
&lt;li&gt;name the star instances star1, star2, star3
&lt;li&gt;add the following code to GreetingApp constructor:
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;&lt;br /&gt;
getChildByName(&quot;star1&quot;).width = 600;&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
</description>
 <category domain="http://codes.widged.com/?q=taxonomy/term/317">Actionscript</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/318">Actionscript 3.0</category>
 <pubDate>Mon, 10 Mar 2008 09:32:53 +0000</pubDate>
</item>
<item>
 <title>Frame scripts are instance methods</title>
 <link>http://codes.widged.com/?q=node/782</link>
 <description>&lt;p&gt;Source : &lt;a href=&quot;http://moock.org/lectures/ActionScriptAndFlashCS3/&quot;&gt;ActionScript And FlashCS3&lt;/a&gt; @ moock.org&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;each main timeline frame script creates a document class instance method named frame1, frame2, frame3 (starts at 1 not 0)
&lt;li&gt;player uses addFrameScript() to register frame methods to execute
&lt;li&gt;undocumented, but developers can also use addFrameScript()
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;&lt;br /&gt;
// Invoke doSomething when playhead reaches frame 1&lt;br /&gt;
// (Replaces any existing script on frame 1)&lt;br /&gt;
addFrameScript(0, doSomething)&lt;br /&gt;
// Remove frame 1&#039;s script&lt;br /&gt;
addFrameScript(0, null)&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
</description>
 <category domain="http://codes.widged.com/?q=taxonomy/term/317">Actionscript</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/318">Actionscript 3.0</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/83">events/messages</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/312">Flash</category>
 <pubDate>Mon, 10 Mar 2008 09:28:20 +0000</pubDate>
</item>
<item>
 <title>Working with Selection</title>
 <link>http://codes.widged.com/?q=node/781</link>
 <description>&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;nbsp; &lt;span class=&quot;synPreProc&quot;&gt;this&lt;/span&gt;.createTextField(&quot;tOutput&quot;, &lt;span class=&quot;synPreProc&quot;&gt;this&lt;/span&gt;.getNextHighestDepth(), 100, 100, 200, 200);&lt;br /&gt;&amp;nbsp; tOutput.&lt;span class=&quot;synFunction&quot;&gt;selectable&lt;/span&gt; = false&lt;br /&gt;&amp;nbsp; &lt;span class=&quot;synPreProc&quot;&gt;this&lt;/span&gt;.onMouseUp = &lt;span class=&quot;synPreProc&quot;&gt;function&lt;/span&gt;():Void {&lt;br /&gt;&amp;nbsp; &amp;nbsp; Selection.&lt;span class=&quot;synFunction&quot;&gt;setFocus&lt;/span&gt;(&quot;tOutput&quot;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; Selection.&lt;span class=&quot;synFunction&quot;&gt;setSelection&lt;/span&gt;(40, 43) &lt;br /&gt;&amp;nbsp; }&lt;/code&gt;&lt;/div&gt;

getCaretIndex(), txtField.replaceSel(), Selection.getFocus()</description>
 <category domain="http://codes.widged.com/?q=taxonomy/term/135">Text Manipulation</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/317">Actionscript</category>
 <pubDate>Mon, 03 Mar 2008 09:29:20 +0000</pubDate>
</item>
<item>
 <title>Events for text Fields</title>
 <link>http://codes.widged.com/?q=node/780</link>
 <description>&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;this.createTextField(&quot;tComments&quot;, 1, 25, 25, 100, 20);&lt;br /&gt;tComments.onChanged = &lt;span class=&quot;synCommand&quot;&gt;function&lt;/span&gt;() { &lt;br /&gt;&amp;nbsp;  trace(&quot;Text &lt;span class=&quot;synFunction&quot;&gt;within&lt;/span&gt; comments field = &quot; + tComments.text);&lt;br /&gt;};&lt;br /&gt;tComments.onSetFocus = &lt;span class=&quot;synCommand&quot;&gt;function&lt;/span&gt;(oPrevFocus:Ojbect):Void {&lt;br /&gt;&amp;nbsp; trace(this._name + &quot; is now focused.&quot;);&lt;br /&gt;&amp;nbsp; &lt;span class=&quot;synPreProc&quot;&gt;&lt;span class=&quot;synCommand&quot;&gt;if&lt;/span&gt;&lt;/span&gt;(oPrevFocus._name != &lt;span class=&quot;synConstant&quot;&gt;null&lt;/span&gt;) {&lt;br /&gt;&amp;nbsp; &amp;nbsp; trace(oPrevFocus._name + &quot; no longer has &lt;span class=&quot;synCommand&quot;&gt;focus&lt;/span&gt;.&quot;);&amp;nbsp;  &lt;br /&gt;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;tComments.onKillFocus = &lt;span class=&quot;synCommand&quot;&gt;function&lt;/span&gt;(oPrevFocus:Ojbect):Void {&lt;br /&gt;&amp;nbsp; trace(this._name + &quot; is no longer focused.&quot;);&lt;br /&gt;&amp;nbsp;  trace(oPrevFocus._name + &quot; is now focused.&quot;);&amp;nbsp;  &lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;

Note that onChanged() does not detect changes to a a text field made via ActionScript.
</description>
 <category domain="http://codes.widged.com/?q=taxonomy/term/317">Actionscript</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/83">events/messages</category>
 <category domain="http://codes.widged.com/?q=taxonomy/term/50">text fields</category>
 <pubDate>Mon, 03 Mar 2008 09:19:40 +0000</pubDate>
</item>
</channel>
</rss>
