Archive for July, 2007

Celtic Knotwork

Friday, July 27th, 2007

I admit the number of posts have decreased since my son was born last wednesday :), but time’s been hectic since then. His name is Roan, and he is the tiny little brother of his very big brother Leon, who is almost 4 by now. We’ve all been great, he is growing rapidly already, and I’ve been amusing myself with some celtic knotwork instead of Flash programming, since his name is from Celtic origin.

Here are some of my doodlings:

Roan Celtic

Roan Celtic

Drawing using controlpoints

Wednesday, July 18th, 2007

There is an old trick which comes down to drawing a fluid line through controlpoints, by using the average of the controlpoints as anchors.

As usual most of my blogging is triggered by post on the flashcoders list, making me want to try things for myself. This has probably been done a million times, but here is my quick and dirty go at it:

You can download the example here.

Subversion problems

Tuesday, July 17th, 2007

Today our Subversion / Tortoise software began acting weird.

It randomly displayed errors/behavior such as:

  • Error bumping revisions post-commit
  • Error: Can’t move ‘P:\544 Politieacademie projecten\Behrloo\checkouts\test\3\trunk\deploy\.svn\tmp\entries’ to ‘P:\544 Politieacademie projecten\Behrloo\checkouts\test\3\trunk\deploy\.svn\entries’: Cannot create a file when that file already exists.
  • stopping an update while it wasnt even completed
  • We narrowed it down to two sources:

  • zonealarm
  • overlay icons on network drives in tortoise
  • So far the only workaround I’ve found is to disable both.

    arguments.callee._name?

    Monday, July 16th, 2007

    A question on the flashcoders list about an hour ago triggered me to put together a very simple example that I have been wanting to put together for ages now.

    How do you get the name of a function?

    With function we could refer to:

  • any function
  • a calling function
  • a function being called
  • My reflection package is at the core of my xflas2 logger, but I don’t think a lot of people have been using it. Even though it provides much the same information MTASC can put into a trace statement WITHOUT MTASC (except for the linenumbers). Not that I don’t like MTASC, I absolutely love MTASC and never leave home without it ;-).

    Anyway, the reflection package is perfectly capable of being used standalone without my logger or Xray around (yeah that’s right: osflash.org/xray yeah baby!). It provides two simple classes with an even simpler API: ClassFinder and FunctionFinder.

    Imagine a function:


    private static function runExample3() {
    _print (
    "I am :"+
    FunctionFinder.getFunctionName(arguments.callee)+
    " and I am defined in "+
    ClassFinder.getClassName(
    FunctionFinder.getFunctionClass(arguments.callee)
    )+
    " and OH YEAH I was called by "+
    FunctionFinder.getFunctionName(arguments.caller)
    );
    }

    Note that it’s static, but it doesn’t have to be, I’m just being a lazy git.

    This prints:


    I am :runExample3 and I am defined in SampleClass and OH YEAH I was called by main

    Now, for the small print : you HAVE to call ClassFinder.registerAll() once somewhere at the start of your program.

    For your convenience I’ve put an example together for download, have fun and let me know what you think of it!

    Note:
    I am working on an (xuse da tude but I’ve been very happy with it so far) awesome new version of a reflection package, which doesn’t have the registerAll requirement, but I’m not quite there yet so for now this will have to do :).

    Art.ObjectPainters.Com online

    Friday, July 13th, 2007

    Yesterday I took a big step, I removed my screatoris site, and put a collection of my best work online at Art.Objectpainters.Com. This is more of a psychological step then anything else. A decision to get back to the basics of fun, doing what I like and trying to do it professionally.


    Art . ObjectPainters . Com

    Preventing dynamic property collision

    Monday, July 9th, 2007

    We sometimes have to deal with dynamically added properties at runtime, and looking into the code of some frameworks, we are not alone in this. However, whereas our packages are carefully structured to provide classname collisions (according to the standard reversed domain name convention), my experience is that developers take no such precaution when it comes to adding properties to objects at runtime.
    So it’s very probable for two different frameworks to add say a “className”, or a “hashCode” or a “key” property to classes or objects.

    Now the odds of using two frameworks together might seem slim, but on the other hand its a very subtle bug waiting to happen. You might not be using 2 frameworks, but you might use a component based on another framework loaded at runtime that does etc.

    I dont know if any of you are using any convention to prevent this, but we have recently started to use a very simple convention to make sure this doesnt happen, and I thought I’d share it.
    Instead of object[”key”] or object[”className”] etc we have recently started to define these as:
    private static var _key:String = “_”+[insert classname here]+”.”+[insert propertyname here]

    so for example:

    private static var _key:String =
    "_nl.trimm.util.SessionUniqueIdentifier.key";

    and then later on

    myObject[_key] = ....

    I’d like to hear if there are any of you who are using similar conventions or how you deal with this ‘problem’ (problem is a too big of a word for such a minor detail, but still).

    Some of the subtle errors on collisions like this are 256 recursion errors, hanging applications, not working in general etc.
    In my opinion a convention like this is especially important for sources you plan to release to a bigger audience, where these sources act upon the properties of all classes and objects from somewhere other than the class or object itself. As said above classes that fall into these categories are hashcodefactories, reflection utilities, wrappers and there might be more.

    Flash Reflection package

    Friday, July 6th, 2007

    In the ongoing work on our internal framework, this week has been dedicated to rewriting the reflection package. A reflection package in general is responsible for providing you with names for your objects.

    For example if you use:
    ReflectUtil.getName (Stage);

    the result would be:
    “Stage”

    Very handy for loggers and stuff. As a matter of fact my current reflection package is the package integrated in Xray). That implementation is pretty solid & simple however some things are bothering me about it, and I have partially solved them at the moment. I don’t think it’s going to replace the simple package anytime soon, but I do know the new package rocks.

    At the moment it can tell the names for all packages, classes and functions and whether a function is static or not. No references are kept between the object being reflected and the reflection object itself.

    In addition methods are provided to resolve a reflected object to the object being reflected and vice versa. It includes a basic visitor implementation so to act on the class tree you no longer have to deal with all the nitty gritty details of methods, properties etc.

    At the moment I’m working on optimizing the implementation and synchronizing the source after new code loads. I’m not sure whether I should override the loadMovie function for that or implement a Command queue, with a simple RefreshCodeTreeCommand.

    kk back to work now, I’ll post the result to the flashcoders list when it’s done.

    Image Perspective Effect

    Monday, July 2nd, 2007

    Very rudimentary image perspective demo. Since it’s performance intensive in AS2 you’ll have to click the more link if it’s not already visible.

    You just got to read the original story by the way, it’s hilarious :) : http://www.b3ta.com/board/496182

    (more…)

    Image Flipping

    Monday, July 2nd, 2007

    A post on the flashcoderlist (http://www.mail-archive.com/flashcoders@chattyfig.figleaf.com/msg34296.html) asking about an image turn around effect got me coding for 2 hours in a row until I finished it and realized my effect was not quite similar to what was required (http://www.ja-ik-doe-mee.be/).

    Anyway I liked it nonetheless so what-the-heck :), posting it anyway :)

    You can download this example here (Flash IDE & FlashDevelop / MTASC compatible).