Showing posts with label Flash Player. Show all posts
Showing posts with label Flash Player. Show all posts

Monday, May 24, 2010

Properties that can be set using mm.cfg file

mm.cfg file is used to configure the debugger version of Flash Player. The Location where this file is available depends on the operating system also if this file is not available at the location then we can create this file.


Operating system Location of mm.cfg
MS Window Vista C:\Users\<user_name>\
MS Windows 2000/XP C:Document and Setting\<user_name>\
Macintosh OS X MacHD:Library:Application Support:macromedia:
Linux /home/<user_name>/

Following are the properties that can be set in mm.cfg file for debugging

Properties Description
ErrorReportingEnable Enables/Disables logging of error messages.
1: Enables debug Flash Player to write error messages to the log file.
0: Disables debug Flash Player to write error messages to the log file.
Default value is 0(zero).
MaxWarnings Number of flash warnings/error messages to be logged before stopping.
The default value of the MaxWarning properties is 100.
After 100 warning/error messages are logged, the debug version of Flash Player writes further error messages are suppressed in log file.
Setting the MaxWarnings property will override he default messaging limit. For example if set to 500, the log file will record 500 warning / error messages.
If MaxWarnings property is set to 0 (zero), limit to record warning / error messages is removed and all the warning / error messages are recorded.
TraceOutputFileEnable Enables/Disables logging of trace messages.
1: Enables debug Flash Player to write trace messages to the log file.
0: Disables debug Flash Player to write trace messages to the log file.
Default value is 0(zero).
TraceOutputFileName Ignored form Flash Player 9.

Note: Debug Flash Player writes all warning /error messages /trace statements to a file named flashlog.txt, whose location depends on operating system.

Operating system Location of flashlog.txt
MS Window Vista C:\Users\<user_name>\AppData\Roaming\Macromedia\Flash Player\Logs\
MS Windows 2000/XP C:Document and Setting\<user_name>\Application Data\Macromedia\Flash Player\Logs\
Macintosh OS X MacHD:Users:<user_name>:Library:Preferences:Macromedia:Flash Player:Logs:
Linux /home/<user_name>/macromedia/Flash_Player/Logs/

Saturday, May 22, 2010

Flash Output Log File

This post is just guide on where the flash log is situated and in case if not available then, how to make it available.

The flashlog.txt is a log file created by the Flash Player. Output of all trace statement along with error reports and warning messages which are generated during compilation and/or running of a flash application are written in this log file by flash player. Existing log file is deleted and new one is created, each time flash application is started.

The flashlog.txt file is located at following location on machine

Operating System Path
Window XP : C:/Documents and Settings/<user_name>/Application Data/Macromedia/Flash Player/Logs/flashlog.txt
Window Vista : C:/Users/<user_name>/AppData/Roaming/Macromedia/Flash Player/Logs/flashlog.txt

In case if flashlog.txt file is not available at above mention location [based on operating system], follow below mention steps:

  1. Open command prompt
  2. Type 'echo %HOMEDRIVE%HOMEPATH%' and then press enter.
    Above line of code when executed will specify location where macromedia configuration file [mm.cfg] will be found.
  3. Open Window Explorer and traverse to the folder location displayed on command prompt.
  4. If macromedia configuration file [mm.cfg] file is missing at above location then open a Notepad file type in below mention line of code as is and then save Notepad file as 'mm.cfg' at above location and close it.
    ErrorReportingEnable=1
    TraceOutputFileEnable=1
  5. Close all open flash application [IDE, AIR application and Web Browsers].
  6. Now re-run flash application and all the trace statement along with error reports and warning messages will be displayed in flashlog.txt file available at location mention in table above.

The sets listed above will be useful for debugging and getting all flash logs in flashlog.txt file when flash application is running in the standalone flash player. In order to get trace statement for flash application running through web browser, you need to install Flash Debug Player for web browser.


