« December 2004 | Main | February 2005 »
January 28, 2005
Getting a list of installed fonts
If you want to get a list of fonts that are installed on a computer at run-time using Lingo or JavaScript syntax, then you simply need to make use of the fontList() method for font cast members in Macromedia Director. It's really rather simple, here are the steps needed, including code examples.
1. Create a font cast member
You can do this ahead of time by inserting a font using Insert>Media Element>Font..., or you can do it at run-time using code:
-- in Lingo
tFontMem = new(#font)
-- or
tFontMem = _movie.newMember(#font)
// in JavaScript syntax
var tFontMem = _movie.newMember( symbol("font") );
2. Call the fontList() method off a font member reference
Once you have a reference to a valid font cast member you simply call the fontList() method off that reference:
-- in Lingo
tFontList = tFontMem.fontList()
// in JavaScript syntax
var tFontList = tFontMem.fontList();
When called this method builds a Lingo linear list of strings, where each string in that list is the name of a system-installed font. It's important to note that you're getting a list of _all_ installed fonts that can be used in your text and field cast members.
Stay tuned, next week I'll post about a variation on this theme that lets you get a list of the fonts that are insertable or "recordable" as font cast members as opposed to a list of each and every font that's installed.
Enjoy.
Disclaimer: I make no guarantees regarding validity or usefullness of the information contained in this post. This feature was left as undocumented, and therefore unsupported on purpose, it either wasn't fully developed and/or it wasn't fully tested. I suggest that you utilize this technique in experimental movies due to the potential risks involved. There is no guarantee that this undocumented feature will survive from release to release. Use this technique at your own risk!
Posted by thiggins at 02:30 PM
Gems from the Cave of Undocumented Features
Over the years there have been many bits of functionality put into Macromedia Director and/or the Shockwave Player that have never seen official and documented support. There are many reasons for features or functionality to fall into this catagory, an over-zealous development engineer having fun or features that turned out a wee bit buggy or even areas that were simply not tested well enough to get full and proper support. During my tenure at Macromedia I've had the pleasure of sharing some of these functional gems with the developer base and I'm hoping to set about doing that again, here, on my blog. But before doing so I need to make a few things clear to all interested parties:
1. I will be disabling comments on all posts made under the "Undocumented" catagory. I'm doing this to prevent any backlash comments regarding displeasure at these not being official features and to prevent folks from providing any further details that might not be appropriate for these posts. Sorry, but so it goes. Please note that comments are enabled for this post, but won't be for others. ;)
2. I will be providing a disclaimer in each and every post made under the "Undocumented" catagory so that the stance of these items is clear within the scope of the product as a whole.
3. If the posting of these items turns out to be problematic then they may be removed, I'm trying to post them here as a bit of a service to our customers and to enable others to have fun exploring them for what they might be good for.
4. Come back each Friday as I'm going to do my best to post a new undocumented tidbit at the end of each week.
So, let it begin...
Posted by thiggins at 02:04 PM
Kaptein Sabeltann: PS1 quality 3D using Director!
Ok, wow. While I find that tons of folks are out there making impressive content using our tools I find that there are occasional gems that really stand out head and shoulders above the rest. One of those is Kaptein Sabeltann, a real-time 3D game developed by Lucas Meijer in conjunction with the folks at ArtPlant that's being sold as boxed-product on the shelves of Norwegian stores. But never fear, Lucas has managed to provide folks an on-line version where you can try it out for yourself and see what's possible using Macromedia Director and it's 3D Asset Xtra. Take a peek:
Please be aware that it will be an approximately 10MB download to view the demo so be patient. The game was never intended for web-distribution, rather it's targeted at boxed-product delivery, therefore it's rich with media that add to the overall file size (like all the voices!). The game is slick and very professional looking and from my perspective demonstrate's the fact that Macromedia Director, in the right hands, allows one to develop 3D titles whose render quality is on par with the first generation of Sony Play Station's.
I'm suitably impressed, well done guys. Kudos to Lucas and ArtPlant for creating such an awesome piece of content.
Posted by thiggins at 01:51 PM
January 06, 2005
New Publish Templates for Director MX and MX 2004
Over the past two releases the publish templates included with Macromedia Director (versions MX and MX 2004) haven't changed much. Due to hearing requests for it a number of times recently I've produced some updated publish templates as well as a separate *.js file that contain what I feel is more robust Shockwave Player detection code. To start, I've posted a few files on my poppy site for folks to download:
browser-based shockwave player detection code
Once you've downloaded the files available there you can update your installation of Macromedia Director with these new templates as well as use the *.js file for separate use in pages where a more customized experience is desired. Here are some very brief instructions on how to do each of these tasks.
Update Your Publish Templates
There are two new publish template files available at the URL above, one that verifies that the user has at least Shockwave Player 8.5 installed (MX_Detect.htm) and another that verifies that they have Shockwave Player 10.1 installed (MX04_Detect.htm). Once you've downloaded these files simply quit out of Macromedia Director (if it's running) and use these to replace the files found in the Publish Templates sub-folder. Once you restart Macromedia Director you can use these new detection templates when you publish your Shockwave Content.
Note: if you download and view these template files you'll see at the top of the JavaScript code that the required minimum major/minor version is set through a pair of variables, change those as needed.
Using the JS file to get the installed player version
Download the available *.js file and either copy the code in-line into your page or simply link against the *.js file. Once you've done that you can then call the getSWVersion() function and it will return a string that indicates the version of the Shockwave Player that was detected. If the user has Shockwave 7 or newer installed then the version will be returned as a string using the format of "m.n" where m is the major version found and n the minor version found. If the user doesn't have the Shockwave Player installed, or they have a version prior to Shockwave 7, then an empty string will be returned.
Be careful, the function returns a string and not a number so you must parse it if necessary.
All of this information is destined for the Macromedia Director Support Center as part of the following two tech notes:
Tech Note 14789: Site design strategies for Shockwave Player detection
Tech Note 15722: Detecting Shockwave Player using JavaScript
Enjoy!
Posted by thiggins at 02:11 PM