Archive for the ‘flash’ Category

Adobe Community letter

16 December 2004 | filed under community, flash, flex | no comments »

Adobe logoAs I am one of the Dutch Macromedia Adobe Usergroup managers, I received a letter from Adode (in pdf, of course! :-) that goes into some detail about the recent acquisition of Macromedia and how that relates to the community.

There is some explanation about the new positions some of Macromedia key figures now have at Adobe and how Adobe is looking forward to continue working with the community.

The letter doesn’t say anything about the open source movement specifically though, which is a bit of a pity. On the other hand, it takes a lot of work to successfully complete a merger of this magnitude I guess, so we will just have to be patient.

Read the Adobe Community Letter.

Enable / disable _exclude.xml files

29 October 2004 | filed under flash | no comments »

I often create applications that consist of multiple loaded movies. In order to reduce the overall filesize of the .swfs in my project, I use so-called exclude files. To make life a little easier, I wrote two JSFL Commands that allow me to quickly enable and disable all exclude files for a project.

JSFL icon First some background info on exclude files if you’re new to the subject. If you know what exclude files are all about, scroll down to download the JSFL Commands.

An exclude file tells the compiler not to compile specific classes into a swf. That’s great, because often, you already have several base classes loaded in a main or container movie, so you don’t need to have them compiled into movies which are loaded by the container movie.

For example, the container uses the mx.transitions.Tween class and also the mx.transitions.easing.Regular class. That functionality will now not only be available for the movie the classes are compiled in, but for every subsequently loaded movie. That means we don’t need to include those classes in any loaded movie.

An exclude file is always named [name_of_.fla_file]_exclude.xml. So, to exclude classes from being compiled into a file named dealers.fla, create an exclude file named dealers_exclude.xml in the same directory.

In this case, the exclude file would look like this:

[xml]


[/xml]

Easy. One minor drawback, you can’t use wildcards to exclude complete packages at once, you need to specify each and every class explicitly.

Unfortunately, when developing and testing your movies, you obviously need all classes to be present in the .swf, or you won’t be able to properly run your swf. That means moving or renaming all exclude files when testing standalone and placing them back when publishing your project. This can become pretty annoying.

As I always create a directory named /excludes/ to place my exclude files in when they’re not needed, I thought it would save me a lot of time to write a JSFL command that does that for me. In the downloadable zip file below you’ll find a Disable Excludes command that moves all exclude files found in the folder of the currently open .fla to a subdir named /excludes/ (which will be created if not present). There’s also a complementary command called Enable Excludes that moves them back.

Download Enable / Disable Excludes Commands.

Also note the pretty Output Panel feedback when you run the commands. :-)

To install, download the .zip file and extract both files to your user data folder, which is C:\Documents and Settings\[username]\Local Settings\Application Data\Macromedia\Flash MX 2004\en\Configuration\Commands under Windows.

8Ball: flash.filters.* ?

24 October 2004 | filed under flash | no comments »

I had an email conversation today about the ActionScript visible in the demo Kevin Lynch showed in Tokyo this week (which was recorded by Colin Moock). Apparently, there’s a new object named ‘flash.filters’ available in the new Flash Player.

If you haven’t seen the video yet, you can check it out here. As you’ll notice in the video, Kevin shows off some pretty realtime effects which aren’t just fun to look at, but are also drawn 8 to 10 times faster than the current Flash Player possibly could.

Now what’s interesting1 about those lines of code, shown in the demo? Let’s have a closer look at the actual code (thanks to Andy Hall for transcribing):

[as]var filterObj = new flash.filters.DropShadowFilter();
filterObj.blury = undefined;
filterObj.blurx = undefined;
filterObj.knockout = false;
filterObj.inner = false;
filterObj.numIterations = 2;
filterObj.blur = 44;
filterObj.alpha = 100;
filterObj.color = 0×00000000;
filterObj.angle = 36;
filterObj.distance = 11;
loaderClip.filterList = [filterObj];[/as]

There are two interesting lines here, the first and the last.

The first line…

[as]var filterObj = new flash.filters.DropShadowFilter();[/as]

…creates a new instance of a filter named DropShadowFilter, which is part of a package named flash.filters. That would mean that there are more filters available. This can be confirmed by just watching the video, as there are quite a number of different filters being showcased by Kevin.

Another thing that caught my attention, is the package name. Apparently there’s a new top level object named flash. That would suggest that there may be more sub-objects like filters Perhaps there’s another section named flash.effects, which would allow for realtime dynamic effects?

The other interesting line is the last one…

[as]loaderClip.filterList = [filterObj];[/as]

Looks like there’s a new MovieClip property named filterList. This seems to be an array, so that would mean you can stack multiple filters onto a single MovieClip. Interesting, to say the least…

It would be great if the flash package is built into the Flash player, as that would also (albeit slightly) reduce bytecode size when using scriptable, dynamic effects, as there would be no need to include that code in the .swf.

I’m sure everyone’s is anxious to see what else is new, can’t wait to find out more!

FlashEurope postponed to March 2005

11 October 2004 | filed under flash | no comments »
This rumour was in the air for some time, but I found it too hard to believe. Guess I’ll have to snap out of denial and accept the facts: The FlashEurope conference in Barcelona, Spain, has been postponed to March 2005.

“Press Release:
Looking forward to deliver the best of what the Flash community has to offer, we are adding new features to the European Flash Conference to take place in Barcelona, for that reason the FlashEurope event will be rescheduled”.

The company I work for, Lost Boys, wasn’t too happy about this, as we already booked plane tikets and made hotel reservations, but I’ve got good hopes I can join in March 2005 anyway.

AS2 XML Decompressor

13 July 2004 | filed under flash | no comments »

