Search This Blog

Wednesday, March 24, 2010

DEtect OS in AS2

// Camera and Microphone check
var userCamMic:Boolean = System.capabilities.avHardwareDisable;
trace("YOUR CAMERA AND MICROPHONE ARE ENABLED:");
trace(userCamMic);
// Flash player supports communication to Accessibility Aids
var userAccess:Boolean = System.capabilities.hasAccessibility;
trace("YOUR FLASH PLAYER SUPPORTS COMMUNICATION TO ACCESSIBILITY AIDS:");
trace(userAccess);
// Checking to see if you have audio
var userAudio:Boolean = System.capabilities.hasAudio;
trace("YOUR SYSTEM HAS AUDIO:");
trace(userAudio);
// Checking to see if you have an audio encoder for streaming
var userAudioEnc:Boolean = System.capabilities.hasAudioEncoder;
trace("YOUR SYSTEM HAS AN AUDIO ENCODER, THUS ALLOWING STREAMING:");
trace(userAudioEnc);
// Checking to see if your system has embedded video capabilities
var userEmbVideo:Boolean = System.capabilities.hasEmbeddedVideo;
trace("YOUR SYSTEM ALLOWS FOR EMBEDDED VIDEO:");
trace(userEmbVideo);
// Checking to see if your system has an MP3 decoder
var userMP3:Boolean = System.capabilities.hasMP3;
trace("YOUR SYSTEM HAS AN MP3 DECODER:");
trace(userMP3);
// Checking to see if your system supports printing
var userPrint:Boolean = System.capabilities.hasPrinting;
trace("YOUR SYSTEM SUPPORTS PRINTING:");
trace(userPrint);
// Checking to see if your system supports development of screen broadcast
// applications to be run through Flash Communication Server
var userScrnBrd:Boolean = System.capabilities.hasScreenBroadcast;
trace("YOUR SYSTEM SUPPORTS DEVELOPMENT OF SCREEN BROADCAST APPLICATIONS TO BE RUN THROUGH FLASH COMMUNICATION SERVER:");
trace(userScrnBrd);
// Checking to see if your system supports playback of screen broadcast
// applications that are running from Flash Communication Server
var userScrnPlay:Boolean = System.capabilities.hasScreenPlayback;
trace("YOUR SYSTEM SUPPORTS PLAYBACK OF SCREEN BROADCAST APPLICATIONS THAT ARE RUNNING FROM FLASH COMMUNICATION SERVER:");
trace(userScrnPlay);
// Checking to see if your system can play streaming audio
var userStrmAud:Boolean = System.capabilities.hasStreamingAudio;
trace("YOUR SYSTEM CAN PLAY STREAMING AUDIO:");
trace(userStrmAud);
// Checking to see if your system can play streaming video
var userStrmVid:Boolean = System.capabilities.hasStreamingVideo;
trace("YOUR SYSTEM CAN PLAY STREAMING VIDEO:");
trace(userStrmVid);
// Checking to see if your system can encode streaming video
var userVidEnc:Boolean = System.capabilities.hasVideoEncoder;
trace("YOUR SYSTEM CAN ENCODE STREAMING VIDEO:");
trace(userVidEnc);
// Checking to see if your player is officially released (false) or a debugging version (true)
var userDebug:Boolean = System.capabilities.isDebugger;
trace("YOUR PLAYER IS A DEBUGGING VERSION:");
trace(userDebug);
// What language is your player running
var userLang:String = System.capabilities.language;
trace("YOUR PLAYER IS RUNNING ON THIS LANGUAGE (see Actionscript 'Reference' for language list.Example: 'en' is English):");
trace(userLang);
// Checking to see if player is attempting to read anything from hard disk
var userLocFile:Boolean = System.capabilities.localFileReadDisable;
trace("YOUR PLAYER IS ATTEMPTING TO READ FROM YOUR HARD DISK:");
trace(userLocFile);
// Checking to see the manufacturer of your Flash player
var userManu:String = System.capabilities.manufacturer;
trace("YOUR FLASH PLAYER IS MANUFACTURED BY:");
trace(userManu);
// Checking to see what operating system user is running
var userOS:String = System.capabilities.os;
trace("YOUR OPERATING SYSTEM IS:");
trace(userOS);
// Checking the pixel aspect ratio of user screen
var userPAR:Number = System.capabilities.pixelAspectRatio;
trace("THE PIXEL ASPECT RATIO OF YOUR SCREEN IS:");
trace(userPAR);
// Checking to see what player the user system is using
var userPlayType:String = System.capabilities.playerType;
trace("THE PLAYER YOUR SYSTEM IS RUNNING IS:");
trace(userPlayType);
// Checking to see what color user screen is running
var userScrnCol:String = System.capabilities.screenColor;
trace("YOUR SYSTEM IS RUNNING THIS COLOR (color, gray, bw):");
trace(userScrnCol);
// Checking to see what the users screen DPI is
var userDPI:Number = System.capabilities.screenDPI;
trace("YOUR SCREEN DPI (DOTS PER INCH) IS:");
trace(userDPI);
// User screen resolution
var userScreenX:Number = System.capabilities.screenResolutionX;
var userScreenY:Number = System.capabilities.screenResolutionY;
trace("YOUR MONITOR RESOLUTION IS:");
trace(userScreenX+" x "+userScreenY);
// Creating URL code for users system capabilites
var userServStr:String = System.capabilities.serverString;
trace("THE URL CODE FOR YOUR USER SYSTEM CAPABILITIES IS:");
trace(userServStr);
// Checking to see what Flash player version user is running
var userVersion:String = System.capabilities.version;
trace("YOUR FLASH PLAYER VERSION IS:");
trace(userVersion);
// Checking to see if user has disabled windowless mode
var userWinDis:Boolean = System.capabilities.windowlessDisable;
trace("YOU HAVE DISABLED WINDOWLESS MODE:");
trace(userWinDis);
// Checking to super domain or exact domain is set
var userExacSet:Boolean = System.exactSettings;
trace("YOU HAVE SUPER DOMAIN SETTINGS:");
trace(userExacSet);

