Solved

fscommand

Posted on 2004-08-23
14
867 Views
Last Modified: 2008-03-17
I am using fscommand in the actionscript to send info to a LMS.

For example, commands like:

fscommand ("LMSSetValue","cmi.core.lesson_status,completed");
fscommand ("LMSSetValue","cmi.core.lesson_status,passed");
fscommand ("LMSSetValue","cmi.core.lesson_status,failed");

I am trying to send a grade to the LMS using cmi.core.score.raw.

fscommand ("LMSSetValue","cmi.core.score.raw,integervaluehere");

Integervaluehere is the score.  This does not generate an error, but also does not change the score on the LMS.  Does the fscommand look correct?  Do I need another step to set initialize integervaluehere (which should already have a value)?  Could someone give an example?  The program works fine, except for this one problem.

This is for Flash MX version 5.

Thanks in advance,

Mark
0
Comment
Question by:flashinglemur
  • 7
  • 4
  • 3
14 Comments
 
LVL 10

Accepted Solution

by:
muso120999 earned 500 total points
ID: 11874390
I guess there should be default values set, but setting the score requires a scale (ie. min to max) so it might be worth trying:
fscommand ("LMSSetValue","cmi.core.score.min,0");
fscommand ("LMSSetValue","cmi.core.score.max,100");
fscommand ("LMSSetValue","cmi.core.score.raw,integervaluehere");

Also make a call to LMSCommit, to make sure that the data is purged occasionally.

And be aware that there can be a slight delay between sending the data to the LMS, and it actually receiving it.
0
 
LVL 1

Author Comment

by:flashinglemur
ID: 11874629
Muso,

I thought that was going to be it.  I set the min and max value, but the score is still 0% (which I think is the LMS default).  The course is marked as completed (if it's a passing grade), but 0% is the grade.

Do I need to say int(integervaluehere");

I'm already doing calculations with integervaluehere (to determine is the score is passing or not), so it's a number and not alpha.

Mark

0
 
LVL 10

Expert Comment

by:muso120999
ID: 11874836
>> Do I need to say int(integervaluehere");

No, because that parameter is being sent as part of a string.  Have you tried using a string constant, like:
fscommand ("LMSSetValue","cmi.core.score.raw,12");

just to rule out the current value (or type) of your variable?
0
 
LVL 10

Expert Comment

by:muso120999
ID: 11875155
I had assumed this, but you are literally using something like this:
score=12;
fscommand ("LMSSetValue","cmi.core.score.raw,"+score);

rather than:
fscommand ("LMSSetValue","cmi.core.score.raw,integervaluehere");

as without concatenating the value it isn't going to evaluate until it reaches the LMS, and that then will interpret it probably as a zero.
0
 
LVL 1

Author Comment

by:flashinglemur
ID: 11876785
No, I was literally using:

fscommand("LMSSetValue","cmi.core.score.raw,total");

if I tried:

fscommand ("LMSSetValue","cmi.core.score.raw,"+score);

I think it would balk b/c you can only have one or two parameters for fscommand.

Is this not correct?
0
 
LVL 1

Author Comment

by:flashinglemur
ID: 11876856
Muso,

Just in case I tested it as:

fscommand ("LMSSetValue","cmi.core.score.raw,"+score);

and upon publishing received the following error message...

"wrong number of parameters.  fscommand requires between 1 and 2."

Mark
0
 
LVL 10

Expert Comment

by:muso120999
ID: 11878820
I'm afraid I don't understand why you get that last error message - I've tried it myself with no error (only two parameters are actually being used)

Anyway, did you know there is also this method of setting the score:
fscommand ("CMISetScore",integervaluehere);



When I am testing these things I sometimes also add a trace, like an alert pop-up into the HTML page that is published, like:

function flashName_DoFSCommand(command, args){
    Alert("Cmd: \r" + command +"\r\rParams: \r" + args);

... insert the Alert line, after the DoFSCommand function.  This allows you to tell exactly what is being sent to the LMS, and whether it is what you expect it to be at this stage.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 39

Expert Comment

by:blue-genie
ID: 11879916
just out of curiousity - why are you using FScommand rather than javascript?
0
 
LVL 10

Expert Comment

by:muso120999
ID: 11880075
FSCommand in this case is making calls to JavaScript routines, that are developed by Macromedia as part of the AICC/SCORM wrapper.  My last example included some JavaScript to test the output
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 11882333
we simply use a getURL to call the scorm api commands, bypassing Macromedia's idea of it.

0
 
LVL 10

Expert Comment

by:muso120999
ID: 11882611
I agree that Macromedia's FSCommand is a clumsy implementation when compared to direct getURL... do you have a suggestion then?
0
 
LVL 1

Author Comment

by:flashinglemur
ID: 11895759
OK, this is a strange situation.  Using debugging, they've determined that the LMS initializes and finishes as soon as the page loads.  Therefore I was hosed from the beginning (read that: out of my control).  I have to wait for this to be fixed, but I'm sending the points to Muso for his input.  Thanks!
0
 
LVL 10

Expert Comment

by:muso120999
ID: 11895845
I know how much of a pain this stuff is at times; I have had to work around a not-quite-compliant LMS before, and that's a far from ideal situation.

Glad you've figured out the cause at least, and thanks for the points.

Incidentally, I checked the HTML code generated by MX2004 last night, and min and max are actually set default values (0 and 100).
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 11900110
i never use the flash scorm stuff - now i know why :-)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now