Articles Archive
Articles Search
Director Wiki
 

Non-rectangular MIAWs

June 8, 1999
by Mark Reijnders

Let's start with a little history. Location: Hall B of the Moscone convention Center in San Francisco. Time: around 5 PM on Wednesday May 26. Event: the UCON99 sneak preview session.

After a lot of very interesting sneak previews of the other Macromedia applications (Authorware now has scroll bars!) it's time for the Director sneak.

A Macromedia engineer dressed in an original Austin Powers outfit, shows us some of Director's new features. As is typical for sneak previews, he states that it's not sure if these feature will make it into the next version. But what he shows is a very neat feature: the ability to set the shape of a movie-in-a-window (MIAW) to a graphic. So when the speaker announces that this feature is already put in the current version of Director, after you've patched it with the 7.0.2 updater, the audience bursts out into a loud "Groovy baby!!!".

Excited, I downloaded the updater later that night (good connection speeds in Moscone!) and played with this feature. Here are some of my findings.

There are some limitations to this new feature. It will only work in projectors and not during authoring and, obviously, not in Shockwave either. Secondly it only works for MIAWs which is not a huge problem. You can always make the stage invisible and turn your MIAW in some sort of a pseudo-stage. If you only need a Windows solution and want to make the stage irregular shaped, you can use the RavWare WinShaper Xtra.

Another big limitation is that this feature is not officially supported. If it breaks in the next version of Director, you can't blame anyone, and if you call tech support they will probably tell you they've never even heard of the feature...

To stub or not to stub

But let's play with it. To make our tests easier, it is wise to make a so-called stub projector first. Otherwise we have to make a new projector everytime we changed something in our files. A stub-projector is a projector that does only thing: issue a "go to movie x" command. You can do this for example in the startmovie handler.

on startMovie
   go to movie "start"
end startMovie

Another, and in my opinion smarter, way to do this is by using the LINGO.INI file. This is a simple text file that resides next to the projector and takes only one possible handler: the startUp handler. In this handler you can use almost every (set of) Lingo commands. In an ideal world our LINGO.INI should look like this:

on startUp
   go to movie "start"
end startUp

Unfortunately this does not work. When director executes the LINGO.INI it can't do a "go" command yet. So we have to do a little trick. We have to put the filename of our first movie in a global:

on startUp
   global gFirstMovie
   gFirstMovie = "start"
end startUp

and then change the startmovie handler of the stub projector to something like this:

on startMovie
   global gFirstMovie
   go to movie gFirstMovie
end startMovie

You might want to delete the now defunkt gFirstMovie global from the globalList but I leave that as an exercise to the reader.

The sample movie in all its irregular glory

The reason to use the LINGO.INI is that you only have to make your stub projector once. So when you change some of the code or art in your starting movie, you don't have to make a new projector. Even when you change the name of your first movie, the only thing you have to do is change one line in the LINGO.INI (standard text file) and you're done.

I included a sample stub movie and a LINGO.INI in the sample files so you can be up and running in no-time. In order to minimise the download the only thing you have to do is to make a projector for the platform of your choice out of the stub.dir movie.

Irregularities

So let's finally start to play with this new MIAW feature. I quickly prepare a start movie with a button that opens a MIAW. Then I make a new looping movie with nothing in it and save it as "testMiaw.dir". So far so good. Then I open the paint window and draw some really disgusting "programmer art" random shape. For history's sake I left it in the file. Then I change the script of the button to the following.

on mouseUp
  global gMyMiaw
  set the visible of the stage = FALSE
  gMyMiaw = window "testmiaw"          
  gMyMiaw.windowtype = member "test"
  open gMyMiaw                         
end mouseUp

That's the whole trick. Instead of setting the windowtype to a predifined value you just set it to a castmember, in this case my randomly drawn graphic called "test". Anxious I run the stub projector and press the button. The stage disappears and a few moments later the MIAW opens, but all I see is a purple square. Oops! I probably forgot to make my graphic a 1-bit bitmap. I do that as quickly as I can, run the stub projector again and Voila! A beautiful blob displays itself on my desktop.

Then I try the same thing with other types of castmembers. I tried transparent GIFs, Vector shapes, Text members. But unfortunately it doesn't work... The only type of member currently supported is a 1-bit bitmap member. Also you need to make a new bitmap for every shape you want your MIAW to have. Since the irregular MIAW feature is member based, sprite features like skewing, rotating and quadding have not effect.

I polished my movie a bit: for instance I added a menu because it looks very strange if you have no menubar but can see the desktop. As an extra I wrote a behavior to drag the MIAW around on the screen. It is included in the testMiaw.dir. You can attach the behavior to a large quickdraw shape as I did, so you can drag the MIAW on every visible point, or you can make a custom window title bar and attach it just on that sprite. Aligning the title bar with the MIAW shape can be a tedious process, though. Dragging a MIAW on the Macintosh is unfortunately not really well supported by the MacOS. The screen doesn't update as fast as one would want, so there are ugly white "afterglows". On Windows it is better but it depends on your video card how good the screen refreshing really is. Your mileage may vary.

Whatisitgoodfor?

Neat, but what is it good for? I hear some of you asking this question. Well first you can make borderless MIAWs now. This was high on a lot of people's wishlists who wanted to integrate MIAWs into their stage. Also you can make very interesting, organic interfaces, both for your multimedia content and for tool palettes, control panels etc. One could even make "skinnable" interfaces, where the user can change the look and shape of the application. Just like in the upcoming Shockwave Remote. Hey, I'll bet that was Macromedia's reason why they are giving this feature now already! And imagine the following: an animated character, walking on the desktop and bouncing against your screen boundaries. Wouldn't that make a nice interactive screensaver. Anyway, I can imagine that there are many more new and interesting uses for this new feature. You will probably see them soon, on a CD-Rom near you.

Sample files are available for download in Mac or PC format.

Mark Reijnders is a multimedia developer in Rotterdam, The Netherlands.

Copyright 1997-2017, Director Online. Article content copyright by respective authors.