The EnterPage 9-02
The Source for ToolBook, VBTrain.Net, and FlashTrain news
from Platte Canyon Multimedia Software Corporation
August 4, 2006
ToolBook User’s Conference / e-Learning Authoring Conference Report
TBCON/eLearnCon Archives, Shirts, and Bags Available
Interest in TBCON/eLearnCon in UK?
Plug-In Pro Tool Spotlight: Property Editor
Control Spotlight – Training Text
Come See Us: The Platte Canyon World Tour
Platte Canyon Products in the Pipeline
Coming in the Next Issue of The EnterPage
Welcome to The EnterPage newsletter. We hope you will find useful information on ToolBook, Flash, and .NET as well as the comings and goings of your friends at Platte Canyon Multimedia Software Corporation. Until next time, enjoy!
TBCON is always a highlight of our year, but this year was
extra special. The expansion into tracks on Flash, Management, and Web
Technologies was quite popular. Flash developers and ToolBook developers rubbed
elbows in sessions and shared tricks of the trade. The faculty did an
outstanding job and we would like to particularly thank first-time presenters Adam
Brown,
Links
2006 Resources: http://www.tbcon.com/resources_2006.aspx
2006 Photos: http://www.tbcon.com/2006/photos2006
2006 Attendee Slide Show: http://www.tbcon.com/virtualvisit/tbcon_slideshow.swf
2006 Group Photo: http://www.tbcon.com/virtualvisit/group_photo.htm
2006 Archive and Faculty Information: http://www.tbcon.com/archives_2006.aspx
Mark Your Calendars for Next Year
July 30 - August 1, 2007
Preconference training July 28 and 29, 2007
By Jeff Rhodes
I first met Chris Bell in kindergarten at
By Jeff Rhodes
It is funny how things work out. A month or so after Chris
moved to his new job, I got an email from the person who taught me computer
programming – initially in Comp Sci 101 at the Air Force Academy and later as
my boss at Titan Corporation. Since we worked together, Dr. Scott Teel held
numerous positions, including Chief Technical Officer, at the Sun Education
division of Sun Microsystems as well as with a startup. I managed to convince
him to join the
After demonstrating Flash, ToolBook, and .NET prototypes at TBCON/eLearnCon, we are now hard at work on the initial Training Studio version that will allow interactive, database-driven training with output to either ToolBook or Flash. We anticipate release around the end of the year. You can go to http://www.trainingstudio.net to learn more about the concept and for progress updates.
We set an all-time record this year by having the “Archives for Attendees” available only one week after the end of the conference. Thanks go largely to the faculty for getting their files in promptly. Those of you who couldn’t make the conference this year can download the presentations and sample files for only $50. You can see the list of what is available at http://www.tbcon.com/archives_2006.aspx.
Also, we have made our entire inventory of conference shirts, Platte Canyon shirts, vests, flash drives, bags and more available via our online store. There are even a few Staff and Help Desk Staff shirts from previous years. Prices range from $5 to $15. We'll bundle shirts together for cheaper shipping than what will be shown on your shopping cart. We'll email you with exact shipping if you buy multiple shirts. Here is the link to check out the inventory (as well as to purchase the Archives):
The 2006 edition of The ToolBook User’s Conference /
e-Learning Authoring Conference was such a success that we’re considering
launching a European version. The principal site that we are looking at is the
Links
Those of you who use ToolBook Instructor are likely familiar with user properties. This is how hyperlinks, actions, question configurations, and much more are stored inside ToolBook. More advanced developers create user properties for their own purposes. They can be used at authoring time for either native or web deployment or at runtime for native deployment. The Property Browser available from the View menu shows a list of user properties, but you have to select the right level (object, page, book, etc.) and then go to the User tab. And then you need to double-click the value to see more than a few words of the value. We created the Plug-In Pro Property Editor to make it quick and easy to get to Page, Background, or Book user properties. And each one shows its value in a large editable field. You can make multiple edits if desired and then just save.
Here is a link to the help topic for this tool: http://www.plattecanyon.com/help/pluginpro/Editing_Properties.htm
More information on Plug-In Pro and a free trial version are available at:
http://www.plattecanyon.com/pluginpro.aspx
By Jeff Rhodes
Handler Browser and
DLL’s
One very useful feature of the Handler Browser is to see which functions are contained in some of the undocumented DLL's contained in the ToolBook runtime. In particular, the tbcbt.dll file has such functions as ASYM_ItemContains() and pathOfFile(). When Instructor 6.0 was first released, I created a custom installation and omitted tbcbt.dll from the list of runtime files (it is listed as an "optional runtime file" but further down as one needed for extended objects). Failing to have this dll caused ASYM_PathOfFile() not to work because that function uses the pathOfFile() function inside of tbcbt.dll. If I had been skilled in what was then the brand-new Handler Browser, I could have just selected tbcbt.dll in the list and then seen the list of its functions that have been linked. You can do the same for standard Windows DLL's like kernal32.
Here's the complete list of tbcbt.dll functions linked in a typical book:
ASYM_CreateEncryptedFile
ASYM_CreateEncryptedFileEX
ASYM_Decode
ASYM_DecodeEX
ASYM_Encode
ASYM_EncodeEX
ASYM_FreeMemBlock
ASYM_GetMemBlock
ASYM_getUserName
ASYM_ItemContains
ASYM_ModalPopText
ASYM_WriteEncryptedFile
EllipsizeFileName
FileToPrinter
itemContains
KeyedPasswordEncrypt
KeyedPasswordEncryptEX
MakeKeyedPassword
MakeKeyedPasswordEX
PathOfFile
ShortFileName
TextlineContains
By Jeff Rhodes
Drawing Objects
When you use OpenScript to create objects, then the object you just created is the "selection." The script below implements a tool that we created for developing the Learning & Mastering ToolBook CBT and later added to the Plug-In Pro. It draws a button and then sets its properties to properly display a graphic resource. Finally, it prompts you to choose a bitmap resource.
draw
button from 300,300 to 6000,6000
borderStyle
of selection = "none"
fillColor
of selection = white
excludeFromTabOrder
of selection = true
enabled
of selection = false
highlight
of selection = false
transparent
of selection = true
drawDirect
of selection = false
caption
of selection = null
name
of selection = null
resourceID
= chooseResourceEx( "bitmap", this book, bitmap, "",
"Choose Graphic for
button")
if
resourceID <> null
normalGraphic of selection = resourceID
end if
By Tim Barham
Comboboxes and the Actions
Editor
The main problem with the selectedItemText property in earlier versions of ToolBook was that it didn't really support multi-select fields, which is why we added the two newer properties.
These are two user properties you can query about list boxes:
To explain these, assume I have a multi-select list box field with the following text:
apple <I have selected this one>
banana
carrot < I have selected this one too>
dairy
The itemSelected property would return:
,0 true,1 false,2 true,3 false
Ignoring the first item in this returned list (the ) the next series of items tell you which lines were selected:
0 true (textline 1)
1 false (textline 2)
2 true (textline 3)
3 false (textline 4)
Don't rely on the value you see here. This property is actually an array, and its raw value will be different in ToolBook and DHTML, but if you use it as an array it will work the same in both.
So let's say you have the action:
Set a to itemSelected of field "foo"
Never use "a" directly - always use it as an array. So to determine if the first textline is selected, check the value of a[0] (note that the array is ZERO based, unlike the OpenScript selectedTextLines property which is ONE based. This is for compatibility with JavaScript).
So, in the above example, a[0] and a[2] will be true, a[1] and a[3] will be false. You can also change the selected text lines by constructing an array and setting this property. For example, to select text line 2 in addition to any already selected textlines, you could use this code:
Set a to itemSelected of field "foo"
Set a[1] to true
Set itemSelected of field "foo" to a
Or to only select text line 3, regardless of what other text lines are selected, you could use this code (assuming "a" is initially an empty array):
Set a[2] to true
Set itemSelected of field "foo" to a
Note that when setting the itemSelected property, you only need to set the array elements for those text lines you want selected. If an array element that corresponds to a text line is NOT set to ANYTHING, then that text line will not be selected.
The itemText property would return:
,0 apple,1 banana,2 carrot,3 dairy
Ignoring the first item in this returned list (the ) the next series of items tell you what text is on each line.
0 apple
1 banana
2 carrot
3 dairy
Similarly, this is also an array and should be accessed as an array as
described above. So, in this example, you could use the code:
Set a to itemText of field "foo"
And a[0] would now be "apple", a[1] would be "banana", a[2] would be "carrot" and a[3] would be "dairy".
And, of course, you can CHANGE the text of a list box (or combobox, or radio button group, BTW) using this property. Here's some example code:
Set a to itemText of field "foo"
Set a[2] to "chocolate"
Set itemText of field "foo" to a
Our VBTrain Training Text control is an extension of our Graphical Text control. Training Text provides the ability to easily create rollover and click interactions. The Graphical Text part takes care of drawing the text in a correct font, color, gradient, or even cutting it out of a graphic. Training Text allows a different look when the text is reset, selected (e.g., on rollover), and completed. For example, we often rotate the selected text. A development license is $245 and includes the Windows Forms version of Training Text and both the ASP.NET and Windows Forms version of Graphical Text. Here is some Visual Basic.NET code that shows how to tell the control what handlers to call when all the hotspots have been completed, when a hotspot is selected, and when a hotspot is deselected:
TrainingText.AssignAllCompleteEvent(AddressOf AllHotspotsSeen)
TrainingText.AssignTrainingTextSelectedEvent(AddressOf HotspotSelected)
TrainingText.AssignTrainingTextDeselectedEvent(AddressOf HotspotDeselected)
Here is the code for HotspotSelected. Note how the TrainingText control has its own arguments that tell you which control is selected and so forth. This is similar to reading properties of Target from ToolBook OpenScript.
Private Sub HotspotSelected(ByVal sender As System.Object, ByVal e As _
TrainingTextEventArgs)
Dim hotspotNum As Integer = CInt(e.TrainingTextName.Substring_
(e.TrainingTextName.Length - 1))
Dim hotspotId As TrainingText = CType(sender, TrainingText)
Dim controlId As Control = CType(sender, TrainingText)
Dim imageId As PictureBox = FindImage(hotspotNum)
ImplementHotspot(hotspotNum, hotspotId)
If IsNothing(imageId.Image) = False Then
With Graphic_0
.Image = imageId.Image
.Visible = True
End With
With MediaPlayer
.Visible = False
.Ctlcontrols.stop()
End With
With FlashPlayer
.Visible = False
.Stop()
End With
End If
hotspotId.RotationAngle = -8
If (e.NumberOfTrainingTexts - e.NumberOfTrainingTextsCompleted) <= numHotspotsHidden Then
AllHotspotsSeen()
' Need this because Training Text does not account for hidden objects
End If
End Sub
Like all VBTrain.Net controls, Training Text has a free evaluation version complete with sample projects. You can learn more at http://www.vbtrain.net/productdisplay.aspx?id=5.
by Jeff Rhodes
One of the many nice features in .NET 2.0 is Generics. While it sounds like something for senior citizens, it is actually a great way to efficiently keep lists of objects in variables. It’s similar to an ArrayList except that with Generics you specify the object type of its contents. Let’s look at an example. I’ve been working on the front-end editor for the database-driven content for our Training Studio product. As part of one of its screens, I wanted to validate all the TextBox controls that hold media or graphic references to be sure that there is no directory information and that there is an extension (.gif, .wmv, etc.). On the way into the form, we loop through the controls to set up databinding and validation. At the same time, we want to build the list of all the controls that need validation. In older versions of .NET, we would likely have used an ArrayList object for this. But since an ArrayList only takes an object reference, we’d get no help from the compiler in ensuring we only put the right type of objects in there. There would also have been a performance hit as we went from object to control and back. Generics solve that problem. We start with a variable declaration:
Dim valList As New Generic.List(Of Control)
The Of Control bit is where we specify that this List object can only hold Controls (as opposed to Integers, Strings, etc.). We then loop through the controls and add items to the list:
If (columnName.IndexOf("media") > -1 OrElse (columnName.ToLower.IndexOf("graphic") > -1 AndAlso columnName.IndexOf("instructions") = -1)) Then
AddHandler controlId.Validating, AddressOf MediaImage_Validating
valList.Add(controlId)
End If
If the column name in the database has the word “media” or “graphic” in it (but is not “graphicInstructions”), then we assign the handler to be called in response to the Validating event. We then add the control to the valList variable. Next, we store the list in a property:
Me.ValidationList = valList
Finally, we use this property when the user clicks the OK button. The code below calls the GetError method of the ErrorProvider control. We need to pass in the object reference, which is what we get out of the ValidationList property.
With ErrorProvider1
For Each controlId In Me.ValidationList
controlErrorString = .GetError(controlId)
If controlErrorString <> "" Then
If errorString = "" Then
errorString = controlErrorString
Else
errorString = String.Format("{0} {1}", _
errorString, controlErrorString)
End If
End If
Next
End With
If there are any validation errors, we prompt the user to fix them before continuing.
Generics are a pretty advanced topic, but hopefully this example shows that they are not as hard as they sound.
By Jeff Rhodes
One of my favorite sessions from this year’s e-Learning Authoring Conference was Object-Oriented Programming with .NET and Flash. For the Flash part of this session, I started with a Shape class as shown below.
class Shape {
function Shape(x:Number, y:Number) {
// constructor
xPos = x;
yPos = y;
}
// private variables
private var xPos:Number;
private var yPos:Number;
// public methods
public function drawShape(movieId:MovieClip):Void {
}
public function getArea():Number {
// must be overridden but needs return value
return 1;
}
// public Properties
public function get xLocation():Number {
return xPos;
}
public function set xLocation(locationId:Number) {
xPos = locationId;
}
public function get yLocation():Number {
return yPos;
}
public function set yLocation(locationId:Number) {
yPos = locationId;
}
}
The idea is that the Shape class has a constructor (the function named Shape) that must have the coordinates passed in as parameters. The class has two methods, drawShape and getArea. Note that these methods are not implemented here. If we were in Visual Basic .NET, we would have called these methods MustInherit. Flash doesn’t have that, be we just put a basic function in there and put a different implementation in the child class. Finally, there are two properties: xLocation and yLocation. Note how we can implement these with get and set functions. The fact that xPos and yPos can be made private to the class is called encapsulation.
We can now inherit from this class to make a Circle and a Rectangle. Here is the code for the Rectangle.
class Rectangle extends Shape {
function Rectangle(x:Number, y:Number) {
// constructor
super(x, y);
}
// private variables
// public methods
public function drawShape(movieId:MovieClip):Void {
var rectangle_mc:MovieClip = movieId.createEmptyMovieClip("rectangle_mc", 10);
rectangle_mc._x = super.xLocation;
rectangle_mc._y = super.yLocation;
with (rectangle_mc) {
lineStyle(4, 0x000000, 100);
beginFill(0xFF0000, 100);
moveTo(0, 0);
lineTo(50, 0);
lineTo(50, 100);
lineTo(0, 100);
lineTo(0, 0);
endFill();
}
}
public function getArea():Number {
// Area of rectangle = length * width
var length:Number = 100;
var width:Number = 50;
var returnNum:Number = length * width;
return returnNum;
}
}
Note the use of the extends keyword for inheritance. We override the Shape’s implementation of drawShape and getArea and use rectangle-specific versions. The ability of Flash to figure out whether to use the version from the derived class (Rectangle) or the base class (Shape) is called polymorphism.
We won’t show the entire Circle class since its drawShape code is pretty long, but here is its getArea method.
public function getArea():Number {
// Area of circle = pi*radius squared
var radius:Number = 50;
var returnNum:Number = (Math.PI * (radius * radius));
return returnNum;
}
Here are all of our currently-planned events for the rest of 2006. If you happen to be at any of these, please stop by our booth and say Hi.
e-Learning DevCon (
Jeff Rhodes will be giving sessions on Estimating Development and Pricing Products, Communicating with .NET Web Services from Flash, and Introduction to Tracker.Net and Training Studio. We will be demonstrating products and answering questions in the expo.
Training Solutions (
Booth: 712
http://www.trainingsolutionsconference.com
We’ve got many oars in the water with updates to Content Connection, Learning & Mastering ToolBook, and Plug-In Pro along with development of the new Training Studio product. Look for more information on these in the next issue.
· Another Plug-In Pro Tool Spotlight
· More Expert Information, OpenScript Tips, and Web Hints from the "Learning & Mastering ToolBook" series
· Another VBTrain Control Spotlight
· Another VBTrain.Net Nugget
· Another ActionScript Tip
· More
The EnterPage is distributed up to four times per year, with occasional special issues. Individuals who have expressed interest in Platte Canyon Multimedia Software Corporation or its products receive The EnterPage. Suggestions for articles or proposals for article submissions are welcome. Send information to ep@plattecanyon.com. Back issues of the EnterPage are available at:
http://www.plattecanyon.com/enterpage.aspx
To subscribe or unsubscribe, please send email to ep@plattecanyon.com. Please include your name and company with new subscriptions.
All content Copyright Platte Canyon Multimedia Software Corporation, 2006.