Monthly Archive for April, 2007



when you’ve loaded other clips into your movie has always been very painful.
You can’t


a asset into a loaded clip that is located in the parent movieclip, and conversly you can’t


a asset in a parent that was loaded into a child.

This is extremely frusterating… but after some searching today I came across this interesting link. Using the fact that Flash likes to cache everything it can, he created a function that will load an clip that contains an asset into the movieclip you are trying to use


Nice idea, never thought of doing this before.

Note: this is only needed if you are loading external movieclips and want to use common assets, yes you could use shared assets but they have always given me a headache (they are a pain to create/maintain, although they may have improved since I’ve last used them), and this seemed like an interesting alternative.

After attempting to use the above mentioned method I found that the code on the site I linked to wasn’t really usable for what I was trying to do, I rewrote it a bit:

 Function: attachMovieAnywhere
 Loads a clip (should have nothing on the stage, containing just assets) and attaches a movieclip from the loaded clip onto the stage
 file - [String] path to the SWF containing the assets
 callBack - [Function] function that will be called once the asset swf is loaded, and the movieclip has been attatched. The scope of the function is the attatched movieclip, and the first argument is the attatched movieclip.
 If you need a different scope use the <delegate> class.
 NOTE: this does not call once the attatched movieclip has been initialized, only when it has been attatched!

MovieClip.prototype.attachMovieAnywhere = function(file:String, idName:String, newName:String, depth:Number, initObject:Object, callBack:Function) {
    if(depth == undefined)
        depth = this.getNextHighestDepth();
    var parent:MovieClip = this;
    var container:MovieClip = this.createEmptyMovieClip(newName, depth);
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    var listener:Object = new Object();
    listener.onLoadInit = function (mc) {
        parent[newName] = mc.attachMovie(idName, newName, mc.getNextHighestDepth(), initObject);
        if(callBack)[newName], parent[newName])
    mcLoader.loadClip(file, container);

Here is some example code showing how it is used:

attachMovieAnywhere("asset.swf", "aAsset", "coolthing", getNextHighestDepth(), {_x:-40, _y:-40}, function(mc) {
    if(mc == this) {
        // mc == this unless you use the Delegate class to change the this var
        trace("They Do!")

    // you can do initialization here
    mc.onRollOver = function() {
    mc.onRollOut = function() {

Average Rating: 5 out of 5 based on 174 user reviews.

This isn’t something that is as straightfoward as you would think. There is no real ‘cocoa native’ way to acomplish this, and there seemed to be no information anywhere on how to acomplish this until I found this post. So it seems the only way to scroll to an anchor is to resort to evaluating javascript code:

- (void) jumpToAnchor:(NSString *)anchor {
    [oWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"var anchor = document.anchors[\"%@\"];window.scrollTo(anchor.offsetLeft, anchor.offsetTop);", anchor]];

Average Rating: 4.6 out of 5 based on 152 user reviews.

No, not the toilet, your file streams.

I was recently working on a project that involved creating a child process and reading its


to update the user inteface. Everything was working great until I sent it off to some testers who reporting that it ‘wasn’t working’ – the interface wasn’t updating correctly. I first thought it was a problem with the shell command itself, maybe it wasn’t performing the operation correctly and thus wasn’t sending the correct message through


but as far as I could tell everything was working perfectly. After about 3 hours of banging my head against the wall trying random things I finally thought to flush the


after sending my status message. It fixed it! But why would it would fine on my laptop (intel), my desktop (ppc), but not my old laptop (ppc)? The problem arose from the fact that right after sending the data to


the child process would call a function that would block indefinitely. I learned my lesson, always flush the stream if you are depending on reading that output in a timely manner!

Average Rating: 4.7 out of 5 based on 268 user reviews.

Following the XTrace 1.1 update is XASH 1.4. This is a smaller release, but still comes with a good number of improvements:

  • Search speed improvements
  • Hitting return with the help tree in focus will open the currently selected page in the help tree
  • Hitting return in the search field will cause the top most search item to open
  • The book filter is now ‘sticky’ (remembers which book you last filtered by)
  • Compiled & tested as a universal binary

Actionscript 3 Support

Alot of people have emailed me asking about support for Actionscript 3. The fact is, I dont use Actionscript 3 yet (don’t do nearly as much Flash work as I did), so I have no desire to add support for Actionscript 3 documentation. The only way support for Actionscript 3 is going to be added is if I get a huge flash job that requires/needs Actionscript 3.

If you want Actionscript 3 support and XASH and think you might be able to add it yourself contact me and I’ll give you access to the SVN repo.

Now with XASH 1.4 & XTrace 1.1 finally released I can start working on releasing the next big improvement to your flash workflow :)

Average Rating: 4.4 out of 5 based on 246 user reviews.