Kingsley eLearning Solutions

You have big dreams for your eLearning.
We'll make them come true.

image of Kingsley

Pulling user name into Articulate

Submitted by Kingsley 👑 on Fri, 05/06/2011 - 09:54

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

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.

Submitted by Kingsley 👑 on Fri, 05/06/2011 - 16:13

Permalink

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....

Submitted by Jim (not verified) on Wed, 06/15/2011 - 10:43

Permalink

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

Submitted by Julie (not verified) on Wed, 06/15/2011 - 13:00

In reply to by Jim (not verified)

Permalink

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.

Submitted by Jace (not verified) on Wed, 04/11/2012 - 13:35

In reply to by Jim (not verified)

Permalink

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.

Submitted by Annette Grazulis (not verified) on Tue, 04/10/2012 - 12:33

Permalink

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

Submitted by Homz (not verified) on Fri, 01/11/2013 - 04:02

Permalink

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.

Submitted by Shawn (not verified) on Mon, 11/11/2013 - 18:07

Permalink

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....

Submitted by JerrySok (not verified) on Mon, 11/20/2017 - 22:29

Permalink

Submitted by Angelgup (not verified) on Tue, 11/21/2017 - 06:29

Permalink

Submitted by Robertadors (not verified) on Sun, 11/26/2017 - 02:41

Permalink

Submitted by Brycesligh (not verified) on Sun, 11/26/2017 - 15:02

Permalink

<a href=http://www.balenciagaschoenensale.nl/759-dior-homme-schoenen-prijs.html… Homme Schoenen Prijs</a>
As fun as placing a seed within the soil and doing work and expecting it to increase may seem, it may be a quite fulfilling activity or profession. Something else is the fact that when you know what you really are doing, it's not really that poor. These guidelines below can help you commence.

<img>https://www.voetbalschoenengoedkoop.nl/images/que2/8153-nike-hypervenom…;

Maintain a proper dieting when expecting. You will most likely have desires when expectant, and you need to indulge in them However, also, it is significant to make certain your diet plan is good. Be sure to take in a lot of vegetables and fruit, and ingest healthy beverages like h2o and juice.

<img>https://www.christianlouboutinshoesnederland.nl/images/tom2/3228-christ…;

Submitted by Michaelgub (not verified) on Sun, 11/26/2017 - 16:59

Permalink

<a href=http://www.adidasgazelledames.nl/732-stan-smith-vintage-adidas.html>Stan Smith Vintage Adidas</a>
If you must obtain a payday advance, ensure you read through any and all fine print associated with the bank loan. If you will find fees and penalties connected with paying back earlier, it depends on anyone to know them up front. If you have anything at all that you just do not understand, do not sign.

<img>https://www.talmadrachten.nl/images/whi2/1772-zonnebril-ray-ban-sale.jp…;

You will be great at making use of your makeup products and cleaning it well at the end of the day. Have you been as diligent when cleaning up your makeup brushes? Chances are, you happen to be not. It really is suggested to clean your makeup products brushes one or more times per month by using a mild cleansing soap such as child hair shampoo. Lather them up carefully, rinse off, and permit them to oxygen free of moisture.

<img>https://www.Louisvuittonbestellennederland.nl/images/dni2/258-louis-vui…;

Submitted by Manueloresy (not verified) on Sun, 11/26/2017 - 22:34

Permalink

Add new comment