Quantcast Flash | The Danosphere.

The Danosphere.

Avatar

class TheDanosphere extends Dan implements Blog

I’m Very Much Still Alive

:emerges from abyss:

Hey everyone! I’ve been on leave but wanted to post a lil update here. Code samples should be up this weekend, along with a more complete version of the “AS3 Node Network” complete with XML saving.

I also have a pretty awesome BitmapData writeup coming that really stretches the limits of Flash and Bitmaps, including an optimized Async JPEG Encoder- which allows you to encode JPEGs 4x faster than the default adobe lib, and also allows you to monitor progress of the process and merge multiple BitmapData objects seamlessly.

So what I’m trying to say is good stuff is coming, so stick around! Hoping to post this stuff over a series of posts, the first of which should be up tomorrow :) til then… ;)

To Everyone Looking for Source Code

Hey guys, I haven’t forgotten you!! Sorry it is taking me so long to post the code examples [node network, tooltip flex components] but I have been super busy. As soon as this new site I’ve been working on [for months and months] is done and released [late May] I will be posting up all the code examples people have been requesting and will be more than happy help guide you through them should you require assistance!

Until then please accept my apologies, I know it’s been a while but I haven’t forgotten. For the time being I must focus my resources [time] on getting this new site live/to market, once that’s done the code postings will be the very next thing I do, promise!

Thanks everyone for you continued patience!

Using the Flex 3 Logging API

Using the Flex 3 logging API is not really cut and dry. It is made to be rather extensible and flexible but at the same time it manages to be completely painful and hard to understand. The Log, ILogger, LogLogger, TraceTarget, LogEvent and LogEvent level classes and be rather cumbersome.

An example of a straight up ‘log write’ would be:

var mylog:ILogger = Log.getLogger("my.package.MyClassName");
if(Log.isDebug()){
     mylog.debug("Hello from the logger");
}

This would get you [DEBUG] level output with the message “Hello from the logger”. The problem with this approach is that I wanted to be able to log from any class, without having to create ILogger instances in all classes. I also wanted the logging to be dynamic so I could hide the class package if I wanted, I also wanted the LogEvents to carry all the information that the actual ‘log write’ contained.

So I created CustomLogger and CustomLogEvent classes that are built on the pre-existing logging API. This simple goal of these classes is to make logging easier. Now you can directly call:

CustomLogger.debug("Hello from the custom_logger");

or you can access it with a Singleton instance:

var log:CustomLogger = CustomLogger.getInstance();
log.debug("Hello from the custom_logger");

So thats all good and well but how does this make things easier? By using the CustomLogger you now have FULL control over the log messages as opposed to handing them off to a Flex ILogger/LogLogger and letting it do what it will with the log messages. Also, you do not need to instantiate a new ILogger for every class that wants to write log output. Additionally the expanded CustomLogEvent class gives whatever is listening the full rundown on what is happening in terms of logging as opposed to just a glimpse.

Here is an example that shows how useful the new CustomLogger/CustomLogEvent classes are especially when it comes to directing log output to a different target (in this case, a List component).

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

AS3 Node Network

I have been doing some pretty cool “node” based UI stuff at work using FLEX. I wanted to try and push the idea further, but the code I wrote at work is proprietary. Thus, I’ve decided to start from scratch! Since I’m starting from scratch I decided to do it up in Flash, here is the base for it, I’ll post updates as it advances.

Use: Click to create a node. Click and drag nodes to move them around.

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

AS3 FileReference Example

AS3 FileReference Pic

A while ago I made a post about FileReference in AS2. For a recent project I needed to create a simple uploader class which uploads files to a given server from flash, so once again I was face to face with FileReference, but this time in AS3. The syntax is almost identical, with a few small nuances. Ill let you download the source** to get the full details.

This example has some a few small frills, my favorite of which is the constructor takes a directory name where you would like the file to be uploaded (relative to the upload script), this allows me to reuse this class for many different uploads, to different directories.

** Note: For this to work you need to put “upload.php” on your server and point the variable ‘phpUploadScript’ in FileUploader.as on line 20 to upload.php.

AS2 versus AS3, or “Why AS3 is awesome”…

Life has been a little crazy balancing taking so many credit hours [20], wrapping up my final quarter at RIT, my day job, TCBN, and keeping my blog up to date but its almost 1am and I finally have time to post!

I found these pretty cool “load test” flash movies [a while ago] that serve as an awesome example of how much more efficient actionscript 3 is over actionscript 2. I am currently a huge AS2 junkie, but with my recent coursework in Flex and current project in AS3 based flash, I am getting more and more fond of it. There are some differences from AS2, don’t expect a point and click transition from one version of actionscript to the other. If you are familiar with object-oriented design in AS2 the move is nearly painless (off the top of my head: Document class, event handlers, and * var type [yes, *]).

Flash is here to stay, and it’s good to see that the language that powers it is maturing as well.

* Only run one load test at a time for accurate results

| next

What's Here?