//------------------------------------------------------------------------------------------------ //Following code enables user to use LMS Adapter for LMS using SCORM/AICC standard for data communication //------------------------------------------------------------------------------------------------- import flash.utils.Timer; import flash.events.TimerEvent; import flash.events.MouseEvent; //step1: tracking_mc.createLMSAdapter("SCORM");// Mandatory call, excepts (“SCORM”,”AICC”,””), if “” provided, it automatically finds the standard LMS is using //step 2: var tadapter = tracking_mc.currentTrackingAdapter();// Mandatory call, creates an adapter depending on the standard use by LMS and return it //step 3: initialize adapter and wait till it get initialized. if(tadapter != null){ if(tadapter.isInitialized()){ trace("adapter already initialized"); }else{ trace("initializing the LMS adapter"); tadapter.initialize();// Mandatory call var timer:Timer = new Timer(5000,1); timer.addEventListener(TimerEvent.TIMER_COMPLETE,gettrackingdata); timer.start(); } } function gettrackingdata(e:TimerEvent):void{ trace("calling get tracking data"); tadapter.getTrackingData();//Mandatory call } //----------------------------------- //step 4: //check if get tracking data is success using Timer var tdata:Timer = new Timer(5000,20); tdata.addEventListener(TimerEvent.TIMER,checkTrackingData); tdata.start(); function checkTrackingData(e:TimerEvent):void{ if(!tadapter.isTrackingDataLoaded()){// mandatory call and proceed only if this is success trace("tracking data not loaded"); }else{ trace("tracking data loaded"); printTrackingData(); tdata.stop(); } } function printTrackingData():void{ trace("score raw="+tadapter.getScoreRaw()); trace("score max="+tadapter.getScoreMax()); trace("score min="+tadapter.getScoreMin()); trace("score pass="+tadapter.getScorePass()); trace("score tot="+tadapter.getScoreTot()); trace("Lesson location:"+tadapter.getLessonLocation()); trace("Lesson status:"+tadapter.getLessonStatus()); trace("Success status:"+tadapter.getSuccessStatus()); trace("Student ID:"+tadapter.getStudentID()); trace("Student Name:"+tadapter.getStudentName()); trace("Lesson Data:"+tadapter.getLessonData()); } //step 5: code to send tracking data function sendTrackingData(e:MouseEvent):void{ if(tadapter.isInitialized()){ //use this API to send tracking data //sendTrackingData(_scoreRaw_int, _scoreMin_int, _scoreMax_int, _scoreAsPercent_bln, _location_str, _statusCompletion_str, _statusSuccess_str, _statusPreference_bln, _time_str =, _resumeData_str):void tadapter.sendTrackingData(tscore, 0, 100, false, lmsLocation_str++, , "", true, "", ); }else{ trace("LMS not initialized"); } } //step 6: code send interaction data for each question function sendInteractionData(e:MouseEvent):void{ //use this API to send interaction data // sendInteractionData(interactionID_str, objectiveID_str, type_str, correctResponse_str, studentResponse_str, result_str, weight_int, latency_str, date_str, time_str):void tadapter.sendInteractionData("100001", "q1234", "choice", "1", "1", "1", 10, 0, undefined, undefined); }