Thursday, March 11, 2010

Cross Platform Flash Projectors and CD Burning FAQ

http://probertson.com/articles/2006/10/11/geturl-flash-projector-firefox-problem/

http://www.actionscript.org/forums/showthread.php3?t=22952

Flash Projectors and CD Burning FAQ

by Radina Matic - DiDi
Index

1. Why using Standalone Projector?
2. Mac Projector vs. Windows Projector
3. FSCommand for Standalone Projector
a) PC/Windows issues
b) Macintosh issues
4. Burning CDs with projectors
a) Burning on Mac
b) Burning on PC
5. Resources
a) FSCommand/Projectors
b) CD Burning

1. Why using Standalone Projector? index

Whenever you want to distribute your Flash creations offline (and you do not want to worry if the user has Flash Player installed or not) you have the option to publish your movie as Standalone Projector. In File menu chose Pubblish Settings and check the Windows Projector or Macintosh Projector option in the dialog window. This will "wrap" your .swf movie into a Standalone Flash Player which can be reproduced outside the browser. You can find the Standalone Player (together with Player Installers) in the folder where where you installed Flash on your computer (usualy it is C:\Program files\Macromedia\Flash 5\Players on Windows).

2. Mac Projector vs. Windows Projector index

Standalone Projector for Windows has normal .exe extension, while Mac Projector published on Windows version of Flash has the extension .hqx. HQX is not executable file, it is form of encoding (kind of Mac's Zip file) which packs together the two file forks Mac files have: Data fork and Resource fork. It will not open on PC if you click on it (because it has to be decoded), and it will not work if you burn it just like that on CD with PC (for burning issues see bellow).

If you have one main movie and you want to load other .swf files in it, you ONLY need to publish the main one as .exe/hqx, not all of them.


3. FSCommand for Standalone Projector
index


You can access fscommands for standalone player through Actions panel:

Flash 5 Flash MX


a) PC/Windows issues
index

