Creating 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 More

Free 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 More

Solution 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 More

XML 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 More

Counting 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 function wordcount(txt) {         if (!isNaN(txt+" 0"))...

Read More

String.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. String.prototype.addProperty('isWhite', function () {         return !isNaN(this+'...

Read More

Easy way to Randomize an Array.

Here is the sample code to shuffle the contents of an array // Here is a simple function for randomizing the array function randomsort(a, b) {         return Math.random()&gt;.5 ? -1 : 1; } //usage example var arr = [1, 2, 3, 4, 5]; arr.sort(randomsort); trace(arr); //traces 4,3,1,5,2

Read More

including 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 More

Is 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 <pre>if (!System.capabilities.isDebugger) {    ...

Read More

XML Shortcuts V2.2 released.

Release Notes Version 2.2 is a minor update for fixing a bug and performance fine tuning. Revision History Version 2.1 Fixed the following issues. – Both Pro and Lite versions create an unwanted variable ‘s’ in _level0 – In Pro, even after loading another XML. Some of the shortcuts still point to the old nodes. Version 2.2 Performance improvement in Pro component You can...

Read More

XML Shortcuts V2 approved by Macromedia.

XML Shortcuts component is tested and approved by Macromedia. Now you can download it from Macromedia Exchange

Read More

XMLShortcuts Version 2 coming soon.

I’m already working on version 2 of this XMLNode easy access component. It will give better performance than the previous version. It will have two components, XMLShortcuts Lite and XMLShortcuts Pro. Both provide the same functionality. XMLShortcuts Lite is optimized for file size & memory, it is recommended for Small Projects. XMLShortcuts Pro is optimized for processor &...

Read More

XML Shortcuts component released.

The XMLShortcuts component enables shortcut access to All XML nodes. Biggest advantage of using XML shortcuts is it can be easily added to existing projects with out any modification. Simply drag and drop the component from components window to the stage and then delete it from stage (let it stay in the library). Available Shortcuts: Property Description childNode Get the first child...

Read More

XML Shortcut – Accessing XMLNode easily as a Object

If you hate accessing XMLNodes using myXML.firstChild.childNodes[3] approach, there are already couple of other approaches to deal with. Before getting to know my new approach lets examine the other possibilities.   What do you think? Will XML Shortcuts component be of any use to you? Express your views in the comments, based on the demand I will release the...

Read More

XML and V2 Tree Example 5 – Limit by Depth.

Lets explore how we can hide nodes beyond the predefined depth from rendering in tree. Before hiding the text nodes, the tree looks like this (as per Example 1) with this XML Start with a blank FLA, add a tree component to stage, name it “tree”, add a text area component name it “textArea” Write the following in the first frame ...

Read More

XML and V2 Tree Example 4 – Hiding Text Nodes.

Lets explore how we can hide text nodes from rendering in tree. Before hiding the text nodes, the tree looks like this (as per Example 1) with this XML Start with a blank FLA, add a tree component to stage, name it “tree”, add a text area component name it “textArea” Write the following in the first frame <pre>import...

Read More

ColorSyntax Extractor now generates XML for Flash based Syntax Highlighter .

I’ve modified my Color Syntax Extractor to include XML for Igor’s Flash Syntax Highlighter, which is a flash based synctax highlighter for actionscript. You can download the tool from here!...

Read More

XML and V2 Tree Example 3: Tree Search.

Lets enhance the last example by adding search functionality. We need a function that will return the matching nodes as an array. The following function does that for us. Add it to the timeline. <span style="color: #993300;">function</span> isMatch (s, s2) {         <span style="color:...

Read More

Where Flash MX 2004 fails to render Unicode.

Unicode text includes bidirectional text, text that requires contextual shaping, and text with combining characters. Unicode text cannot be rendered with traditional one-code-point to one-glyph rendering; it requires analysis and processing of runs of text. Currently Flash MX04 is able to render Unicode text properly with system fonts, but when we embed the font, the pre processing that is...

Read More

New RIA Interface for my blog.

Quick Blog Viewer v3 is a Flash based RIA for my blog. Now you can keep track of the posts easily, find out what is new since your last visit, flag your favorite posts. It’s interface should explain how. Check it out at blog/quickview Don’t forget to right click on the grid after selecting something 😉

Read More

XML and V2 Tree Example 2: Open/Close All.

Lets enhance the last example by adding two buttons to open and close all tree nodes Add the following code to the first frame function openOrCloseAll (x, open:Boolean) {         if (tree.getIsBranch (x)) {                 tree.setIsOpen (x, open, false, false);    ...

Read More

XML and V2 Tree Example 1.

Rendering XML using Tree component is very simple, because in Flash MX 2004, V2 Tree component is based on XML. Lets explore the possible ways to visualize sample.xml in the coming examples. Create a new document in Flash MX 04, drag and drop a tree component and name it as “tree” Write the following code in the first frame import mx.controls.Tree; var tree:Tree; var...

Read More

Actionscript Syntax Highlighting with SE|PY Editor v.1.0.5.4.

SE|PY has become my favorite actionscript editor these days. It’s default color highlighting scheme is very different from Flash IDE. So I’ve modified it to syntax highlight similar to my actionscript highlighting service 2 and exported the settings using File > Import/Export > Export Settings for your convenience. You may download SEPY_ColorStyle.tar.gz and import it into SEPY...

Read More

PriorityQueue Class

Brandan Hall wrote the PriorityQueue (pQueue) class in “Object Oriented Programming with ActionScript” published by New Riders. I’ve converted that class to ActionScript 2 which you may download from here.

Read More

Actionscript for XML pretty printing and color highlighting . XMLHighlighter class

XMLHighlighter class Availability Flash Player 6 (copy the XMLHighlighter class actionscript file to the same folder as the FLA or to the class path). Description Use the methods and properties of the XMLHighlighter class to generate the html code to generate color highlighted pretty printed XML Method summary for the XMLHighlighter...

Read More

XML pretty printing and color highlighting .

We used to build many Flash Applications which exports data as XML. How about pretty printing it with colors? Before writing my own code I searched to find any existing code and found this code written by Evgeniy Potapenko in prototype. It does the basic pretty printing part, but it had few problems in handling the text nodes. It adds tabs before text nodes and unlike the native .toString()...

Read More

Converting Date Strings back to Date.

We all know that trace(new Date()) traces the date as a string that looks like “Mon Jul 12 13:20:09 GMT+0800 2004” How to convert this String back to Date? There is no built in method, so I’ve written this function to do that. Usage: #include “getDateFromString.as” //sample date in Pacific Daylight Time var str = “Sun Aug 11 17:00:00 GMT-0700...

Read More

Breeze Presentation on “Taking Sketches into full-blown Flash Animations”.

Yesterday we really enjoyed the presentation by Chris Georgenes, one of our Team Macromedia Volunteers. He talks about the minute details of animation. Take a look at his great presentation here. If you like to see the resulting animation of his presentation, take a look at his website. Enjoy...

Read More

Pixel Perfect Drawing Tools for Flash MX04.

So far, whenever in need of pixel accurate graphics in flash, I follow the following steps 1. Enable the snap to pixel option (if not enabled already) 2. Zoom in to see the pixel grid 3. Select Rectangle Tool 4. Select ‘No Color’ for Stroke 5. Draw Pixel Rectangles with the help of snap to pixel The good news is, now we have a better and efficient way to do the same, thanks to Patrick...

Read More

Actionscript Syntax Highlighting with SE|PY Editor v.0.9.

Many of you might already be using SE|PY a very special open source actionscript editor available for free. We have to really thank Alessandro Crugnola & Team for all their efforts for giving us such a wonderful tool. Long back I’ve downloaded a early version of SE|PY it used to take time to launch and open a command prompt before launching the Editor which made me to ignore this...

Read More