ActionScript Reqd to trigger Lectora Even
March 11, 2009 12:00 AM
Well depending on what you need. You can trigger any action in Lectora with the ExternalInterface command in Flash.Here is a quick example that when an animation plays in Flash, and finishes, it will tell Lectora to go to the next page.stop();import flash.external.*//Animation is the name of the movieclip in flashanimation.onEnterFrame = function(){ if (this._currentframe == this._totalframes){ ExternalInterface.call("trivNextPage()"); }}[/CODE]The key is knowing what javascript commands to call within Flash, and what the names of the objects will be.Another example, lets say that you have a button in flash that when you click on it, you want an image in lectora to show up.First thing you need to do is turn on HTML names in the Lectora preferences. Check the box "Show HTML-publish..."Now look at the image. It should have an HTML name like image42765.Now that you know the HTML name you can manipulate that image in flash.Hide the image: ExternalInterface.call("image42765.actionHide()");Show the image:ExternalInterface.call("image42765.actionShow()");You can even modify variables. Lets say you have a variable in Lectora called "soundcomplete".Set the variable to 'complete';ExternalInterface.call("Varsoundcomplete.set('complete')")There are many other examples, but this should get you started.Edit: Clean up formatting due to Google ChromeEdited By: Xithis on 2009-3-11 9:43:18[CODE]stop();import flash.external.*//Animation is the name of the movieclip in flashanimation.onEnterFrame = function(){ if (this._currentframe == this._totalframes){ ExternalInterface.call("trivNextPage()"); }}[/CODE]The key is knowing what javascript commands to call within Flash, and what the names of the objects will be.Another example, lets say that you have a button in flash that when you click on it, you want an image in lectora to show up.First thing you need to do is turn on HTML names in the Lectora preferences. Check the box "Show HTML-publish..."Now look at the image. It should have an HTML name like image42765.Now that you know the HTML name you can manipulate that image in flash.Hide the image: ExternalInterface.call("image42765.actionHide()");Show the image:ExternalInterface.call("image42765.actionShow()");You can even modify variables. Lets say you have a variable in Lectora called "soundcomplete".Set the variable to 'complete';ExternalInterface.call("Varsoundcomplete.set('complete')")There are many other examples, but this should get you started.Edit: Clean up formatting due to Google ChromeEdited By: Xithis on 2009-3-11 9:43:18
Discussions have been disabled for this post