..:: Blog ::..

 ToolBook Blog Minimize

Dec 5

Written by: Tomas Lund
Wednesday, December 05, 2007 12:29 PM

Problem
Ever had to embed a file in ToolBook which was dependant on other files?  
Frustrated when trying to get it to work when the ToolBook content is exported to HTML?
 
Common examples are
  • When a Flash file reference another Flash file or a Flash Video file
  • Embedding Captivate content in ToolBook (essentially the same as above)
  •  Embedding a HTML file which itself has links to other files (.js, graphics etc)
 
Before we go to the solution let’s look at an example to understand why this happens – as this will help us understand how to fix the problem.
 
An example:
A flash file (a.swf) has some media controls which controls the playback of two external FLV - flash video files (b.flv and c.flv).
To embed those files into ToolBook one would link to a.swf in a media player
When you test this in Author It’ll work just fine.

When you publish to web, ToolBook will copy any media file directly used by a ToolBook object into the Media directory of the ToolBook Web export directory

In the above example Toolbook cannot “see inside” a.swf to learn that b.flv and c.flv should be copied to the media directory, hence when you test the HTML the a.swf will look for b.flv and c.flv but will not be able to find them as they are not copied by ToolBook.

 
An obvious solution to this problem is to manually copy b.flv and c.flv to the Media directory, however there is a problem with that:

As this is a manual process which needs to be repeated every time the ToolBook file is published to web - there is always the risk of forgetting.

In addition even though the file is now be present in the media directory there is a risk it still doesn’t work when launched through an LMS.  

The reason for this is that the files b.flv and c.flv are not referenced in the IMSmanifest.xml file generated by ToolBook.
Again off course one can manually add the references in the manifest file - but one might forget or make mistakes.
 
So here the trick
 
Create a button on page in your ToolBook file (page 1 springs to mind as easy to find – but any page will do)
Now create an on Click action that looks like this.
 
On Click
Display Document b.flv
Display Document c.flv
 
Doing so will not only copy the files to the media directory but will also add them to the imsmanifest.xml.
 
Now hide the button (set the visible property to false) to ensure that the code we just created is never executed. We just want the lines of code to ensure that ToolBook has a link to the file so it can copy it during the export.
 
IMPORTANT: In the Publish HTML Settings make sure the option “Rename media files to guarantee uniqueness” is unchecked – otherwise ToolBook will rename the files and a.swf will not be able to find them.
 
I hope you have enjoyed this article, comments and suggests are welcome.
 

Tags:

11 comments so far...

Re: Adding files to HTML media directory

Awesome! Thank you!!!!!

By Renee on   Friday, December 21, 2007 10:42 PM

Re: Adding files to HTML media directory

Great, Great!

Coiuld not get the information anywhere

By wambete william on   Wednesday, June 25, 2008 6:31 AM

Re: Adding files to HTML media directory

Great, thank you

By robert kruckel on   Friday, July 25, 2008 6:24 PM

Re: Adding files to the HTML media directory

Tom, I was recently experimenting with a flash video file to which I added a skin. I created the swf in Flash Pro CS3 and it exported a separate swf file for the skin. It took me a while to realize why I wasn't seeing the controls. (I'm using Toolbook 9.5.) I had to add the skin swf file manually -- but not to the media directory. Instead, I had to copy the skin swf directly to the IE5, NS7 and safari directories. (This is in addition to copying my .flv file to the media directory.) I like your approach and was wondering if you had a similar suggestion to deal with the skin swf. I've not worked much with flash. I was trying this with the flash popup player and the reason I did the skin was to have a quick and dirty way to control the video. Thanks, Marty

By Marty Weller on   Tuesday, October 07, 2008 10:14 PM

Re: Adding files to the HTML media directory

Hi Marty

Sounds like something a lot people might want to do. Unfortunately I dont know of a "clean" way of moving media files into the directories you mention. I am sure you can be done by use of hacking about with the export routine somehow - but we are not really shopping for bad hacks are we?:-). My suggestion would be to try and see if you can control where the Flash movie is expecting the skin to be and see if you can change that location to point the same place as the swf and the flv file. That should by far be the easiest and most non-intrusive solution. Let me know if you succeed.
Cheers
Tomas

By TomasLund on   Tuesday, October 07, 2008 10:45 PM

