Thieves

August 20th, 2007 § 1 comment § permalink

Just a quick note right now because I’m running out the door, but I have found a site that has stolen some of my code. It looks like they decompiled some of my SWFs, changed the graphics, and rebuilt them as their own.

I’m not going to link to their site because I don’t want to give them any traffic. Not sure what the best route to take here is.

UPDATE: I downloaded one of the obviously offending SWF files and decompiled it. Yep, that’s my code all right, with the same class names and all.

What’s the next step? The whois data for the domain is “Whoisguard protected”.

UPDATE 2: There’s a Facebook application that lets you embed those pets into your profile, although I don’t know if the creator of the app is the owner of that website. I have contacted the Facebook app’s developer for more information.

Adobe AIR and flashlog.txt?

August 15th, 2007 § 2 comments § permalink

I’m experiencing a strange problem: when running an Adobe AIR app, the Flash debug player trace() log stops updating!

The details: I’ve followed the steps in this article so that I can read the output of trace() while running Flash movies in the browser. I use cygwin and the tail command to view the log updating in real time (I’m running Windows XP SP2 Home).

Now, I’ve noticed that whenever a new instance of the Flash player loads, it clears the flashlog.txt file. The tail command reports this as “tail: flashlog.txt: file truncated“. This happens when, say, I reload a Flash movie in IE and then in Firefox. But in both cases, logging of trace() continues after the file is cleared.

However, whenever I launch an AIR app (for example, the excellent tweetr or kuler apps), not only does the log file truncate (as I would expect), but the flashlog.txt file stops updating, no matter what trace() commands execute in my browser movies. The file stays at zero length for as long as the AIR app is running. When I quit the AIR app, trace() commands resume logging to flashlog.txt.

It’s quite odd. Note that I am not the author of these (or any) AIR apps, so I do not know if those apps are using trace() at all. Perhaps it’s just a case of AIR locking flashlog.txt and not letting go until the app(s) are closed?

The upshot is that I have to close any AIR apps before following any trace() logs. A small inconvenience, but it took me a while to figure out :P

Adobe AIR and flashlog.txt?

August 15th, 2007 § 2 comments § permalink

I’m experiencing a strange problem: when running an Adobe AIR app, the Flash debug player trace() log stops updating!

The details: I’ve followed the steps in this article so that I can read the output of trace() while running Flash movies in the browser. I use cygwin and the tail command to view the log updating in real time (I’m running Windows XP SP2 Home).

Now, I’ve noticed that whenever a new instance of the Flash player loads, it clears the flashlog.txt file. The tail command reports this as “tail: flashlog.txt: file truncated“. This happens when, say, I reload a Flash movie in IE and then in Firefox. But in both cases, logging of trace() continues after the file is cleared.

However, whenever I launch an AIR app (for example, the excellent tweetr or kuler apps), not only does the log file truncate (as I would expect), but the flashlog.txt file stops updating, no matter what trace() commands execute in my browser movies. The file stays at zero length for as long as the AIR app is running. When I quit the AIR app, trace() commands resume logging to flashlog.txt.

It’s quite odd. Note that I am not the author of these (or any) AIR apps, so I do not know if those apps are using trace() at all. Perhaps it’s just a case of AIR locking flashlog.txt and not letting go until the app(s) are closed?

The upshot is that I have to close any AIR apps before following any trace() logs. A small inconvenience, but it took me a while to figure out :P

My Amazon order arrived

August 8th, 2007 § 2 comments § permalink

My latest Amazon order arrived, including Colin Moock’s Essential ActionScript 3.0! My journey towards Flex and AIR continues slowly…

SWFFix releases public alpha!

July 28th, 2007 § 2 comments § permalink

SWFFix logoI was excited to see SWFFix announce the release of a public alpha. I had begun to fear that the project was moribund. SWFFix is from the developers of SWFObject, UFO and the Flash player detection kit, joining forces to create what one hopes will be the best Flash-embedding method yet.

I haven’t tried it yet, but based on reading the documentation, it seems they’ve come up with a clever approach, one that’s different than both SWFObject and UFO (although you can also use it in a SWFObject/UFO-like manner if you want to).

Instead of using JavaScript to write the Flash object or embed tags, you instead use regular W3C-compliant markup to add the Flash content to your page. Then the SWFFix JavaScript library steps in and fixes the issues that can arise on different browsers and platforms. For example, it fixes Internet Explorer’s “click-to-activate” mechanism. It can also optionally adds enhancements like ExpressInstall.

I think it’s a great approach. If JavaScript is disabled, for example, the Flash content will still play (unlike what happens with SWFObject and UFO). I will have to try it out soon.

Learn something new every day

July 25th, 2007 § 2 comments § permalink

Until today, I did not realize that any HTTP requests made by a Flash movie (including LoadVars.load(), MovieClip.loadMovie(), Sound.loadSound(), etc) includes cookies — the cookies that would normally be sent by the browser anyway. In retrospect, this makes sense and is perhaps even obvious: since the Flash player asks the browser to make the connection, then it really is the browser doing the requests, so why wouldn’t the browser send and receive cookies as normal? For some reason, though, it was a surprise to me.

