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

Using 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. class XMLShortcutsExample {         function...

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

Generating 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 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