HOME ➔ SUPPORT ➔ Community ➔ General CourseLab issues ... How to handle custom parameters of a flash object?
How to handle custom parameters of a flash object?
  View type:
I made me a flash object which plays a sound in CL, because I didn't find any controls in CL that can do this. It is a swf-file with three buttons: Play, pause and stop. Now I want to import it into a CL-Slide. In the Flash Custom Parameters I want to write Parameter: sound, Value: test.mp3. Then the player should load the soundfile "test.mp3". If the user clicks the swf-play button, the sound should play.
The situation now is, that I have to load the soundfile into my actionscript-code in Flash, publish the swf and import that in CL. But this is not sufficient for me.
Question: How must I handle with Actionscript-Code, that the Flashfile in CL accepts and evaluates the Flash Custom parameters I put in, please?
(I didn't find anything about in in the manual)

First of all, have a look if the mp3 is included in the published course.
Though your flash object (swf) knows about it, CL doesn't by default.

You'll have to add it to f.i. your flash object. In 'Format' choose tab 'Sound', add it and do not start playback automatically.

If the sound is added and it doesn't play, check the (relative) path to the swf.
Thank you, barend. But I can't understand, what that sentence means:
"You'll have to add it to f.i. your flash object."http://www.courselab.com/clpics/sm_5.gif
I chose "Sound" on the format-tab. It doesn't work.
To be sure CL copies the mp3 in the published package, it should know the mp3 exists en belongs to your course.

You can take any object on stage and use the sound tab to attach the mp3 to this object. That should be enough to make CL copy the mp3 into the published package.

Now the next thing is where the mp3 is copied. Chances are the relative path between the swf and the mp3 are after publishing not the same as before.

I think best chances are when making the course, to copy the mp3 to the map /1/images which is the same map as the swf is in. I'm not sure if the relative path will be '.'then or 'images/' I only know loading flv or mp3 use different paths.

Last year I made a small mp3player. Maybe you can see how it is embedded; I don't quite remember how I did it [;)]
It is on

Succes [:)]
Thank you for the zip-file. I'll take a look at it.
I tried "ExternalInterface.AddCallback(...,...)" but I think, my knowledge of javascript is too poor to put the right function into courselab.js.
Actually I wanted to make courses for my students with Courselab. ...a bit frustrated...
Hi Egon,
I did some experiments. Files you add to CL the way described are during publishing copied to the map 'images'.
The mp3player expects the mp3 file in the same map as start.html.
One way to correct is to add the path images/ in your mp3player.

One thing more: preview doesn't work, you'll have to publish (f.i. to cd) to test.

Last year I used Cl for the first time, after quite a lot of course development in Lectora. They are different but after making a start I found CL can cope. The problems you encounter here I also encountered using Flash in lectora.
Thank you for your help barend. To avoid the problems with paths in published CL-courses I tried the following and
I hope this works for my small sound files from now on:
- In Flash I made a new Flash file.
- Added three buttons to the canvas: play_btn, stop_btn and pause_btn.
- Imported a soundfile "arbeit01.mp3" to flash library and set properties in flash: (rightclick on the name of the imported mp3-file in the library, then "properties" or perhaps "attributes", I don't use the English version of Flash) class: a_sound, Export to Actionscript.
- In the properties of the first frame (at the bottom of Flash window) I set "Sound Off".

- Then I put in the following code in(to the first frame):

var sound:a_sound = new a_sound();

var channel:SoundChannel;
var position:int = 0;

play_btn.addEventListener(MouseEvent.CLICK, playA_sound);
stop_btn.addEventListener(MouseEvent.CLICK, stopA_sound);
pause_btn.addEventListener(MouseEvent.CLICK, pauseA_sound);

function playA_sound(evt:MouseEvent) {
if(channel != null) {
position = channel.position;
channel = sound.play(position);

function stopA_sound(evt:MouseEvent) {
if(channel != null) {
channel = null;
position = 0;
function pauseA_sound(evt:MouseEvent) {
if(channel != null) {


I published it and imported the resulting swf-file into CL. It worked like I expected. I could start, stop and pause the sound.

But ---> Another and an easier way: Convert the mp3 into flv. Then you import the flv into CL and you get the nice control from CL.

Perhaps someone could find this useful.
Good job.
The problem you encountered at first has to do with flash loading external assets. You deal with the sandbox (safety settings) and with the relative path html-asset (flv) or swf-asset (mp3, picture).

Adding the mp3 to the library means you don't use external assets any more, which is (in my opinion) the most easy and stable solution.

If you need more mp3's you might consider to put them all in one swf together with the play/pause buttons and use Flashvars to define per use of the swf, which mp3 has to be played.
Message options
No additional options