Home
Troels Therkelsen's Journal
 
[Most Recent Entries] [Calendar View] [Friends]

Below are the 8 most recent journal entries recorded in Troels Therkelsen's LiveJournal:

    Saturday, November 20th, 2004
    4:30 pm
    Having fun with scripted drawing in Flash
    I'm not exactly sure why, but when drawing continual lines, you have to overdraw the bottom right corners, or else Flash will do some weird antialiasing. Let me demonstrate:

      var clip = parent.createEmptyMovieClip("__display", 1);
      var xs = 1;
      var ys = 1;
      var xe = 10;
      var ye = 10;
    
      clip.moveTo(xs, ys);
      clip.lineTo(xs, ye);
      clip.lineTo(xe, ye);
      clip.lineTo(xe, ys);
      clip.lineTo(xs, ys);
    


    You'd think that this would draw a pretty square? It doesn't. The bottom right pixel of the square will be anti-aliased. Instead you have to 'overdraw' like this:

      clip.moveTo(xs, ys);
      clip.lineTo(xs, ye+1);
    
      clip.moveTo(xs, ye);
      clip.lineTo(xe+1, ye);
    
      clip.moveTo(xe, ye);
      clip.lineTo(xe, ys);
    
      clip.lineTo(xs, ys);
    


    Yesss, my preciousss, I see a pattern. But why? The documentation says that the line is drawn from the current point and to the specified point, implying that the destination point will be drawn on. I think I'll put up a mental sign saying "Danger: Dragons that way." and stop thinking about this any further ;-)
    2:40 pm
    Flash initialisation
    There seems to be a dedicated compiler directive, #initclip, which allows for initialisation actions before the first frame of a movieclip is displayed. However, it seems wrong, somehow, to use this for the global SWF init I want to do. But it's worth a shot to see if it works.

    If it doesn't work, I can always just stick it in frame 1 of the first scene via an #include directive.
    2:10 pm
    Why isn't mine as big as everybody else's?
    Okay, so installing xemacs (look, mom, I can make URLs!) is taking a bit too long for my afternoon patience to deal with, perhaps I shouldn't be using BitTorrent while downloading xemacs. Other than these occasional moments of impatience, I'm content with my 512/512 SDSL line, even if it isn't as big as everyone else's ;-)

    Current Mood: impatient
    1:59 pm
    Macromedia Flash MX 2004 versions
    Besides the marketing drone speak "mx 2004," the latest installment of Macromedia Flash comes in two versions, the "normal" version and the "professional" version. When I originally got the "normal" version it was already a hefty financial investment (even if it's one that already has paid for itself). Now I realise that the the "normal" version doesn't allow for editing external actionscript files. What a crock! I mean, the program can display embedded actionscript just fine, so there's absolutely no technical reason why the "normal" version shouldn't be able to edit external .as (the extension for actionscript files) files, other than some marketing drone deciding that you must fork up some extra cash for the "professional" version.

    Well, screw that, I'm just going to install xemacs and use it's java mode; actionscript is similar enough to that for the syntax highlighting to still be somewhat useful.

    Of course, the disadvantage is that I won't have access to the IDE in xemacs. But I'd rather use external files than having to code hundreds of lines of inside inside the Flash authoring tool, as it is cluttered enough already with all the various toolbars and stuff.

    Current Mood: disappointed
    1:09 pm
    FlashHack: v0.1
    *sips from his chilled beverage* (no, there will be no add placements here!)

    For the first minor version, FlashHack must be able to:

    • Draw the basic display window programmatically
    • Move the player around this window using the number keypad


    In order to do this, I must find out about a few things:

    • Where do you put initialisation code in flash?
    • How big do I want the display area to be?
    • How do you setup a keyboard listener?


    It would probably also be a good idea to have as much as possible of the actual code in external files which are then included/inherited into the flash object. I write probably because knowing how the authoring tool that you use to write flash sometimes acts up, it may cause problems if the code is in an external file instead of embedded into the flash 'action pane'. I do know for a fact that you have to write complex classes in external files similar to how Java works.
    12:47 pm
    Journey into Flash
    I hated the idea of being forced to learn Flash, but a recent project (www.illemann-tryk.dk -- beware, all text is in Danish), made me realise that Flash isn't all that bad. You can actually do some pretty nifty things in it, and its cross-platform availability seems to make it ideal for deploying simple games/apps to many platforms (mac, windows, unix) with very little effort. Of course, as it is designed to deliver animated web-content, it does have some limitations (it doesn't support the client/server paradigm very well unless the server is Macromedia's special secret (and no doubt very expensive) content management server).

    Hrm, I just realised I use way too many parantheses. I suck.

    But anyway, after writing the flash for the aforementioned page, I made another web page (www.colosseumklinikken.dk), which only has a smallish flash animation on the front page. Why is this information important? Well, it made me realise that despite my own aversion towards flash (which probably come mostly from the fact that I have worked with 'serious' programming languages like C, Java, Python, etc for many many years), I was beginning to feel a growing fascination with Flash and its possible uses (including world domination, haha!).

    So I have decided to write a small game in Flash, tentatively called FlashHack. I have no idea how far I'll take this, but it should be interesting to see how much you can really do in 'ActionScript,' the pseudo-Java/Javascript-clone programming language used inside Flash applications.

    FlashHack is based on the (rather primitive) concept first explored in the game Rogue. Many, many, many clones of this game have been made throughout the years (to mention a few: Moria, Angband and NetHack). I have no intention of making the one rogue clone to rule all others, however, merely to use a well-known game concept as a framework for my exploration of ActionScript and the programmatical aspect of Flash.

    As with any iterative development/learning process, it's important to set attainable subgoals as you go along. I'll abuse this blog for that, I think.

    Current Mood: content
    12:41 pm
    Getting acquainted with LJ
    Ok, a bit annoying that the spellchecker is so primitive, but I guess the fact that it can't grok stuff like "can't" (no, I don't know the fancy official Latin word for typing "can't" instead of "cannot" so I just wrote "stuff" -- deal with it) is just LJ's way of trying to teach me how to write proper English grammar. Well, I refuse, I'm proud of my ignorance!

    It's just plain lame that the spellchecker doesn't understand the word "blog." I mean, a blog that doesn't know the word blog?

    Hah, what do you know, my first ranting post!

    Current Mood: frustrated
    12:24 pm
    You have a standpoint until you take a new one
    If you had asked me a couple of years ago (or even just a couple of months ago, really), I would have foresworn ever writing a blog. I would have said that the people who write blogs are pathetic, whining losers, and the people who read them are voyeuristic perverts. Ok, so maybe loser and pervert are too derogative terms to describe my opinion on the matter, but frankly, I couldn't see much of a point.

    In fact, I still don't.

    But, like so many others on the 'net, I figure it's more healthy to rant and seethe about it and get stuff written down than to mull over it in one's mind until you finally get fed up and head for the nearest bell tower with a high-powered hunting rifle.

    As this is my first entry, I probably should make some big declaratory statement on what I'm going to write about, but I don't really -- oh, look, it's snowing out -- have much of an idea what I'm going to feel like writing about. Originally, I had planned to write about my experiences and frustrations with Flash (a popular authoring tool for animated web-content, in case you didn't know), but now that I am writing this note, my mind is overflowing with a rush of power and I must restrain myself from laughing out a mega-lo-maniacal cackle over the sheer amount of options for world domination this tool gives me.

    Instead, I'll just rub my hands together and smirk evilly and say, "Welcome to my world, stranger!"

    Current Mood: mischievous
About LiveJournal.com

Advertisement