Saturday, May 24, 2003

Authorware and WinAPI are there any references? - Part 1

Have you ever tried to use any functions from the WinAPI.u32 supplied with Authorware? If so you will no doubt have been frustrated by the 'information' provided with the functions. If not, here's a quick example.

Imagine you want to copy a file from your application CD to the user's hard drive. What Authorware function would you use? Seems like a simple enough request doesn't it? Well there is no native CopyFile() function in Authorware. There are many options for solving this problem, one of which is to load the CopyFile() function from WinAPI.u32. So let's try it.

1. Open a new Authorware file, and save it somewhere convenient as TestCopy.
2. You need a test file to copy, so make a new text file in the same folder you just saved your Authorware file into. Call this text file TextCopy.txt,
and type some text in it. Something simple like Hello Mum.

Now we need that CopyFile() function. Loading a new function into Authorware from a .u32 is pretty simple.

3. Open the Functions dialogue either by pressing the Functions button or pressing the keys control+shift+f.
4. Click in the Category: drop-down and scroll down to the bottom until you find a category named TestCopy.axp (where the x in axp represents your version of Authorware - a4p for Authorware 4, a5p for Authorware 5 etc.) and select this category.
5. Press the Load button at the bottom-left of the Functions dialogue.
6. A Windows browse dialogue entitled Load function appears. Use it to browse to the folder containing your current version of Authorware - by default it should be:-

C:\program files\macromedia\Authorware x
(x will be your Authorware version number - 4, 5, 6, 6.5 ...)

Now here you take a sneaky shortcut. It is best to load your function from a u32 that is in the same folder as your application. When you do this Authorware stores the reference to the file as a relative reference, not a hard-coded path. Whilst it should not matter once the file is packaged, it is more elegant to use the relative path during development plus it helps to ensure that you package the correct files with your application.

So the sneaky shortcut is this:- Locate the file WinAPI.u32 in the browse dialogue, select it with a SINGLE mouse click and then press Control+C to copy the file to your clipboard. Keeping the browse dialogue open, now browse to the folder that you have saved your test file into. With the folder open, press Control+V to paste the WinAPI.u32 into your test folder.

Continued in part 2 below

Authorware and WinAPI are there any references? Part 2

7. Double-click the file WinAPI.u32. A dialogue opens entitled em<>Custom functions in WinAPI.u32.
8. A brief browse of this dialogue reveals hundreds of functions that are available to you from Authorware.
9. For now we are interested only in CopyFile, so scroll down to it and, for now, select it with a single click of your mouse.

This is where things stop being completely simple. Notice what the Description filed says :-

BOOL = CopyFile( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, BOOL bFailIfExists )
Windows API Call See Windows SDK for description.

First, the parameters? What is that all about? Well as Authorware developers, all we need to know is that it translates to:-

success:=CopyFile(From, To, Overwrite?)

From would be the file you are copying, e.g.

To would be the file you copy to, e.g.

Overwrite? is 1 if you want to overwrite the file if it already exists, and 0 if you don't want to overwrite.

So where is this Windows SDK that we are supposed to reference? Sadly not on your Authorware CD. You need to go to Microsoft for that. If you already do Windows development with, say C++ or Delphi you may already have an appropriate Windows API reference. If not, you need to go to MSDN. However the reference there is all aimed at C programmers. Take, for instance, the CopyFile() reference.

Fortunately there is a nice reference designed for Authorware - the Authorware Win API Guide. This site documents around 70 WinAPI functions with example code and files.

Important notes
Many WinAPI functions are not suitable for use with Authorware because they require variable types not available with Authorware, or the require advanced memory manipulation.

It appears some functions do not work with Windows XP. If in doubt, check with the Aware List, there are several people there who can answer specific questions about using WinAPI.

Friday, May 23, 2003

Free Sci-Fi/Fantasy books for your PDA

At Christmas I was given a PDA by my super-generous girlfriend. Being skeptical of such 'toys' I was then obliged to prove that I could make this little pocket computer into something useful in my life. I have several uses that mean I use it many times daily - sometime I'll post about more of those.

My main use for it is as a super-portable book. How so? you may ask. Well my PDA runs Microsoft's Reader software and I have found a great resource for free Sci-Fi/Fantasy books in many formats - one of which is the Microsoft Reader format.

Head over to the Baen Free Library and see for yourself.