Re: Adding files to the HTML media directory

Hi Tom,

Your solution worked great and I am currently using ToolBook 9.5...thanks! I was wondering if you might know a solution to external .swf's from within flash e.g:

stop();
loadMovie("ani01.swf",mc01);

I tried this in reader mode which works along with your method and it still seems that within ToolBook once one swf is played any code within that file is not recognized. Is there a way to communicate actionscript from within flash to TB or vice versa?
Thanks in advance,
Neil

By Neil on   Wednesday, January 07, 2009 6:43 AM

Re: Adding files to the HTML media directory

I am not completely sure I understand your question. Is your problem that you are seeing different behaviour between reader and when its exported to HTML?? If thats the case keep you could try an manually move the files to the media directory. Keep in mind that this approach does not support subfolders which will have to be moved manually.
That said yes there is a way to communicate via actionscript from Flash to ToolBook, however that is a fairly large topic, maybe I'll get time to do a separate blog post on this. In the mean time here are some pointers: The best advice i can gime on that is to NOT use ToolBooks flash player or the UMP as a lot of the programmatic features are not available in those players. Rather you should use the raw shockwaveflash (activeX) object. Then you can use Externalinterface or FSCommand from Flash to communicate to ToolBook. Communicating from ToolBook to Flash can be done using the methods exposed by the ActiveX object such as SetVariable
Hope this helps
Cheers
Tomas

By TomasLund on   Wednesday, January 07, 2009 12:23 PM

Re: Adding files to the HTML media directory

Thanks Tom, sorry for the misunderstanding in my previous question. What I am trying to do is call external .swf's from within flash into toolbook. I placed this code on the last frame of my main.swf:

stop();
loadMovie("ani01.swf",mc01);

I deleted the ToolBook flash player but I was not sure how to use the raw shockwaveflash object. Is this located in the catalog? Are there any links that you can provide demos on?Hope you can post some more tips on this subject as I am looking for a way to communicate several external swfs.

thanks again,
Neil

By Neil on   Wednesday, January 07, 2009 6:33 PM

Re: Adding files to the HTML media directory

My pleasure.
To me it does not sound like you even need the communication from ToolBook to Flash?
If you have a flashplayer (or activeX) which has its source set to a swf file that file will play in ToolBook. Now if that swf file dynamically loads other swfs, those files will be displayed 'automatically' in ToolBook *IF* the original swfs can find the other swf files.

So first of all: does your flash file work when played outside of ToolBook? if Yes then your culprit is likely to be the paths (assuming you are running IN HTML??)

As far as links goes, strangely enough I cant think of any openly available articles on this but as this is a frequent topic on Tbcon - you could investigate buying access to the archieves, or try asking the ToolBook listserv - which is free:-)
I am currently busy with some articles on other topics than flash and some new tools that will be for sale from this site - that is besides "normal" work for clients. So I am not likely to write any blog posts on Flash and ToolBook integration soon.





By TomasLund on   Wednesday, January 07, 2009 10:04 PM

Re: Adding files to the HTML media directory

This was a very simple to follow tutorial that could make wonders!

I would also like to ask how to score Captivate simulations in Toolbook? You have mentioned that an externalInterface call from Flash could do it, but I am no expert in Toolbook's scripting (but I do know Actionscript 2.0). Any help would be great!

By Jessie on   Friday, July 17, 2009 4:50 PM

Re: Adding files to the HTML media directory

Thanks JessieMy guess is that it is quite complicated to do what you are asking, but here is how I would go about it. Open/Export the Captivate file with Flash, figure out how the sim scoring works (probably AS3 code), then setup an externalInterface (or FScommand) call to communicate the score to ToolBook. On the ToolBook side you'd need to Use the Actions Editor to catch whatever the captivate is sending. Then if you want the score to be included in what ToolBook reports to the LMS then you'd need to either hack ToolBooks SCORM data or to add a dummy ToolBook question and answer that programmatically based on what you get from Flash...Hope this makes some senseTomas

By TomasLund on   Tuesday, July 21, 2009 12:27 PM

Your name:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment    Cancel  

  
 Search Minimize


  
 Quick links Minimize


  
 Blog List Minimize


 Print   


Copyright 2007 by ToolBookConsulting.com   Terms Of Use  Privacy Statement