Adobe Flex came to rescue when we hit the wall with Captivate, need some customizations in the Captivate UI. Had to struggle to find a good documentation on access Captivate Variables and Events in Adobe Flex
Following are the Steps
Step1 : Setup
Download and Copy the classes Actionscript classes to your project..events and helper classes from http://code.google.com/p/widgetfactory/downloads/list
Create package (com.widgetfactory) and copy the events and helpers to your project
Step 2: Access Captivate Variables and Events
Create a Flex Project and add Image comp for Captivate File,Captivate Access Events and variables
1: <s:Application>
2: <fx:Script>
3: <![CDATA[
4: import com.widgetfactory.events.QuestionWidgetEvent;
5: import com.widgetfactory.events.WidgetEvent;
6: import com.widgetfactory.helpers.CaptivateEventsToWidgetEvents;
7:
8: private function loadCaptivateFile( url:String):void {
9: if( !contentLoader.hasEventListener( Event.COMPLETE ) ) {
10: contentLoader.addEventListener( Event.COMPLETE, handleCaptivateLoadComplete );
11: }
12: contentLoader.load( url ); //url points to the swf file
13: }
14:
15: private function handleCaptivateLoadComplete( event:Event = null ):void {
16: var captivateMovie:MovieClip = MovieClip(contentLoader.content);
17: CaptivateEventsToWidgetEvents.registerEventsWithWidgetEvent( this, captivateMovie);
18: //Access captivate events
19: if( !captivateMovie.hasEventListener( WidgetEvent.ENTER_MOVIE ) ) {
20: captivateMovie.addEventListener( WidgetEvent.ENTER_MOVIE, movieStartedEvent, false, 0, true );
21: }
22: }
23:
24: private function movieStartedEvent(event:WidgetEvent):void{
25: var captivateMovie:MovieClip = MovieClip(contentLoader.content);
26: captivateMovie.cpCmndMute = 1 //acccess cpativate variables
27: }
28:
29: <s:Application>
Gotchas
Captivate variables take a little time 10-20ms to take into effect, so if you set it and right away try to access it, you will still see the old value.
Ideally, I feel, if the project is getting too complex, it better to your Flex directly and create a database centric application instead of Using Captivate and doing workarounds. But again this is case by case.
Happy Flexing!!