Before you can start building widgets with WidgetFactory, you first need to set it up correctly with your version of the Adobe Flash application. This post will tell you how to do that. (We’re assuming on this post that you intend using a licensed version of Adobe Flash. However, you can also set up WidgetFactory to create Captivate widgets with other Flash programming applications. We’ll tell you about them in other posts.)
WidgetFactory is an addition to the ActionScript language, known as an ActionScript Library or API. If you were thinking about it in the terms of a spoken language, you could say that WidgetFactory is a specialised vocabulary of words that are used to describe widgets. The problem is that Adobe Flash, by default, doesn’t know the WidgetFactory words. So we need to add a few pages to Flash’s dictionary as it were. Here’s how we do that:
1. Download WidgetFactory: The WidgetFactory Project on Google Code hosts the WidgetFactory API and all its files. If you go to the Downloads tab, you see a list of all WidgetFactory builds, past and present. To download a build of WidgetFactory, click the download button to the left of the file name, and Save it to a folder on your computer hard drive.
2. Unzip: Once downloaded, unzip the WidgetFactory zip file. This will extract a folder called swc, and inside that is another folder named widgetfactory.
3. Create an ActionScript Library folder. WidgetFactory isn’t the only ActionScript API designed to extend the capabilities of Adobe Flash. There are many others, including PaperVision3D, WiiFlash, and the Flint Particle System, just to name a few. If you use ActionScript APIs, the normal practice is to store all ActionScript Libraries in a single folder on your hard drive, and then point Flash to that folder as a place where it can find them.
So where should we put this folder? There is no real hard and fast rule about where it should go. It would probably be best to put it in the same area where you store your Flash projects. Give the folder a name like: ActionScriptLibs, Libraries, Classes, or Source. Whatever you call it, just make sure you dedicate this folder to holding your ActionScript Libraries and nothing else.
4. Copy the widgetfactory folder to your Library folder: After creating your ActionScript Library folder, copy the extracted widgetfactory folder to that location.
5. Open Adobe Flash. You can use any version of Flash that is capable of working with ActionScript 3, but Flash CS4 or CS5 are preferred. If your version of Captivate came as part of the Adobe E-learning Suite, you already have Flash as one of the component applications.
6. Add the Library folder to Flash’s Source Path: Now we need to configure Flash to recognise our ActionScript Library folder. In Flash, go to Edit > Preferences. In the Category list down the left hand side of the dialog box, select ActionScript to see the ActionScript preferences. Click the ActionScript 3.0 Settings button at the bottom of the dialog.
This will open the ActionScript 3.0 Advanced Settings dialog box. Under the Source path section, click the + plus icon. This will add a new row where we can type in the location of our ActionScript Libraries folder. If you’re like me, and you don’t want to go to all the effort of typing out the file path, then double checking that everything is correct, then realising you used \ instead of /, and then having to change them around…breath easy. Just click the small folder icon to open a file browser. Then navigate to the folder containing your ActionScript libraries, and select it. Flash will write in all that meticulous file path stuff for you.
Click OK to close the Advanced Settings dialog, then OK again to close the Preferences dialog, and you’re done!
WidgetFactory is now set up, and ready for you to start building widgets!





When I try to use your api i get
1046: Type was not found or was not a compile-time constant: ICaptivateWidgetData.
That’s interesting. Can you go into the widgetfactory folder, open up the ‘properties’ folder, and tell me if you see a file called: ICaptivateWidgetData.as
Yeah its there and im now getting a different error
1046: Type was not found or was not a compile-time constant: MovieClip.
my code:
package {
import widgetfactory.StaticWidget;
public class intro extends StaticWidget {
public function intro () {
}
}
}
Are you testing in Flash? If you are, is there anything else in your file? Can you try creating a new document and seeing if it will work with that?
If the problem still persists, can you go to the widgetfactory folder again, open up StaticWidget.as, go down to line 32, and tell me if it says: import flash.display.MovieClip;
yeah testing in falsh cs3. i’ve made a blank .fla linked from the document class to a file called intro.as and yes your class file contains that import call at line 32. and yes still getting the 1046
and thanks heaps for your help!!
if i make the import call before your class there is no error eg.
package {
import flash.display.MovieClip;
import widgetfactory.StaticWidget;
public class intro extends StaticWidget {
public function intro () {
}
}
}
Its just flash CS3 not Inheriting the imported classes correctly. Downloaded a Flash CS5 trial and it works fine.
Confusing… Glad to hear you found an answer! Let me know if you have any more issues.