View Full Version : Platform detect?
jtocher
06-27-2002, 10:51 PM
I am putting together a cross-platform CD with Flash MX and though perusing the posts have finally learned how to open .pdf files with Flash (woo hoo!) Now, my question is this how do I detect the users computer platform so I can either use the AppleScript solution or the Windows 'magic start.exe' solution. I really don't want to have to maintain two separate source files for this project - would prefer using if Windows, do this... else, do this.
It seems this platform detect would be a fairly common issue, but I've scoured the net and haven't found the magic key... help???
Thx in advance:confused:
Jesse
06-28-2002, 01:12 AM
Manipulate this:
trace(getVersion());
It traces, WIN, MAC or UNIX.
jtocher
06-28-2002, 04:59 PM
Just want to make sure I've got this in correctly (seems to be working, but need confirmation that this is the *best* way to implement).
At the beginning of the movie, I start with the platform detect as follows:
platform = getVersion().substring(0, 3);
This tells me if I'm running on "MAC" or "WIN" (Note that I'm not concerned with UNIX/LINUX since this is going out on CD-ROM)
Then, when I need to do something with this info (a button that launches a pdf file using either Applescript on Mac or MS's magic start.exe on Win):
on (release) {
if (platform=="MAC") {
fscommand("exec", "mypdf");
} else {
filename = "mypdf.pdf";
fscommand("exec", "start\t+filename");
fscommand("exec", "cmd\t/c\t"+filename);
}
}
Thanks for verification of implementation!
Janice
Jesse
06-29-2002, 09:32 AM
Looks good to me.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.