DesktopX Journal: Day 8

Published on Sunday, March 13, 2005 By Brad Wardell In DesktopX

Macromedia Flash is very popular on the Web.  It's used for creating advertisements, multimedia presentations, and even games.  It's designed to live on the web.  But wouldn't it be cool to marry Flash's multimedia abilities with the customization powers seen in widgets?  The answer is, you can with DesktopX.  With DesktopX you can take a flash object and embed it into a DesktopX object and the two will work seamlessly.

For my quick example I'm gong to take a Tetris.swf file and combine it with a DesktopX object. Bear in mind, if you're going to use .swf files you need to make sure you have permission (or see if it's freely distributable) before you start distributing it around.  So first you find your .swf (flash) file. 

So innocent, these two objects have no idea
what's going to be happening to them soon.

Now, you'll want to create two objects. The first one is your background, the second one is the one that will contain the .swf file. For the background, I've created a quickie Tetrisy like background. Remember, I suck when it comes to art. So I'm sure you can do better.

Oh the shame of my background. But let's not worry too much about how ugly my background. Pretend it was rendered and looks fantastic.

Now comes the really interesting part:  Embedding files into a DesktopX object. On the summary page there is a "custom files" button.  Press that button and add in your files:

So now I have the flash file in there. The next step is to make that object actually use them. So I go back to the general tab and press the "New" script button.

Once I'm in the script editor, I go to the script menu and select the Microsoft Web Browser ActiveX control. Then I add one line:

Control.Navigate2 Object.Directory & "tetris.swf"

This line tells my Microsoft Web Browser control to navigate to the object directory (where DesktopX keeps embedded files) and open the tetris.swf file

At this point, I have an itty bitty Tetris game appearing.  You manipulate ActiveX controls in DesktopX with the CTRL key (we'll be making this user definable in the future). So holding down the CTRL key I move and resize my object on top of my ugly background.  Then I select them both and group them.

And voila:

Like I said, it's kind of ugly but you get the idea.  Obviously the ultimate combination is if you know how to make Flash files as now you have an interesting way to embed them.  Or if you don't want to embed them but rather use them to drive people to your site, you can have the browser object link to your web server that has the .swf file and then add controls onto your DesktopX widget that drives people to your website.  This provides a whole new avenue for distributing Flash content.  Of course, you could create the game with DesktopX using scripting.  DesktopX doesn't currently support vector drawing natively but any sort of bitmap based game (Tetris, Pac-Man, etc.) could be done with DesktopX. 

But the goal of DesktopX isn't to try to force developers into using a proprietary system but rather let them exploit their existing skills much more effectively.

You can get DesktopX at