Skip to main content
Known Participant
June 15, 2010
質問

How to get the current logged in username from windows and put it into an AS var

  • June 15, 2010
  • 返信数 2.
  • 5261 ビュー

Hello,

I was hopeing someone would know how to get the current logged in username from windows and put it into a var, so I can create a dynamic text box to display it.

Thanks in advance

Michael

このトピックへの返信は締め切られました。

返信数 2

nutinm作成者
Known Participant
July 14, 2010

Just for everyone’s info, this is the script I have used to get the logged in windows username into flash ---- not and air app.

In the html page that publishes with the .swf file under the <head> section:-

<script language="JavaScript" type="text/javascript">

function findUserName() {

     var wshell=new ActiveXObject ("wscript.shell");

     var username=wshell.ExpandEnvironmentStrings("%username%");

     return username;

}

</script>

The ActionScript:-

import flash.external.ExternalInterface;

var username:String = ExternalInterface.call ("findUserName");

trace (username); // a quick test to see it in output

kglad
Community Expert
Community Expert
June 15, 2010

are you creating an air app?  if not, there's no way.  if yes, there's probably a way.


nutinm作成者
Known Participant
June 16, 2010

Ok so I should do it in java or asp and lookit up maybe??

kglad
Community Expert
Community Expert
June 16, 2010

you can get the user name with java but i don't know if that's what you should use.