ReviewMyElearning.com

Pulling user name into Articulate

You may have seen this latest product over at eLearningEnhanced.com It lets you display the students name (from the LMS) in your course content. Check out the screenr to see it in action.

I thought some of you might like to see how I did it.
There are two pieces to this widget.
1. A small change to Articulate's lms.js file.
2. The Flash file which will 'talk' to the lms.js file.

Let's take a look at the code in both...

The lms.js is Articulate's JavaScript that allows it to talk with almost any LMS (nice job Rustici). We need to extend it just a bit with a new function which will tap into it's built in functions. Here is my code (it's very simple):

function FindStudentName(){
	return lmsAPI.GetStudentName()
}

I just stuck that at the end of the file.

Next is our Flash file... again very simple. Just has one frame, a dynamic text field and some AS2.

import flash.external.ExternalInterface;
var userName:String;
var rtnData:Object;
if (ExternalInterface.available) {
	rtnData = ExternalInterface.call("FindStudentName");
	if (rtnData != null) {
		userName = rtnData.toString() 
	} else {
		userName = "Guest";
	}
}
name_txt.text = userName;

First I set up the communication with JavaScript.
Then I create a string to hold the name and an object to hold the data returned from the JavaScript.
I put the actual JS call to our new function in an IF statement just in case we can't make the call... in that case we set the user name to "Guest".
Now... most LMSes will return the username backwards Last, First. I don't think that is very friendly so added a function to turn things around. Here is all my code together:

import flash.external.ExternalInterface;
var userName:String;
var rtnData:Object;
if (ExternalInterface.available) {
	rtnData = ExternalInterface.call("FindStudentName");
	if (rtnData != null) {
		userName =  rearrangeName(rtnData.toString());
	} else {
		userName = "Guest";
	}
}
name_txt.text = userName;

function rearrangeName(lastNameFirst:String):String {
	var tmpArray:Array = lastNameFirst.split(",");
	return tmpArray[1]+" "+tmpArray[0];
}

I hope this helps!
And remember for more widgets and/or custom eleaning solutions please visit www.eLearningEnhanced.com

Comments

Hello,
Works like a charm on '09. Just as a test, I tried it on Articulate '13 and it causes an issue with the "Finish" button. Is there an update for '13.

Thanks again for the help....

There isn't really a "clean" solution for '13. The code I give here is for AS2 and Articulate '13 uses AS3.

Plus there needs to be an HTML5 solution.

Hi, I am trying to create a certificate in flash CS5. I tired the above code but I dont think I got it right.

The dynamic text box does not seem to be working when I publish the swf.

We built this and it is not working with our lms (Success Factors) anyone know why? It is just saying undefined.

I like this widget, but I wish I could grab the user's first name only... Like "Hello Jim" Not "Hello Jim Smith"

I know I am a little late to the party, but...

You should be able to get the First Name by modifying the last line of the rearrange function:
return tmpArray[0];
(Assuming your LMS username comes out like "Last Name","First Name").

Hope that helps.

Sorry, the code should be:

return tmpArray[1];

That was my reaction, too - is there a way to do this? I think it would look more friendly than using the learner's full name.

Thanks James, worked first time, thank you for sharing

Phil

This would be possible.
But it wouldn't be formatted very nicely for printing... The slide size and shape won't fit cleanly on a page.
Let me think on it some....

I wonder if this could be modified and combined with some code that would allow me to create a custom "Course Completion" certificate.

Here is what I wish I had.

The ability to grab the users name from the LMS.
The ability to grab the course name from the LMS.
The ability to grab the date from the LMS.

Then place the flash file on an Articulate (ppt) slide that was a certificate that I design around the insert.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Images can be added to this post.
  • You may use [inline:xx] tags to display uploaded files or images inline.
  • You may use <swf file="song.mp3"> to display Flash files inline
  • Twitter-style @usersnames are linked to their Twitter account pages.
  • Twitter-style #hashtags are linked to search.twitter.com.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
    _  _  _  _                                           _  _  _  _  _                       
_(_)(_)(_)(_)_ (_)(_)(_)(_)(_)
(_) (_) _ _ _ _ _ _ _(_) _ _ _ _
(_) (_) (_)(_)(_)(_)_ (_) _ _ (_) _(_) (_)(_)_(_)(_)
(_) _ (_) (_) (_) (_)_(_) _(_) (_) (_) (_)
(_) (_) _ (_) (_) (_) _(_)_ _(_) (_) (_) (_)
(_)_ _ _(_) _ (_) (_) _ (_) (_) _ _(_) (_) (_) (_)
(_)(_)(_) (_) (_) (_) (_) (_) (_) (_) (_) (_)

Enter the code depicted in ASCII art style.