Flash 5 supports six FSCommands:

  • fullscreen - With this option you can able/disable fullscreen viewing of you movie. You can put it in the frame or button (if you prefere leaving this choice to the user):
  • fscommand("fullscreen", "true");

  • allowscale - If you want to mantain aspect ratio of your movie and prevent it from being scaled by the user you should set this option to 'false':

    fscommand("allowscale", "false");

    Sometimes (when you set your projector to fullscreen and you want to mantain its aspect ratio by allowscale/false), when you have some objects outside the stage, they will eventualy be seen even if you don't want them to. You can solve this problem by putting a Mask with the size of your stage on the topmost layer of your movie to cover all off-stage objects. Another thing to remember is that any .swf you load into the main projector inherits its allowscale settings.

  • showmenu - 'False' argument will disable the upper menu (File/View/Control/Help) and all right click menu options except "About Macromedia..." in Flash 5 and "Configuration" and "About..." in Flash MX.

    fscommand ("showmenu", "false");

    There is no way to eliminate completely right click menu (or put our own one) without some 3rd party tool (even though you could do it in Hex Editor if you know how - check Sx's threads in Resources). Title bar ("Flash" in Flash 5 and "Macromedia Flash Player 6 " in Flash MX) and icon can also be removed/changed only with 3rd party tools.

  • trapallkeys - If you don't use this option (or you put it to 'false') user can exit fullscreen mode of your projector by pressing Esc key. 'True' argument locks all keys, but user can still access Status bar by pressing Windows key - if projector is set fullscreen - and exit your projector by pressing Alt + F4. Some non-advanced users may not know how to use these keys combinations, so be sure to put some exit button if your projector is set to fullscreen and you used trapallkeys/true.

    fscommand("trapallkeys", "true");

  • quit - As its name says, it closes your projector. You can put it into button or frame (no parameters needed):

    fscommand("quit");

  • exec - This command revealed itself to be the most interessting because it gives us the oportunity to make movies communicate with other programs, open files in their default applications and lot more (see Resources for more details):

    fscommand ("exec", "c:\\windows\\notepad.exe");

    This will open Notepad from Flash 5 projector. "Exec" fscommand in Flash MX is severely crippled for security reasons and it does not allow passing arguments anymore. It can only open programs (applications, not specific documents in their default programs as it was possible before) which must be located in the fscommand folder on the root of projector file (no need to put this fscommand folder in the path, Flash already knows it is supposed to look for it there).

In Flash 5 there is also an undocumented "save" FSCommand which allows you to write variables to users HD and it was (also) suppressed in Flash MX. You can try using Shared Local Objects instead or 3rd party tools to regain some of the "old power" of 'Exec' and 'Save' fscommands.

b) Macintosh issues
index

Normaly all above code should work on Macintosh platform without problems (Flash was made to be crossplatform). One thing you will not be able to do with Mac projector is to write variables on user's HD. Also, when opening files with FSCommand in Flash 5 projectors you should remember to use colons (:) (and not slashes (/) as in PC) to separate folders in a pathname: FSCommand ("exec", ":folder:filename");. On the other side, OSX uses standard Unix path notation (/) and not colon.

Another way to open specific file with Mac projector is by using applescript, which you should compile as an application in AppleScript Editor and then run it with FSCommand. Your applescript and file you want to open with should be in the same folder. Here are 2 examples:

--set the name of the file to open
property fileName : "thedocument.pdf"
--get the path to the containing folder
set myPath to (path to me as string)
set AppleScript's text item delimiters to ":"
set the parentFolder to ¬
((text items 1 thru -2 of myPath) & "") as string
set AppleScript's text item delimiters to ""
-- find the flash file
try
set targetFile to alias (the parentFolder & fileName)
on error
--ie if there's no file here by this name, it will quit.
return quit
end try
tell application "Finder"
open file targetFile
end tell

source

tell application "Finder"
activate
select file "Your File" of disk "Your Disk"
open selection
end tell






source


There seems to be a problem/bug with Flash MX projectors for Mac: basicaly if you have to load .swfs in your main movie it will not stay fullscreen even if you put the FSCommand for it correctly. Workaround for this problem is to create an empty "container" movie with only FSCommand for fullscreen, and then load your content into level1 or higher. That seems to be the only way Mac projector will stay fullscreen (see Resources below for more details).

Unfortunately, there are no 3rd party tools for Mac that could help you enhance your projectors as there are for PC.

4. Burning CDs with projectors
index

