Monthly Archives: February 2004

References by Path >> pathRef Library

Wouldn’t it be nice to create a reference by path. Here is a solution in AS1.


//via an object property

a = {}

a.x = 23


trace(x) //23

x = 45

trace(x) //45

trace(a.x) //45

//via a movieclip property


trace(x) //0

x = -100

trace(x) //-100

trace(_level0._x) //-100

Better still as a pathRef is always created by path so if you swap the object it is pointed at, the reference will still work. With pure references this would break.

a = {}

a.x = 23



//redefine a

a = function(){}

a.x = “I am a function now!”

trace(x) //I am a function now!

Too fun. This one has 1000′s of uses from remote controlling objects to reference resilient classes.

As always send me any bugs or changes in the code.


ted ::)


I have found this extremely useful on a current project. This library adds a getter/setter to the MovieClip class allowing you to manage color without declaring a Color Object. A Color object is created within getter/setter execution but is destroyed as a temporary variable. This keeps you from having to manage color objects along with the MovieClips they modify.

Include into a project:

#include “”

Download ZIP

Here is the syntax for its use:

MyMC._color = “0xFF0000:30″ //Turn the clip red with 30% alpha

MyMC._color = “0x00FF00″ //Turn the clip green

MyMC._color = 0 //Turn the clip black > Numbers are interpreted as RGB Values directly

MyMC._color = 0×000000 //Turn the clip black

MyMC._color = 0xFFFFFF //Turn the clip white

MyMC._color = “” //Turn the clip to its original color

MyMC._color = undefined //Turn the clip to its original color

Credits to Jon Williams at ShoveMedia for some of the color manipulation code from the IOLib codebase.


Ted ;)

From the Vault – Interval Manager 1.012

I wrote this along time ago March’03 to manage Intervals within PowerSDK:FLOW. A recent thread on Flashcoders “setInterval id: possible…”, prompted me to set this one free. It makes managing intervals easy and more flexible at the same time.

Interval Manager provides the following:

1. Structured way to add and remove Intervals from the player

2. Allows managed intervals to support many functions

3. Allows interval and interval functions to support custom arguments and custom scope.

Interval Manager

#include “”

// Add a new interval to the player

// interval time = 100

// default arguments for Interval = [0,1,2,3,4,5]

myInterval = Interval.addInterval(‘ted’,100,[0,1,2,3,4,5])

// Add a function to the interval you just created

// name the function = ted

// function = trace

// arguments = ['HelloWorld']








// destroy all intervals and interval functions!


There are lots of other uses and it makes Intervals easier to manager within the player.


ted ;)

Align Left and UPX Packer with the Flash Standalone Player

I have had to work with the standalone player on several projects requiring cross platform executables with Flash. I am going to cover two problems, align left and player file size.

The standalone player does not support an SALIGN equivalent from within the player itself, so you have to make one yourself using actionscript.

fscommand(“showmenu”, false)

fscommand(“allowscale”, false)

onResize = function(){

// 500 is the design size of your SWF at authortime

_level0._x = Math.round(-(Stage.width – 500)/2)

// 400 is the design size of your SWF at authortime

_level0._y = Math.round(-(Stage.height – 400)/2)




It works great and keeps the (0,0) coordinate at the corner of the Standalone Player window. This works on both Mac and PC flawlessly! ;)


Second issue is player size.

I have found this tool immensely useful as it compresses an EXE or DLL.

UPX Packer

Here are some samples:

965 Kb – Flash Standalone Player

483 Kb – UPX Flash Standalone Player

953 Kb – Python 2.3 DLL

336 Kb- Python 2.3 DLL

Both of these examples worked identically before and after compression!

It also looks as though UPX is compatible with Unix so compression of projectors on OSX is potentially supported. Someone try this out on OSX and see if it works. Log your results in the comments.

Less to download!


ted ;)

From the Vault – Drag() a StartDrag/StopDrag replacement

I bought a 500GB Lacie Firewire hard drive and have been doing spring cleaning. I found this jewel from a long time ago and thought I would share. The example is a replacement for startDrag and stopDrag but allow many clips to be dragged at once across many different timelines.

The sample was intended to remove several limitations with startDrag/stopDrag. Even more useful is that with a feature equivalent replacement drag, startDrag/StopDrag can then be used for event based purposes in context with _droptarget. I believe the first version drag was created in the months following the release of Flash 5 as support for clipEvents was added combined with this new stuff called ActionScript.

Drag v1.0 Example


The drag method used identical syntax to startDrag with the exception of passing a -1 to execute a stopDrag equivalent. Here is the code for the example:

mc_red.onPress = function(){this.drag(1,[150,150,450,450])}

mc_red.onReleaseOutside = mc_red.onRelease = function(){this.drag(-1)}

mc_blue.onPress = function(){this.drag(0,[50,50,550,550])}

mc_blue.onReleaseOutside = mc_blue.onRelease = function(){this.drag(-1)}

mc_green.onPress = function(){





mc_green.onReleaseOutside = mc_green.onRelease = function(){





Simple and effective. In a later version I added logic to support onDrag and onDrop events and integrate this into the larger PowerSDK project.

Much more to come.


Ted ;)

XMLSocket on Port 80 via Flash Player 7,0,19,0 and Policy File….Amen!

This profoundly affects the compatibility of socket communications through a firewall allowing access to ports below 1024!

Due to security changes in Flash Player 7,0,19,0 you can designate a custom location for a policy file as follows:‘’)

You can also specify port level access within the Policy File as follows:

The to-ports allows you to specify access at a port level, thus allowing access to ports below 1024 like Port 80. This opens the door to getting socket apps in Flash into corporate setttings along with getting Flash compeditive in the instant messaging space. This is a huge change for servers like Jabber as high port clients have been problematic as an admin must change the firewall settings. Port selection can make a huge difference in the number of compatible end users.

Links of Note:

Macromedia Security Details

Unity Policy File Notes

Special thanks to developers at Macromedia for this change, this is a profound advance for socket based communication with the Flash Player.

I never thought I would say it but, thanks Policy File!


ted ;)