I just saw that Michael at www.cpguru.com has just released a post on the new widgets and the widget API. He did a nice presentation highlighting some of the new stock widgets that Cp5 will be offering. I will try to complement his post with some information I learned from my short exposure with the Widgets.
Development Language – AS3
As Michael pointed out, Widgets in Cp5 must be written in AS3. This might be a relief for some developers (including me
) since they will not be asking themselves in which language they should develop their widgets. The downside is that by offering only AS3, some customers might be left alone with their legacy AS2 widgets and don’t have the means to convert all their old AS2 widgets to AS3. However, AS3 has been around for about 4 years now and Adobe had to make a move away from AS2 at some point. Lets just hope that this will not prevent people from moving to Cp5.
Backward Compatibility – Some Issues
Cp5 has been careful in trying to offer backward compatibility for Cp4 widgets. All the functions that were available in Cp4 are there in Cp5. However, there is one major difference that may cause your widgets to not function properly in Cp5. The Captivate team offered the same functions but their return value differs. For example, if you were calling the slideHandle property in Cp4 you would get direct access to the slide which is a MovieClip. In Cp5, calling the same property will return you a CPSlideHandle instance. This Class is basically a proxy to the slide and only contains the properties and methods enumerated in the help files. Therefore, if your widget only accessed what was stated in the documentation, then your widgets should run perfectly fine in Cp5. If, like me, you were taking advantage of the fact that the slide was a movieclip and accessed some movieclip methods/properties or if you were accessing the slide’s children, then your widget will not work in Cp5 without some adjustments. Bottom line, in Cp5 we lost the advantage of gaining direct access to movieclips. But don’t despair as most developers would know how to gain access to the slide movieclip. After all, the display tree is public and our widget is on it. So moving back into the parent’s hierarchy should provide you access to the slide’s clip.
Wiget Properties UI
If you are a widget developer, you know about the pain of having limited real estate to expose your widget’s configurable parameters. Now, the Widget Parameters tab has been extracted from the Widget Properties dialog and moved to its own window. Even better, the widget developer can now specify the real estate that he requires. Two new functions were added to the widget API: getEditModeWidth and getEditModeHeight. What I really like about this new addition is that you get direct access to the new Widget Properties dialog by double clicking on the widget itself; very handy!
New API Methods
I have yet to explore the Question Widgets to see if they added new API methods/properties but for sure they have added a IsReadyForSnapShot method. After you have edited the widget properties and closed the Widget Properties dialog, Captivate will call this function to see if the widget is ready to be rendered on the stage. If this function returns true, Captivate will proceed in taking a snapshot of the widget and render it on the stage, if the function returns false, Captivate will wait for a few iterations and then call the function again. This will go on until the function returns true but there is a fail safe mechanism in case the function never returns true. The fail safe kicks in after a few seconds.
Widget Updates – The holy Grail
If you have been following my blog, you have for sure seen my grant about the lack of update mechanism in Cp4. I was so relieved to see that Cp5 now offers the capability to update widgets. You right-click on the widget and select the “update…” feature. The widget will then be updated and all instances of the widget will upgrade to the new version. One of the thing I also noticed with widgets in Cp4 is that the presentation file size seemed to grow linearly with every widget you would add on the stage. I would have expected this from inserting different widgets but it was also occurring when you would insert the same widget many times over. My preliminary tests indicate that inserting the same widget over and over again does not have a major impact on the presentation file size.
EventDispatcher – Better Communication
Something that was severely lacking in Cp4 was an eventing mechanism. The widget developer would have to listen to the Enter Frame event and monitor when some Captivate variables would change values. This was horrible and would shame any good programmer; why on earth Captivate was not firing events! This has been corrected in Cp5. The AS3 code base now includes an EventDispatcher that is available after calling the getMovieProps() method. This EventDispatcher has two roles. The first one is to notify you of what’s going on with the presentation: when the slide is entered/exited or when the movie is started/paused/resumed/stopped. A few more events relate to the Interactive and Question widgets.
The second role is to offer you a communication channel between the widgets on the stage. One widget can dispatch an event and the other widgets can monitor the event and perform operations to change their appearance when they receive the event. A welcome addition!
These events will also ease the life of Flex and Flash developers who integrate Captivate content into their tools.
Widget Templates – A Timeline Affair
You can still create Widget templates directly from Captivate. It will ask you which type of widget you want to create and then create the file in Flash. The newly created widget still has its code on the timeline. The code is cleaner and better commented but it remains on the timeline. Experienced widget developers don’t code on the timeline so they will have to wait for Tristan to update its very good Widget Factory API.
Stock Widgets – More choices
Cp5 will come with a lot more stock widgets than its Cp4 counterpart. I have counted 35 widgets but some of them are variations of the same widget e.g. playbar widgets. The new stock widgets should be more useful and offer more configurable parameters. They also definitely show more craftsmanship; their Table widget has probably required a lot of work. Talking about the table widget, it offers the means to upload a file directly from your disc. So, this is a very exciting news for developers. Unfortunately, Adobe has not released any information on this mechanism for the moment. For more info and example, I strongly recommend you to check out Michael’s presentation on Cp5 Stock Widgets.
So, that’s it for the moment. I will continue to explore the Cp5 Widgets world and will keep you posted on my discoveries!
Subscribe to the feed
May 19th, 2010 at 07:49
Whyves,
Awesome post! The biggest gain I can see here is the communication between widgets. The ramifications are huge. Creating games is one thing, but creating something very useful to the eLearning community is another. I’d like to see some great integration with web services and inter widget comm. Once the Cp team releases the Twitter widget, we should get a good example of this.
Thanks for the heads up on the slide handle proxy. I’ll have to refactor some code
Jim Leichliter
May 19th, 2010 at 08:55
Great post Yves! You rock!
May 19th, 2010 at 20:54
Thanks Guys,
Actually, the true power of the EventDispatcher will appear when two widgets from 2 different vendors can interact together. And you are right, I foresee the Captivate platform having a very big potential. I wish Adobe would open it up just a little bit more.
Whyves
May 25th, 2010 at 10:17
Thanks for this features rundown, Whyves. I’m excited about the potential of communication between widgets. It would free up developers to create libraries of small widgets that do one thing well and combine them in various ways to solve problems. Opens up a world of possibilities.