Ok, you have your flaming projector and you want to burn it on CD for distribution. Presuming most of us know how to burn CD for our own platform, only burning hybrid CD (crossplatform) will be covered here.

Since Flash projectors on CD have to be loaded completely in computer's memory before they start to play, beware of their size. Even though there is no definite answer (using preloaders and loading .swfs into main movie may help), it is recommended that they should not be bigger then 25 Mb (Macromedia's original advice is: no bigger then 4MB!!! - see resouces for the technote). If you have to do a bigger project, you may consider switching to Director.

a) Burning on Mac
index

Since Mac recognizes the ISO 9660 file system and Windows file formats, and Windows do not understand Mac's Hierarchical File System (HFS) file format, hybrid CDs used to be burned on Macintosh. But PC users should not despare because there are workarounds to this (see below).

Toast is one of the burning programs which allows making Hybrid CDs on Mac. You will need to make temporary disk partition on your Desktop and copy your Mac projector and eventualy the shared .swf files (those that will be seen on both Mac and PC) on it. In another folder on your desktop (but not in the temporary partition) put all PC files (projector, autorun.inf and icon). Then in Toast window choose Custom Hybrid, select Mac volume, press Data button and then simply select your temporary partition (or drag it on Toast window). Now choose ISO volume, hit ISO button and select your PC files from the folder you made (just files, not whole folder), and select also all shared .swf files from the temporary Mac partition. This way the shared files will be burned only once, but will be seen on both Mac and PC. You will have to specify "Joliet" naming settings for PC files so the names can be longer then 8.3 characters.

Autostart feature on Mac is handled by QuickTime and you can choose the file you want to autostart (your projector) from the settings in Mac volume of Toast window. If you want your PC projector to autorun when CD is inserted, you'll have to make autorun.inf file. You can use free program BBEdit to create this file for PC on your Mac. Choose New document and write this:
[autorun]
open=yourprojector.exe
icon=youricon.ico

Save the file as autorun.inf. It should be on the root of CD to work correctly. If you want your CD to show custom icon in Windows Explorer, it should be Windows icon format, any simple graphic image will not work. Program called Iconographer can make Windows icons on Mac.

It may be vise to allocate enough RAM memory (size of your projector, size of .swf files to load into the main one and a couple more Mb just to be sure) to your Mac partition before burning, because CD inherits its memory settings. When you have all this done, burn your CD and enjoy...

b) Burning on PC
index

The only way to create crossplatform (hybrid) CDs on PC is to use specific program which makes image file (nothing to do with graphic images) containing your Mac and PC projector and eventual shared files. Image file is then burned to CD with your favourite burning software. The result is functional and autorun works on PC as autostart does on Mac. Here is the procedure to use with program called MacImage:


When you open the program it will be in the default Project Mode and Hybrid view.

Give the name to the Project, launch Explorer and drag your files in their places: PC projector, autorun file and icon into the ISO view of the MacImage window (files with yellow spots in the picture) and Mac projector into the HSF view (file with green spot). Do not worry about decoding of .hqx file, program takes care of it. Shared files (both yellow and green spots) go into ISO/HSF view because this way PC users will see only PC files, Mac users will see only Mac files and both will see shared files.

Once you finished all this, you will have to compile image file: choose Compile option from the Projects menu (or click fourth button on the toolbar - look for the pointer in the picture above), give the name to your image file and the program will do the rest. All you have to do now is burn compiled image to CD with burning software.

To implement the Autostart feature for Mac you should take one more step. Reopen the compiled image in the Partition Mode (switch mode in the first item of Options menu), select the file you want to autostart (your Mac projector), and choose Autolaunch feature from the right click menu. Resave the image and it will be ready for burning.

Almost all burning packages are capable of burning image files. In Nero you should choose Burn Image option from File menu, open your image file (switch to "all files" type to see it), accept the default values from pop up window and it will burn image to CD. And that's it...

PC users can make autorun.inf file in text editor (Notepad) and it should look like the one on the picture on the left. Autorun should be on the root of your CD but your projector and icon do not have to be. Just remember to change autorun.inf file if you plan for any reason to put your projector in specific folder (the same is valid for making autorun.inf for burning hybrid CD on Mac).


5. Resources
index

