How to pass a number or a string from Flash (AS3) to SL?

I have buttons in a Flash File (like a keyboard) that I want pass a number or string character to a SL var.  I found a Forum that gave me this code, but I can't get it working.  Any AS3/SL gurus out there that can help?

Originally posted in forum;

  import flash.external.ExternalInterface;
  ExternalInterface.call('GetPlayer().SetVar','gamescore',score);

I added; an event listener for the button and my Variable (with assigned value[=A]) (eg. Button A [in SWF file] will populate the SL var DEScratchpad with the letter "A".)

btn_A.addEventListener(MouseEvent.CLICK, add_A_ToScratchPad);

 function add_A_ToScratchPad(Event:MouseEvent):void {
  import flash.external.ExternalInterface;
  ExternalInterface.call(GetPlayer().SetVar,DEScratchpad,"A");

}

I appreciate any assistance. Thanks! 

Be the first to reply