I recently stumbled upon an interesting method to reduce big XML files for use with Flash. It is based upon the LZ77 algorithm (Lempel-Ziv 1977) and enables you to compress static XML files to 20 / 30% of their original size.

XML is often the weapon of choice when importing data into a Flash client. Unfortunately, the structure versus data ratio is not perfect. A lot of bytes are wasted (traffic-wise) for structural purposes and it would be great if the file sized could somehow be reduced during transfer. Especially when you’re using large files (multi-language apps, large address files, etc)

The method I found on the net was developed by Mattias Stridsman, aka Strille, and consists of a .NET application to compress the XML file and an Actionscript 1 prototype to enable Flash to de-compress the XML file once it has been received.

As I’m strictly using AS2, I wrote an AS2 implementation of his Actionscript 1 prototype. You can use it in an XML wrapper class. The implementation replaces the native XML onData event. By using this replacement, loading compressed and uncompressed files will be completely transparent. Flash will be able to handle both types without any extra coding.

On to the AS2 code:

[as]// This method has been overridden to check for
// compressed data. If found, the data is decompressed
// and then parsed with (native) parseXML. If no
// compressed data is found, parsing commences immediately.

private function onData( inData:String ) : Void {

if (inData != undefined) {

var i:String = inData;

// compressed data found, decompress…
// direct copy of source at http://www.strille.net/tutorials/FlashXMLCompressor/
// except for strict typing of variables and slight optimization of for..loop
if (i.charAt(0) != ‘<’) {

var ecPos:Number = i.indexOf(” “)+1;
var eC:String = i.charAt(ecPos);
i = i.substr(ecPos+1);
var o:String = “”;
var iL:Number = i.length;
var n:Number = 0;
for ( n = 0; n < iL; ++n) {

if (i.charAt(n) == eC) {
var p = i.charCodeAt(n+1)*114 + i.charCodeAt(n+2) - 1610;
var l = i.charCodeAt(n+3)-14;
o += o.substr(-p, l);
n += 3;
} else {
o += i.charAt(n);
}
}

// decompression done, parse xml
parseXML(o);

} else {

// normal XML file found, parse it right away
parseXML(i);
}

// trigger onLoad with true result
onLoad(true);

} else {

// trigger onLoad with false result
onLoad(false);

}
}[/as]

Important: please note the fact that the decompressor attempts to distinguish compressed from uncompressed files by looking at the first character in the XML file. If that’s “<”, it assumes the source is an uncompressed file. So, make sure the first line of your XML file reads: (set the correct encoding type if required)

[xml][/xml]

Enjoy!

FSCommand Proxy for Flash Studio

18 June 2004 | filed under flash | no comments »

I don’t like fscommands. I guess everyone creating Windows applications using Flash and third party wrapper software will understand what I mean. But as I’m working on a standalone app, I created a generic fscommand proxy class that gives me callback / listener functionality in software such as Flash Studio Pro and SWF Studio.

When it comes to creating Windows applications using Flash, I’ve always relied on Screenweaver. Not only because I was one of the people who created it (although I left Rubberduck over a year ago), but also because it is the only Flash wrapper application that offers an event-driven model, instead of the cumbersome fscommand frameloops / setIntervals other software uses.

Unfortunately, Screenweaver doesn’t support Flash MX 2004 yet. So, I’ve been playing around with my license for Flash Studio Pro which was kindly provided to me by the people of MDM software. Thanks!

I quickly found out how frustrating fscommands can be, especially if you need to pass a lot of parameters to it. Example:

[code]fscommand(”flashstudio.checkconnection_ping”, “\”www.martijndevisser.com\”,\”2000\”,connected”);[/code]

This would ping my site and return a Boolean indicating success or not. Definitely not coder friendly. The escaping sequences needed to construct the arguments to pass to the fscommand are very prone to bugs and typos. So I wrote myself a class to help me out and dubbed it FSCProxy.

Using FSCProxy, the code above would translate to:

[as]var myProxy:FSCProxy = new FSCProxy(this);
myProxy.execute(”flashstudio.checkconnection_ping”, ["www.martijndevisser.com","2000"]);[/as]

I like it better this way. A clean array with the arguments to pass. Once you instantiate FSCProxy, you can use it for all fscommands you need to execute. Just add more .execute() calls. You can also easily add listeners to receive the result of the fscommand. A complete example:

[as]var myProxy:FSCProxy = new FSCProxy(this);

var myListenerObject:Object = new Object();
myListenerObject.handleEvent = function( inEvent:Object ) {
// your code here
}

myProxy.addEventListener(”fscommandReady”,myListenerObject);
myProxy.execute(”flashstudio.checkconnection_ping”, ["www.martijndevisser.com","2000"]);[/as]

The class itself is pretty straightforward and can surely be improved and extended. I wrote some documentation for it and the source (including example and docs) can be found here. Mind you, I haven’t had much time to test this yet. Please let me know if you encounter any errors.

For now, have fun using callbacks instead of fscommands!

ASDoc, continued…

16 June 2004 | filed under flash | no comments »

As I wrote earlier, Macromedia seems to be working on a new documentation standard, at least for Flash and Flex. Macromedian Mike Downey confirms this on his blog, but he also points out that there are no plans (yet) on releasing a dedicated documentation tool.

“[...] We just wanted to be clear that we are not releasing a new functionality or capability in the authoring tool. We are looking into further supporting this new documentation format in the authoring tool for future releases but we are planning nothing new in the short-term.” (full blog entry)

Pity.

Hopefully, a mature documentation tool will emerge from the list of already present programs I threw together yesterday. I’ve been playing around with some of them, but I haven’t found a truly package-name resolving, multi-folder processing, etc generator for my documentation yet. Sounds like an easy gap to fill for a clever RegExp wizard.