Be warned - not all of the books are a great read, but since you can download approximately 60 books for free there are plenty to choose from. They take up a mere 25 Mb of storage space so you can carry them on your PDA storage card or on your laptop's hard drive and have them available wherever you go. I particularly enjoy reading mine on the train, plane, whilst cycling in the gym, even in restaurants when I work away from home. As you know, carrying even two books while you are travelling is a pain - even more so if you happen to finish reading them before the trip is over!

Wednesday, May 21, 2003

Pasting ASP source code into Authorware Display

I see this asked occasionally:-

"I am trying to paste ASP source code into an Authorware Display icon. When I close the Display icon I get the error "Where is function blah()?. How do I fix this?"

The answer is surprisingly simple. In JScript (and many other programming languages, for instance ActionScript, C) the code of custom functions is wrapped in curly brackets "{ }". Authorware uses these same characters in Display icons to denote variables or expressions that it is to evaluate at runtime. When Authorware sees these in code that has been pasted into a Display icon, it assumes you want to evaluate what is inside the brackets.

The cure is simple. Just escape the curly brackets. So if you want to paste in this simple JS function:-

function areaOfSphere(radius) {
return 4 * Math.PI * (Math.pow(radius, 2));

escape the curly brackets thus:-

function areaOfSphere(radius) \{
return 4 * Math.PI * (Math.pow(radius, 2));

Tuesday, May 20, 2003

TAAC 8 dates and venu annouced - and special draw for early birds ...

TAAC8 - The Alternative Authorware Conference
Alexis Park Hotel, Las Vegas NV, Oct 23 - 25, 2003


Want to go to Vegas for FREE?

Register early, and WIN! One lucky winner will be drawn from the first 20 General Admission tickets sold to win an all expenses paid trip to TAAC8! That's right folks - one lucky person will win airfare, lodging, and their ticket compliments of Mark Henry Enterprises, Inc.

For more information, or to register, go to:

Another good FlashMX XML tutorial

This one also gives good explanation. Better - it mentions several neat tricks in passing, for instance suffixing your XML object name with "_xml" informs the ActionScript editor that the variable is an XML object and the editor will provide a dropdown list of appropriate methods during editing. Sweet :-)

The FlashMX XML tutorial can be found here and it is hosted by This too appears to be an excellent resource.

Monday, May 19, 2003


Why do so many web sites insist on turning off my status bar in Internet Explorer? What are they trying to hide? What right do they think they have to mess with my settings? It's my machine I am using and I should have every right to control my own settings!

If anyone knows of a way I can block these selfish idiots from changing my browser settings, I'd be pleased to hear from you.

A Simple Flash XML Tutorial

I was looking for a nice, simple, clear tutorial today to get me started with using XML in Flash. I found several badly written tutorials - ones with poor code, or with bad explanations. I won't tell you any more about them.

But I did find one tutorial that was perfect for my needs. It is clear and explains everything in great detail. Even better, the code is good - simple, efficient, no unexplained weirdness.

The tutorial in question is at and goes by the title of Philter's Flash/XML Tutorial. It explains how to create a simple dynamic menu in Flash MX, or to quote "A basic introduction to XML and it's usage in Flash to build a simple dynamic menu".

A scout of the web site shows a large number of other useful tutorials for Flash, Dreamweaver, Director, Photoshop, Freehand, PHP, Perl and many other tools. Seems like an excellent site.

Sunday, May 18, 2003

Copy protect your AW CDs?

Occasionally people ask on the newsgroups if it is possible to copy-protect the CDs they sell to their clients. The economical answer is usually no. However Apixel has a product for sale called Castellan that looks like an affordable and viable solution. Developed by a well-respected UK company PTT, Castellan:-

• is the copy control system that strikes the right balance between security and ease of use for both you and the end-user of your software.
• has a proven reliability and robustness. PTT has been using this system to protect its own e-learning programs for over two years on PCs all over the world.
• will protect programs running under Microsoft Windows 95, 98, NT4, 2000 and XP
• will protect programs developed using Macromedia Authorware and Director. Castellan will also protect software developed using programming languages such as C++, Delphi, and Visual Basic.

Please note that Castellan does not actually prevent disc copying, but it does tie the product installation to a single installation; think of it as a secure licensing system.

If you prefer a different solution, the following were all recently suggested on the macromedia.authorware newsgroup:-


I also found these on a quick web search:-
Microsoft tools

Please note that since I have not used or tested any of these products I am making no comment about the quality or value of any of them. I am not recommending any of the products. I am merely bringing them to your attention.