a) FSCommand/Projectors index

Standalone & Applications
and Macintosh Forums on FlashKit Board should be a best place to start (and continue). There are also interesting tutorials on FlashKit about manipulating projectors, opening files from projector with batch files and autorun features.

Basic info about FSCommand and Flash size from Macromedia site.

Three useful tutorials in our own AS.org tutorial section: Launch Applications, Opening Documents and Execute Files from Flash projectors.

All the things you ever dreamed of doing with Flash (but never dared to ask how): check "Flash and offline usage" part of Sx's "Must Read Threads" at were-here.com and enjoy (there is a smaller version of it at FlashKit)...

Very good FREE application to launch, save, copy, move, print, delete files, manipulate windows, play with registry and dll's... from Flash projector is called Flash Command Line Tools. Works with Flash 3 to 5 but not with MX. FlashGeek is a program originaly meant to let you open documents from Flash 5 projectors, but will work with MX also since it passes arguments though text files (the only drawback is that you need a separate copies of program's .exe and .txt file for every document you want to open). If you want to launch files from MX projector you could use another two free applications: Executor and freeMX. Both need Flash OCX to be installed on users machine, but the latter is more complete since it will check for ocx and if it is not there, freeMX will install it (you should include the full player installer on CD - it is free but be sure to sign the licence agreement at Macromedia site).

Les Paone recently renewed his site (you can still find his FREE edited player) and included a new tool for MX projectors called SOP. Using Flash Shared Objects it allows running programs, opening, deleting and printing files, minimizing and maximizing your projector.

Here is (partial) list of 3rd party tools with which you can customize your projector and enhance its functionalities: SWF Studio, Flash 'N Pack, LPFlashEX, FlashAnts, Jugglor. They are all comercial. If you are looking for a freeware tool try Resource Hacker (here is a nice tutorial about it). It will let you customize some of the projector features, but beware because the issue about its legality is not quite clear.

Northcode Inc. has some nice free utilities too: Topmost will let you open browser window (or any other) in front of fullscreen projector; Browse will open an Windows Explorer on the root of the drive it's launched from (it has no parameters so it will work from Flash 5 and MX); Center will let you center the window of application launched from projector (Flash 5 and MX); Kill is used to close any window from projector (Flash 5, check here for the documentation); with Min you can minimize any application running alongside your projector (Flash 5); Wallpapr allows you to set Desktop wallpaper from projector (Flash 5) and if you are interested in making Flash projector "talk" with Visual Basic, check these examples: fscommand.zip and flashvb.zip. Tim Goss (known as Northcode - moderator of FlashKit Standalone & Applications Forum) started other two sites you may find interesting: BeyondFlash is informational and ExtendingFlash is practical with some of his free utilities.

If for any reason you prefer to mantain your movie as .swf inside HTML page but you would still like to have it autorun from CD you may use these two tools: autohtml.exe or Northcode's RunFile.

All above mentioned resources are only for PC. To edit basic features of Mac projectors (title, icon, right click menu) you could use ResEdit. But there are no 3rd party tools to significantly manipulate and extend Mac projectors. This may be the only possible solution at the moment.

Here is the link for details about that problem/bug for MX fullscreen projector on Mac (together with some problems about Autostart feature on OSX). Applescript in detail from apple.com. You will need to have CarbonLib 1.5 or latter installed if you want to run Flash MX projector on Mac OS 9.x (read the technote). Another conflict that may cause problems with executing MX projectors in OS 9.x (they may run slow or not even run at all) is with Logitech MouseWare extension (technote).

b) CD Burning
index

Comprehensive tutorial for burning hybrid CDs with Toast from the Roxio site.

You can find David Hrycyszyn's very good in-detail tutorial about burning hybrid CDs on Mac (the one that used to be on were-here.com) here.

Although not Flash centered, this two tutes can also be interesting: setpixel's one about burning Director projects, and Rose Marshack's one about enhanced music CDs. More usefull info about extra CDs (music and multimedia content) can be found in this thread.

As seen before, MacImage will allow PC users to create hybrid/crossplatform CDs (check their site, it's full of precious information about Mac/PC file transfer issues). Another program (much bigger and more expensive though) with same features is CDEveryWhere.