Webcam Motion Detection using AS3.
Some time back Guy Watson wrote an article in the developer center called Webcam Motion Detection: Using the BitmapData API in Flash 8. He later made a better version of it and included that source in the zip file. I went through that code and completely rewrote it in ActionScript 3. Here is the demo. This one of course requires a webcam and flash 9 player to play around. Once I clean up the...
Read MoreAral Balkan on Application Development & Architecture for the Flash Platform.
3dsense Media School people have brought in Aral Balkan to Singapore. He will be giving us a speech coming Sunday. Look at http://pixelreloaded.com/ for more details. Even if you haven’t registered for the event, do come over. On the spot registration will be available, and I will also be there Thanks to 3dsense guys, I met with Aral Balkan and we talked a lot. It was great talking to...
Read MoreBackground becomes black when defining depthColors style for Tree Component.
It used to work fine before (in Flex 2.0). Now with Flex 2.0.1, it renders as shown below when we define depthColors attribute for Tree Component depthColors="[0xFFFFFF, 0xF2F6F7, 0xEDF5F7, 0xE8F0F2, 0xD3E2E6]" If I find any workaround I will update this post. If you know a workaround please post it as a...
Read MoreEnabling Run Mode Trace in Flex Builder 2.
As you know trace messages are shown only in Debug Mode in Flex Builder. You can follow the steps shown below to see the trace output in Flex Builder all the time. Open Window > Preferences… menu Select General > Editors > File Associations in the Tree Add *.swf as the New File Type Select the newly added *.swf file type and Add “Internal Web Browser” as the...
Read MoreTrace from anywhere, a Flex based Tracer Panel.
Here is an Flex application that generates mm.cfg according to your OS (XP, Vista, Mac)and shows the standard trace() outputs in real time (well! there is a slight delay). I love to replicate the features of the IDE using Flash itself. It all started with my flash 6 reference panel made with flash 6 Here is how this tracer works Here it is to test it yourself...
Read MoreBuilding a XML Editor using Flex 2.
I’m making a XML Editor which can help playing around with E4X and manipulate the XML. Which will be hosted as an online service here and will also be available as a Apollo application later. Here is the alpha version of it. I welcome feature requests and suggestions, kindly post them as comments to this post. The sample XML displayed will give you a clue of what’s coming next ...
Read MoreMXML Quick Reference.
Here is a Flex 2 application which helps to quickly refer to MXML tags and and its attributes. I have plans to integrate it with the Flex 2 SDK help files and make it an Apollo application. I will improve it further and make it available here as online...
Read MoreAdding an icon to all items in the List Component.
List component does not have a default icon. Easy way to add one is to add a Icon function which is very similar to the one we use with Flash v2 components. Only difference is instead of string we need to return a class reference to the image [Embed (source = 'res/image_link.png')] [Bindable] public var image_ico : Class; private function...
Read MoreDesigning a Search Field .
Utilizing the available application space effectively is one of the important things we need to consider when designing an user interface. Olden search interfaces had two parts text input field and a search button. Then the “search”/”find”/”go” text is replaced with a lens icon. Now a days this lens icon is embedded inside the input text itself. If you want...
Read MoreCreating a Talking Application in Flash.
Here I will show how to create a light weight talking application in flash. It is one of the Examples I showed in the Singapore User Group Session. Our task is fairly simple, Creating an audio file (preferably MP3) with all the words we want our application to speak. Using that audio in a movieclip as a streaming audio and placing frame labels(to another empty layer) to split the whole audio...
Read MoreFree SWF to XAML Converter.
This should interest any one who wants to get into WPF (Windows Presentation Foundation). What interests me is Michael Swanson’s interview in which he explains SWF file format internals.
Read MoreEnhancing the Blog Reader Example.
In the Live docs you might have read about Retrieve and Display Data. Here I’ve enhanced the same MXML by the following The LinkButton hidden until the datagrid change event is fired. Enabled the Data Tips for ‘Posts’ column to show tool tips text on roll over. Made it a scalable layout by using constraint-based layout. Here is the MXML code, I’ve highlighted the changes...
Read MoreSending Arrays with offset Index.
Last time we saw the problem with sending ActionScipt 3 Associative Array. Now we let us see where associative arrays can help. Lets Make an Array with offset index in PHP: $arr =array(5=>5); in ActionScript: var arr:Array= []; arr[5]=5; Sending these arrays either way they go with the missing indices filled with null, so the PHP array comes to flash as arr=[null, null,...
Read MoreWebcam Motion Detection using AS3 – Source Released.
I rewrote the webcam motion detection example in Actionscript3 using Flash 9 Alpha. You can see the demo here. As I promised earlier the FLA is ready for download here
Read MoreUnderstanding AMF0 and AS3 Array.
You might have already read about Array oddity in AMFPHP/Flex 2. AS3 Associative Arrays, when sent through AMF0 they include ‘length’ propery. But numeric index based Arrays are fine. I’ve created the following AMFPHP Service to showcase this issue. It is a simple service with a remote method that converts any given object to string and returns...
Read MoreIntroducing ObjectStore.
What is ObjectStore? Object Store is a service for creating, managing and accessing objects on the server. It is a light weight alternative to keeping XML data on the server. How do we compare ObjectStore with RemoteSharedObject? ObjectStore is similar to RemoteSharedObject in terms of storing data on the server, but ObjectStore does not poll (automatically refresh) data and does not fire...
Read MoreService Browser does not handle method table ‘arguments’ metadata defined as key value pairs.
While defining the method table for my ObjectStore service I noticed it. Those who use the JavaDoc style comments to generate the method table may never notice this issue. Arguments metadata can be defined as an array of strings (as created by javadoc comments) or array of array which contains argument name as the key and settings as the value. More on this at amfphp.org ServiceBroswer class...
Read MoreHow to load data from a remote URL?
I found that the DataLoadingTest class given in Adobe Labs ActionScript 3 Resources site was buggy and did not work. I’ve corrected the file myself and made it work. Here is the working code ActionScript3 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162package { import...
Read MorePorting XMLHighlighter class to ActionScript 3.
XMLHighlighter generates color highlighted pretty printed HTML code for the given XML document, I have ported it from ActionScript 2 to ActionScript 3. Here is what I learned during the process XML object in ActionScript 3 is different (It is ECMAScript for XML (E4X)). For backward compatibility we have XMLDocument class which is equalent to XML in Actionscript 3. In ActionScript 3 we need to...
Read MoreRemoving Byte Order Mark (BOM) from the given string.
Since PHP does not recognize and ignore BOM in the loaded files, I wrote the following script to find and remove the BOM from the loaded string. 12345678function removeBOM($str=''){ if(<a href="http://www.php.net/strpos">strpos</a>($str, "»")==1)$str=<a...
Read MoreSolution for using relative paths in swfs to load data.
Only starting from Flash 9 and Actionscript 3 we can reliably use relative path to load data. Let me explain the problem. say for example we have an swf file named ‘Slide.swf’ in a folder ‘Slide001′ folder which loads ‘data.xml’ using the following statement my_xml=new XML(); my_xml.onLoad=function(success){ //process the xml...
Read MoreUsing XMLShortcuts Example.
XML Shortcuts helps to access the XMLNodes with ease. You may read my previous post which compares the XMLShortcuts with XPath from XFactor Studio, XML to Object Prototype, and XMLNode easy access by tatsuo kato Here is a example file, that shows how you can use XMLShortcuts in your MTASC projects. ...
Read MoreXML Shortcuts V2.2 MTASC Edition released
Now XMLShortcuts meets MTASC I received many requests to make XMLShortcuts available for MTASC (Motion Twin Action Script Compiler). I could not do it with my busy schedule so far, but finally here it is Download package consists of XMLShortcuts.as, an example and help files <a href=”/HelpPanel/?target=XMLShortcuts_MTASC_Edition” target=”_blank”>XMLShortcuts...
Read MoreCounting number of words in a String.
Here is a simple code to get the word count. To ease up the process, I do not count the words that are not separated by space For Example “Mr.Arul” will still be counted as one word. but it makes sure whitespace is not counted as words Here is the code 1234567891011121314151617181920function wordcount(txt) { if...
Read MoreString.isWhite and String.getWordCount().
This is the same word count function that I showed in the previous post presented in the good old way of adding more properties and methods through the prototype. String object is extened to have isWhite read only property and getWordCount method. 12345678910111213141516171819202122232425262728293031323334String.prototype.addProperty('isWhite', function ()...
Read MoreEasy way to Randomize an Array.
Here is the sample code to shuffle the contents of an array 123456789// Here is a simple function for randomizing the array function randomsort(a, b) { return Math.random()>.5 ? -1 : 1; } //usage example var arr = [1, 2, 3, 4, 5]; arr.sort(randomsort); trace(arr); //traces 4,3,1,5,2 ...
Read MoreGenerating Unique Random Number for Flash Lite 1 and 1.1.
Generating Unique random number for Flash Lite 1.1 is tricky because of the Flash 4 style syntax. I’ve made a sample application which shows how this can be achieved. Here is the SWF showcasing this You can download the FLA from...
Read Moreincluding Actionscript 1 files in Actionscript 2 Project.
When we are including an AS1 file in an Fla which has to be published as AS2, we need to be careful in naming the include file. There shouldn’t be any object initialized in _global which has the same name as the include file. Say for example, I had a include file called Security.As and inside that had _global.Security=new Object(). When I published I got the following ...
Read MoreIs Running in Flash IDE?
When testing my application in IDE, I wanted to use some hard coded test data instead of Every time loading the dynamic data. System.capabilities.isDebugger is the boolean property which is true when we are testing in IDE or special Debug Player. Here is the sample code that I’ve used 123456<pre>if (!System.capabilities.isDebugger) { ...
Read MoreXML Shortcuts V2 approved by Macromedia.
XML Shortcuts component is tested and approved by Macromedia. Now you can download it from Macromedia Exchange
Read More

