Arul's Blog On Multimedia, Flash MX, Director And Dreamweaver MX
Recent Entries | Guest Book | QuickView | XML-RSS feed | My Profile | Home
::: About this Blog :::
Welcome to Arul's Blog!
Weblog on Multimedia,
Macromedia Flash MX Flash MX
Macromedia Director Shockwave Studio 8.51 Director
Macromedia Dreamweaver MX Dreamweaver MX
View my profile And me :)
Here I'm going to share my views, opinions and code with you all.

::: Services :::

:. ActionScript Highlighting
:. AS Highlighter v2 new!


::: ActionScript :::
:. toString
:. skipCache
:. getWords
:. getDateFromString
:. colorUtils
:. XMLNode-transformTags
:. Object-copyProperties
:. Object-clone

::: ActionScript 2 :::
:. XMLHighlighter
:. PriorityQueue

::: Archives :::
[September 2002]
[October 2002]
[November 2002]
[December 2002]
[January 2003]
[February 2003]
[March 2003]
[April 2003]
[May 2003]
[June 2003]
[July 2003]
[September 2003]
[October 2003]
[December 2003]
[January 2004]
[February 2004]
[March 2004]
[April 2004]
[May 2004]
[June 2004]
[July 2004]
[December 2004]
[January 2005]
[February 2005]
[March 2005]
[May 2005]
[June 2005]
[July 2005]
[August 2005]
[June 2006]
[July 2006]
[November 2006]
[December 2006]
[January 2007]

::: Time Zone :::
All Times on this blog are
GMT + 5:30 Hours
(Indian Standard Time)

::: Flash Resources :::
:. Flash Components
:. Were-Here Forum
:. Digital Illusion
:. Flashmove Forum
:. Flash Goddess
:. Prototypes
:. Actionscript Toolbox
:. UltraShock
:. Chattyfig
:. Full as a Goog
:. Flog

::: Flashers :::
:. Mike Chambers
:. Greg Burch
:. Branden Hall
:. Samuel Wan
:. Stuart Schoneveld
:. Guy Watson
:. Robin Debreuil
:. Mario Klingemann
:. Moises
:. Aral Balkan
:. Peter Hall
:. Josh Dura
:. Alessandro
:. Brajeshwar
:. Nik Khilnani

::: Small Print :::

© Copyright 2002
R.Arul Kumaran

[Made with Blogger]


Wednesday, July 21, 2004

Code.Flash MX: 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.

posted by Arul | link | ^top | next> | add comment
Monday, July 19, 2004

Code.Flash MX: Actionscript for XML pretty printing and color highlighting .

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 class

Method Description
XMLHighlighter.highlight()

Returns the HTML highlighted code for the specified XML document.

Property summary for the XMLHighlighter class

Property Description
XMLHighlighter.useCDATA

Set to true by default. enables/disables the CDATA detection

XMLHighlighter class

Availability

Flash Player 6 (copy the XMLHighlighter class actionscript file to the same folder as the FLA).

Usage

var htmlTxt:String = XMLHighlighter.highlight(source:XML):String;

Parameters

source An XML parsed to generate the HTML String.

Returns

Color highlighted HTML String.

Description

Since it is a static class, call any of the methods of the XMLHighlighter class directly.

Note: Set XMLHighlighter.useCDATA=false if you don't want to use CDATA for text nodes.

Example

The following example creates a new, empty XML object:

var s = '<?xml version="1.0"?><!DOCTYPE greeting SYSTEM "hello.dtd"><note>\r';
s += '    This is mytext node  \r    ';
s += '<![CDATA[ This is my <b>CDATA</b>Section node ]]>\r<note attribute="value"/></note>';
var x:XML = new XML(s);
//by default it will enable CDATA if you dont want that to happen
//uncomment the following line
//XMLHighlighter.useCDATA=false;
var s2 = XMLHighlighter.highlight(x);
//keep a copy of textArea component on stage and name it "textAreaInstance"
textAreaInstance.html = true;
textAreaInstance.text = s2;
trace(s2);

Resulting HTML

<?xml version="1.0"?>
<!DOCTYPE greeting SYSTEM "hello.dtd">
<note>
    This is mytext node  
    <![CDATA[ This is my <b>CDATA</b>Section node ]]>
	<note attribute="value"/>
</note>

posted by Arul | link |<prev. | ^top | next> | add comment
Wednesday, July 14, 2004

Demo.Flash MX: 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() function it does not html encode the special characters.

I've fixed those issues and added color highlighting feature. Here you can see the demo of the outcome. Just copy paste an XML string in to the text area.
Once I've optimized the code I will post it here.

posted by Arul | link |<prev. | ^top | next> | comments [3]
Monday, July 12, 2004

Code.Flash MX: 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 1974";
trace(getDateFromString(str));
//traces "Mon Aug 12 08:00:00 GMT+0800 1974" on my machine (Singapore Time)
//output will be in local time and will vary accordingly

You may download the 'getDateFromString.as' from here

posted by Arul | link |<prev. | ^top | next> | add comment

footnote:-
Also check the recent entries and feel free to add your comments. I need your comments to improve this blog