dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Determine if Mac or PC within a flash projector? (for use with FSCommand)

  1. #1
    Junior Member
    Join Date
    Mar 2009
    Posts
    11

    Determine if Mac or PC within a flash projector? (for use with FSCommand)

    Determine if Mac or PC within a flash projector? (for use with FSCommand)

    How do I determine if a computer is Mac or PC within a flash projector?

    I need this because I've got several FSCommands I need to use within a projector (such as launching an application or file) and need to have different commands for Mac and PC.

    Code:
    if (MAC) {
        (do this)
    } else if (PC) {
        (do this)
    }
    Anyone know how to do this?

    Note: I'm using Flash 8 w/ Actionscript 1 & 2 (?) on a Intel Mac 10.4.11

  2. #2
    Junior Member
    Join Date
    Mar 2009
    Posts
    11
    I've found this thread here
    http://board.flashkit.com/board/show...67#post4152267

    It shows how to do it as of 8/16/2000 ....
    Code:
    LoadVariables("myfolder\test.txt",0)
    If pc eq "true"
    Set Variable "os"="pc"
    Else
    Set Variable "os"="mac"
    end if
    Anyone know of a better way?

  3. #3
    Junior Member
    Join Date
    Mar 2009
    Posts
    11
    Ok ... been testing...

    I've created a button in flash that has code to launch an application:

    Code:
    on (release) {
    	fscommand("exec", "test.exe");
    	fscommand("exec", "test.app");
    }
    It works whether on a mac or a pc. Either platform it launches the appropriate file and I assume it errors out in trying to launch the other file.

    Still... does anyone know how to do a proper "if (mac) else if (pc)" statement?

  4. #4
    Junior Member
    Join Date
    Mar 2009
    Posts
    11
    I think this thread has the code I'm looking for...
    http://board.flashkit.com/board/showthread.php?t=773959

    Code:
    platform = substring(getVersion(), 1,3);
    if (platform == "WIN") {
    	// we're running on Windows
    } else {
    	// we're running on a MAC
    }
    I'll have to test it later to see if it works.

  5. #5
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Now if you wrap that code up into a function and you follow the same naming convention for your MAC and WIN applications, you will end up with a function that looks something like this...

    Code:
    function SmartExec(target)
    {
       platform = substring(getVersion(), 1,3);
    	
       if (platform == "WIN") 
       {
          // we're running on Windows, target an EXE file
          fscommand("exec", target + ".exe");
       } 
       else 
       {
          // we're running on a MAC, target an AppleScript file
          fscommand("exec", target + "_script");
       }
    }
    usage: SmartExec("whatever");

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center