Steps to install Flash Debug Player
  1. Uninstall Flash player
  2. Install Flash Debug Player location [http://www.adobe.com/support/flashplayer/downloads.html]
  3. Restart your browser and launch any website containing SWF. Right-click [ctrl+click] on SWF, it will display 'Debugger' option in context menu.

Once Flash Debug Player is installed, you will be able to view logs in flashlog.txt file even for flash application running from web browser.

Wednesday, May 19, 2010

Cross Domain Policy Files

A cross-domain policy is a XML document file which is use to grant permission to web client like Adobe Flash Player to access data from different domain. When a client host an application on a domain and makes a request to access content from domain other than its own, the remote domain would required to host a cross-domain policy file which would define and grant access to application from client domain.

Policy file are also used with sockets to grant permission for socket-base connections. It is advisable, to host policy file for both same domain connection as well as connections made across domains.

Normally policy file are host on root directory of a server with file name crossdomain.xml, this is the default location. The following is the example of a typical policy file.

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
   <site-control permitted-cross-domain-policies="none"/>
   <allow-access-from domain="*"/>
   <allow-http-request-headers-from domain="*" headers="*" secure="false"
</cross-domain-policy>



The parent tag for any crossdomain.xml is <cross-domain-policy>tag.

<cross-domain-policy> tag has following elements
  • <site-control>: <cross-domain-policy> tag can have only one site-control element. This element defines the meta-policy for the current domain. In cases where client needs to have multiple policy file on the domain, master policy file [policy file residing on root directory of the domain] decide the acceptability of the policy files on the domain. This element is of importance only if policy file is master policy file else this element is ignored. If a flash application is instructed to use a policy file in a location other than that of the master policy file, the client must first check meta-policy of the master policy file to determine if the original policy file is allowed. permitted-cross-domain-policies attribute of this elements meta-policies, it can hold following values
    • none: No policy files are allowed anywhere on the server other then this file.
    • master-only: Only this master policy file is allowed on the server.
    • by-content-type: All policy files whose Content-Type is text/x-cross-domain-policy are only allowed. This meta-policy is only available for HTTP and HTTPS servers.
    • by-ftp-filename: Only policy files whose file names are crossdomain.xml (i.e. with URLs ending in /crossdomain.xml) are allowed.
    • none-this-response: This is a special meta-policy that can only be specified in an HTTP response header. It helps prevents this particular HTTP response from being interpreted as a policy file.
    • all: All policy files on this domain are allowed.
    By default ‘none’ value is assign to this attribute of the element.
  • <allow-access-from-domain><cross-domain-policy> tag can have any number [zero or more] of allow-access-from elements. Each allow-access-from element can be used to define a domain or IP address from which a Flash application can access the local resources. The attribute domain specifies address of domain/IP address of Flash application which can access. If address specified is ‘*’ then it specifies that the local resource of the domain can be access by Flash application from any domain. In case if you want to grant access to your public resources by a specific domain(s), then that domain address need to be specified.

    <allow-access-from domain="www.mySite.com" />

    The above example will give access to Flash application hosted on www.example.com domain to access the public resources. Also wildcard ‘*’ can be used to match domains that ends with the given suffix.

    <allow-access-from domain="*.mySite.com" />

    IP address where Flash application is hosted can also be specified.

    <allow-access-from domain="127.0.0.1" />

    By default a Flash application hosted on an HTTPS server can only access resources on remote HTTPS servers. So if secure attribute is set to false, then a Flash application on an HTTP server can access resources from an HTTPS server.

    <allow-access-from domain="*.mySite.com" secure="false" />

    Policy file is also used while granting access to list/range of ports through which socket connection is allowed. Range of ports is specified through a dash (-)between two part numbers. List of ports are separated by comma (,). Wildcard character (*) can be used to allow all ports. The following is the example of socket-based policy file.

    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
    <cross-domain-policy>
       <allow-access-from domain="*.mySite.com" to-ports="507,516-523"/>
    </cross-domain-policy>

    The above example will allow socket connections from domain mySite.com, including sub-domains, to ports 507, 516, 517, 518, 519, 520, 521, 522 and 523.
  • <allow-http-request-header-from>: <cross-domain-policy> tag can have any number [zero or more] of allow-http-request-headers-from elements. The allow-http-request-headers-from element grants a client hosting content from another domain to send user-defined headers to the current domain, i.e., this tag grants permission to push data [in form of header] into current domain.

    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
    <cross-domain-policy>
       <allow-http-request-header-from domain="www.mySite.com" headers="X-My*"/>
    </cross-domain-policy>

    This policy file allows any header beginning with the characters X-My from www.mySite.com to be sent to this domain.


Making domain resources inaccessible from other domain

If you don’t want any Flash application to access your data/resources form your server then you can create a crossdomain.xml file that does not include ant <allow-access-from> tag

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
</cross-domain-policy>



Domain matching criteria followed by Flash Player

The following rules are used in determining if a value in the domain attribute of the <allow-access-from> or <allow-http-request-headers-from> elements matches an actual domain name:
  • For named domains, top-level domain names (i.e. com in www.mySite.com), along with second-level domain names (i.e. mySite in www.mySite.com) and subdomains of a second-level domain (i.e. www in www.mySite.com) should match.
  • Any domain used without a subdomain, are considered separate domains.
  • Whenever a wildcard character (*) is used as a subdomain, it matches the domain without a subdomain.
  • Wildcard character (*) is always used in place of subdomain or as an entire domain [All domain access], otherwise domain is invalid.
  • IP addresses and named domains are considered separate domains, even if they refer to the same host.
  • Cross-domain redirects are not allowed and, if used, a domain is considered invalid.

Examples:

Domain Values Match Not Match
www.mySite.com www.mySite.com http://mySite.com
www.mySite.net
www.mysite.co.in
*.mySite.com www.mySite.com
http://mySite.com
http://www.mySite.com
http://myExample.mySite.com
http://www.mySite.net
http://adobe.com
127.0.0.1 http://127.0.0.1 http//localhost
http://127.0.0
www.mySite.* invalid domain