What does this mean? It means that it’s much easier for a widget to work in conjuction with PHP sessions, for example: I had been putting the session ID in FlashVars so that the Flash movie could add the cookie manually with addRequestHeader(), but it turns out that that is unnecessary.

More cryptic notes to myself about execution order in Flash

May 31st, 2007 § Comments Off on More cryptic notes to myself about execution order in Flash § permalink

When a nested MovieClip with a custom subclass is created, the order is something like this (I think):

  1. the asset is created (as a “plain” MovieClip: it has its name, dimensions, etc, and can be referred to by name from the containing MovieClip, but it has no methods or properties of its ActionScript class)
  2. its constructor is called
  3. any onLoad() handler is called
  4. frame scripts on the MovieClip’s timeline execute

Nested MovieClip subclass gotcha in ActionScript 2

May 25th, 2007 § 5 comments § permalink

[UPDATE: It looks like Colin Moock‘s excellent book Essential ActionScript 2.0 talks about this very situation, on page 328. His workaround is to use setInterval to poll the object to see if the custom methods/properties have been set up yet.]

This kind of stuff is always a bit difficult to describe clearly, so I might not even try :P So here are some scratched-in notes for myself:

  • Imagine a MovieClip (mc1) which contains another MovieClip inside it (mc2). This nested instance is created in the authoring tool. It would look like this in the Movie Explorer:
    example
  • Both MovieClips have (different) custom class: let’s call them MovieClass1 and MovieClass2.

The constructor for MovieClass1 looks like this:

class MovieClass1 extends MovieClip {
    function MovieClass1()
    {
        trace("MovieClass1 ctor " + this);
    }
}

MovieClass2‘s constructor looks shockingly similar:

class MovieClass2 extends MovieClip {
    function MovieClass2()
    {
        trace("MovieClass2 ctor " + this);
    }
}

Ok. Now we place an instance of MovieClass1 on the stage, name it mc1, and test the movie. Here is the traced output:

MovieClass1 ctor _level0.mc1
MovieClass2 ctor _level0.mc1.mc2

So we know that the constructor for the parent clip is called before the constructor of the child clip.

Note that this is quite unlike C++, for example, where member objects are created before the containing object’s constructor is called (see here for an example), and in fact can cause real issues. For example, suppose MovieClass1‘s constructor wants to call custom methods of MovieClass2. Those calls will fail because mc2 has not yet been initialized! Note that this only applies to methods and properties that exist in the custom class — the MovieClip exists, as a plain old MovieClip, but the custom class hasn’t been associated with it yet.

Example:
MovieClass1.as:

class MovieClass1 extends MovieClip {
    var mc2:MovieClip; /* placed in Flash authoring tool */
    function MovieClass1()
    {
        trace("MovieClass1 ctor " + this);
        mc2.customMethod();
    }
}

MovieClass2.as:

class MovieClass2 extends MovieClip {
    function MovieClass2()
    {
        trace("MovieClass2 ctor " + this);
    }
 
    function customMethod()
    {
        trace("MovieClass2 customMethod()");
    }
}

The results of running this test:

MovieClass1 ctor _level0.mc1
MovieClass2 ctor _level0.mc1.mc2

Yep. customMethod() is never called!

I hope to continue this in a later post… there are more details about the constructor-calling process that are weird and intriguing!

MovieClip.curveTo() drawing bug

May 15th, 2007 § 1 comment § permalink

I’ve recently encountered drawing glitches in MovieClip.curveTo() when using a thick pen.

In the following demo, drag the little circle handle left and right. The text box updates to display the “X” value of the handle.

This movie requires Flash Player 9

The black line is a curve drawn with a one-pixel thick lineStyle. The green line is the same curve drawn with a 30-pixel thick line (the bug shows up with thinner line widths, too, but I used a very wide line for illustration purposes).

When the handle is close to the left (values of around 20 or less), look at what happens to the apex of the curve. It goes all wacky!

For additional fun, click the “toggle full screen redraw” button. This hides or shows a rectangle with an alpha of 10% covering the whole stage. When it’s visible, it forces the Flash player to redraw the entire stage every frame. When it’s hidden, you’ll see that the Flash player incorrectly calculates the redraw area, and you’ll get weird cruft left behind as you drag the handle around (actually, I’ll bet that the Flash player calculates the redraw area “correctly,” i.e. what the damaged area would be were it not for the wacky curve apex drawing).

I wish there was a way to work around this. It looks like I’m going to have to break out the algorithm books and draw thick bezier curves myself.

Source FLA file available here.

PS. So far I’ve only tested this on Windows. Let me know if you get the same thing happening on other platforms?

PPS. Note to self: I’ll also put up a Flash 7 and/or 6 version to test with the Wii and the PlayStation 3.

UPDATE: Just tried it on Mac OS X. Same results. I imagine this doesn’t vary by platform.

JSFL in Flash CS3

May 9th, 2007 § 2 comments § permalink

I still don’t have Flash CS3, but I was wondering what was changed in JSFL in the new release. The info is on livedocs. Alas, as far as I can tell, there is no event or anything sent when the selection changes, which would be a great help. Oh well. Maybe in the next version? :P

Where Am I?

You are currently browsing the Flash category at bunnyhero dev.