Archive for October, 2007

Net web server - 192 Chapter 10: Working with External Data

Wednesday, October 31st, 2007

192 Chapter 10: Working with External Data
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.

An XML policy file contains a single tag,

Wednesday, October 31st, 2007

An XML policy file contains a single tag, which in turn contains zero or more tags. Each tag contains one attribute, domain, which specifies either an exact IP address, an exact domain, or a wildcard domain (any domain). Wildcard domains are indicated by either a single asterisk (*), which matches all domains and all IP addresses, or an asterisk followed by a suffix, which matches only those domains that end with the specified suffix. Suffixes must begin with a dot. However, wildcard domains with suffixes can match domains that consist of only the suffix without the leading dot. For example, foo.com is considered to be part of *.foo.com. Wildcards are not allowed in IP domain specifications. If you specify an IP address, access will be granted only to SWF files loaded from that IP address using IP syntax (for example, http://65.57.83.12/flashmovie.swf), not those loaded using domain-name syntax. Flash Player does not perform DNS resolution. Here is an example policy file that permits access to Flash documents that originate from foo.com, friendOfFoo.com, *.foo.com, and 105.216.0.40, from a Flash document on foo.com: A policy file that contains no tags has the same effect as not having a policy on a server. About compatibility with previous Flash Player security models As a result of the security feature changes in Flash Player (see Flash Player security features on page 188), content that runs properly in Flash Player 6 or earlier may not run properly in Flash Player 7 or later. For example, in Flash Player 6, a SWF file that resides in www.macromedia.com could access data on a server located at data.macromedia.com. That is, Flash Player 6 allowed a SWF file from one domain to load data from a similar domain. In Flash Player 7 and later, if a version 6 (or earlier) SWF file attempts to load data from a server that resides in another domain, and that server doesn t provide a policy file that allows access from that SWF file s domain, then the Macromedia Flash Player Settings dialog box appears. The dialog box asks the user to allow or deny the cross-domain data access. If the user clicks Allow, the SWF file is permitted to access the requested data; if the user clicks Deny, the SWF file is not allowed to access the requested data. To prevent this dialog box from appearing, create a security policy file on the server providing the data. For more information, see About allowing cross-domain data loading on page 190. Flash Player security features 191
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

About allowing HTTP to HTTPS protocol access between (1 on 1 web hosting)

Tuesday, October 30th, 2007

About allowing HTTP to HTTPS protocol access between SWF files As discussed in the previous section, you must use an allowDomain handler or method to permit a SWF file in one domain to be accessed by a SWF file in another domain. However, if the SWF being accessed is hosted at a site that uses a secure protocol (HTTPS), the allowDomain handler or method doesn t permit access from a SWF file hosted at a site that uses an insecure protocol. To permit such access, you must use the LocalConnection.allowInsecure Domain() or System.security.allowInsecureDomain() statements. For example, if the SWF file at https://www.someSite.com/data.swf must allow access by a SWF file at http://www.someSite.com, the following code added to data.swf allows such access: // Within data.swf System.security.allowInsecureDomain(”www.someSite.com”); my_lc.allowInsecureDomain = function(sendingDomain) { return(sendingDomain==”www.someSite.com”); } About allowing cross-domain data loading A Flash document can load data from an external source by using one of the following data loading calls: XML.load(), XML.sendAndLoad(), LoadVars.load(), LoadVars.sendAndLoad(), loadVariables(), loadVariablesNum(). Also, a SWF file can import runtime shared libraries, or assets defined in another SWF file, at runtime. By default, the data or SWF media, in the case of runtime shared libraries, must reside in the same domain as the SWF that is loading that external data or media. To make data and assets in runtime shared libraries available to SWF files in different domains, use a cross-domain policy file. A cross-domain policy file is an XML file that provides a way for the server to indicate that its data and documents are available to SWF files served from certain domains, or from all domains. Any SWF file that is served from a domain specified by the server s policy file will be permitted to access data or assets from that server. When a Flash document attempts to access data from another domain, Flash Player automatically attempts to load a policy file from that domain. If the domain of the Flash document that is attempting to access the data is included in the policy file, the data is automatically accessible. Policy files must be named crossdomain.xml and reside at the root directory of the server that is serving the data. Policy files function only on servers that communicate over HTTP, HTTPS, or FTP. The policy file is specific to the port and protocol of the server where it resides. For example, a policy file located at https://www.macromedia.com:8080/crossdomain.xml will apply only to data loading calls made to www.macromedia.com over HTTPS at port 8080. An exception to this rule is the use of an XMLSocket object to connect to a socket server in another domain. In that case, an HTTP server running on port 80 in the same domain as the socket server must provide the policy file for the method call. 190 Chapter 10: Working with External Data
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.

For information on how to permit a SWF (Web hosting company)

Tuesday, October 30th, 2007

For information on how to permit a SWF file served from one domain to access data, objects, or variables from SWF files that are served from another domain, see About allowing data access between cross-domain SWF files on page 189. For information on how to permit a SWF file served from a secure (HTTPS) protocol to access data, objects, or variables from SWF files that are served from insecure protocols, see About allowing HTTP to HTTPS protocol access between SWF files on page 190. For information on how to permit a SWF file served from one domain to load data (using loadVariables(), for example) from another domain, see About allowing cross-domain data loading on page 190. For information about how these security changes affect content authored in Flash MX and earlier, see About compatibility with previous Flash Player security models on page 191. About allowing data access between cross-domain SWF files One SWF file can load another SWF file from any location on the Internet. However, in order for the two SWF files to be able to access each other s data (variables and objects), the two files must originate from the same domain. By default, in Flash Player 7 and later, the two domains must match exactly in order for the two files to share data. However, a SWF file may grant access to SWF files served from specific domains by calling LocalConnection.allowDomain or System.security.allowDomain(). For example, suppose main.swf is served from www.macromedia.com. That SWF file then loads another SWF file (data.swf) from data.macromedia.com into a movie clip instance (target_mc). // In macromedia.swf target_mc.loadMovie(”http://data.macromedia.com/data.swf”); Furthermore, suppose that data.swf defines a method named getData() on its main Timeline. By default, main.swf cannot call the getData() method defined in data.swf once that file has loaded. This is because the two SWF files don t reside in the same domain. For example, the following method call in main.swf, once data.swf has loaded, will fail. // In macromedia.swf, after data.swf has loaded: target_mc.getData(); // This method call will fail However, data.swf may grant access to SWF files served from www.macromedia.com by using the LocalConnection.allowDomain handler or the System.security.allowDomain() method, depending on the type of access required. The following code, added to data.swf, allows a SWF file served from www.macromedia.com to access its variables and methods: // Within data.swf System.security.allowDomain(”www.macromedia.com”); my_lc.allowDomain = function(sendingDomain) { return(sendingDomain==”www.macromedia.com”); } Notice that allowDomain permits any SWF file in the allowed domain to script any other SWF file in the domain permitting the access, unless the SWF file being accessed is hosted on a site using a secure protocol (HTTPS). In this case, you must use allowInsecureDomain instead of allowDomain; see About allowing HTTP to HTTPS protocol access between SWF files below. For more information on domain-name matching, see Flash Player security features on page 188. Flash Player security features 189
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

There are two different technologies that enable (Web design careers) communication

Tuesday, October 30th, 2007

There are two different technologies that enable communication between the browser and Flash Player: LiveConnect (Netscape Navigator 3.0 or later on Windows 95/98/2000/NT or Power Macintosh) and ActiveX (Internet Explorer 3.0 and later on Windows 95/98/2000/NT). Although the techniques for scripting are similar for all browsers and languages, there are additional properties and events available for use with ActiveX controls. For more information, including a complete list of Flash Player scripting methods, use the keywords Flash method to search the Flash Support Center at www.macromedia.com/support/ flash. About using Flash JavaScript methods with Flash Player Flash Player 6 version 40 and later supports Flash JavaScript methods and FSCommand in Netscape 6.2 and later. Earlier versions do not support Flash JavaScript methods and FSCommand in Netscape 6.2 or later. For Netscape 6.2 and later, you do not need to set swLiveConnect to true. However, setting swLiveConnect to true has no adverse effects. Flash Player security features By default, Flash Player 7 and later prevents a SWF file served from one domain from accessing data, objects, or variables from SWF files that are served from different domains cannot access each other s objects and variables. In addition, content that is loaded through nonsecure (non- HTTPS) protocols cannot access content loaded through a secure (HTTPS) protocol, even when both are in exactly the same domain. For example, a SWF file located at http:// www.macromedia.com/main.swf cannot load data from https://www.macromedia.com/data.txt without explicit permission. Nor can a SWF file served from one domain load data (using loadVariables(), for example) from another domain. Identical numeric IP addresses are compatible. However, a domain name is not compatible with an IP address, even if the domain name resolves to the same IP address. The following table shows examples of compatible domains: www.macromedia.com www.macromedia.com data.macromedia.com data.macromedia.com 65.57.83.12 65.57.83.12 The following table shows examples of incompatible domains: www.macromedia.com data.macromedia.com macromedia.com www.macromedia.com www.macromedia.com macromedia.com 65.57.83.12 www.macromedia.com (even if this domain resolves to 65.57.83.12 ) www.macromedia.com 65.57.83.12 (even if www.macromedia.com resolves to this IP) 188 Chapter 10: Working with External Data
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

To use fscommand() to open a message box (My web site)

Monday, October 29th, 2007

To use fscommand() to open a message box from a SWF file in the HTML page through JavaScript: 1 In the HTML page that embeds the SWF file, add the following JavaScript code: function theMovie_DoFSCommand(command, args) { if (command == “messagebox”) { alert(args); } } If you publish your SWF file using the Flash with FSCommand template in the HTML Publish Settings dialog box, this code is inserted automatically. The SWF file s NAME and ID attributes will be the filename. For example, for the file myMovie.fla, the attributes would be set to myMovie. (For more information about publishing, see Publishing in Using Flash Help.) Alternatively, for Microsoft Internet Explorer applications, you can attach an event handler directly in the 2 In the Flash document, add the fscommand() function to a button, as shown in this example: on(press) { fscommand(”messagebox”, “This is a message box invoked from within Flash.”); } You can also use expressions for fscommand() and parameters, as in this example: fscommand(”messagebox”, “Hello, ” + name + “, welcome to our website!”) 3 Select File > Publish Preview > HTML to test the document. The fscommand() function can send messages to Macromedia Director that are interpreted by Lingo as strings, events, or executable Lingo code. If the message is a string or an event, you must write the Lingo code to receive it from the fscommand() function and carry out an action in Director. For more information, see the Director Support Center at www.macromedia.com/ support/director. In Visual Basic, Visual C++, and other programs that can host ActiveX controls, fscommand() sends a VB event with two strings that can be handled in the environment s programming language. For more information, use the keywords Flash method to search the Flash Support Center at www.macromedia.com/support/flash. About Flash Player methods You can use Flash Player methods to control a SWF file in Flash Player from web browser scripting languages such as JavaScript and VBScript. As with other methods, you can use Flash Player methods to send calls to SWF files from a scripting environment other than ActionScript. Each method has a name, and most methods take parameters. A parameter specifies a value that the method operates upon. The calculation performed by some methods returns a value that can be used by the scripting environment. Sending messages to and from Flash Player 187
Check Tomcat Web Hosting services for best quality webspace to host your web application.

Using fscommand() Use the fscommand() function to send (Hosting your own web site)

Monday, October 29th, 2007

Using fscommand() Use the fscommand() function to send a message to whichever program is hosting Flash Player. The fscommand() function has two parameters: command and arguments. To send a message to the stand-alone version of Flash Player, you must use predefined commands and arguments. For example, the following action sets the stand-alone player to scale the SWF file to the full monitor screen size when the button is released: on(release){ fscommand(”fullscreen”, “true”); } The following table shows the values you can specify for the command and arguments parameters of fscommand() to control a SWF file playing in the stand-alone player (including projectors): Command Arguments Purpose quit None Closes the projector. fullscreen true or false Specifying true sets Flash Player to full-screen mode. Specifying false returns the player to normal menu view. allowscale true or false Specifying false sets the player so that the SWF file is always drawn at its original size and never scaled. Specifying true forces the SWF file to scale to 100% of the player. showmenu true or false Specifying true enables the full set of context menu items. Specifying false dims all the context menu items except Settings and About Flash Player. exec Path to application Executes an application from within the projector. To use fscommand() to send a message to a scripting language such as JavaScript in a web browser, you can pass any two parameters in the command and arguments parameters. These parameters can be strings or expressions and will be used in a JavaScript function that catches, or handles, the fscommand() function. An fscommand() function invokes the JavaScript function moviename_DoFSCommand in the HTML page that embeds the SWF file, where moviename is the name of Flash Player as assigned by the NAME attribute of the EMBED tag or the ID attribute of the OBJECT tag. If Flash Player is assigned the name myMovie, the JavaScript function invoked is myMovie_DoFSCommand. 186 Chapter 10: Working with External Data
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.

You can use the connect() and send() methods (Web site hosting)

Sunday, October 28th, 2007

You can use the connect() and send() methods of the XMLSocket class to transfer XML to and from a server over a socket connection. The connect() method establishes a socket connection with a web server port. The send() method passes an XML object to the server specified in the socket connection. When you invoke the connect() method, Flash Player opens a TCP/IP connection to the server and keeps that connection open until one of the following happens: The close() method of the XMLSocket class is called. No more references to the XMLSocket object exist. Flash Player exits. The connection is broken (for example, the modem disconnects). The following example creates an XML socket connection and sends data from the XML object myXML. To understand the script, read the commented lines (indicated by the characters //): // Create a new XMLSocket object sock = new XMLSocket(); // Call its connect() method to establish a connection with port 1024 // of the server at the URL sock.connect(”http://www.myserver.com”, 1024); // Define a function to assign to the sock object that handles // the server s response. If the connection succeeds, send the // myXML object. If it fails, provide an error message in a text // field. function onSockConnect(success){ if (success){ sock.send(myXML); } else { msg=”There has been an error connecting to “+serverName; } } // Assign the onSockConnect() function to the onConnect property sock.onConnect = onSockConnect; For more information, see the XMLSocket class entry in Chapter 12, ActionScript Dictionary, on page 205. Sending messages to and from Flash Player To send messages from a SWF file to its host environment (for example, a web browser, a Macromedia Director movie, or the stand-alone Flash Player), you can use the fscommand() function. This function lets you extend your SWF file by using the capabilities of the host. For example, you could pass an fscommand() function to a JavaScript function in an HTML page that opens a new browser window with specific properties. To control a SWF in Flash Player from web browser scripting languages such as JavaScript, VBScript, and Microsoft JScript, you can use Flash Player methods functions that send messages from a host environment to the SWF. For example, you could have a link in an HTML page that sends your SWF file to a specific frame. Sending messages to and from Flash Player 185
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.

The onLoginReply() function is defined in the first (Web site hosting)

Sunday, October 28th, 2007

The onLoginReply() function is defined in the first frame of the SWF file. (To understand this script, read the commented lines.) function onLoginReply() { // Get the first XML element var e = this.firstChild; // If the first XML element is a LOGINREPLY element with // status OK, go to the portfolio screen. Otherwise, // go to the login failure screen and let the user try again. if (e.nodeName == “LOGINREPLY” && e.attributes.status == “OK”) { // Save the session ID for future communications with server sessionID = e.attributes.session; // Go to the portfolio viewing screen gotoAndStop(”portfolioView”); } else { // Login failed! Go to the login failure screen. gotoAndStop(”loginFailed”); } } The first line of this function, var e = this.firstChild, uses the keyword this to refer to the XML object loginReplyXML that has just been loaded with XML from the server. You can use this because onLoginReply() has been invoked as loginReplyXML.onLoad, so even though onLoginReply() appears to be a normal function, it actually behaves as a method of loginReplyXML. To send the user name and password as XML to the server and to load an XML response back into the SWF file, you can use the sendAndLoad() method, as shown here: // C. Send the LOGIN element to the server, // place the reply in loginReplyXML loginXML.sendAndLoad(”https://www.imexstocks.com/main.cgi”, loginReplyXML); Note: This design is only an example, and Macromedia can make no claims about the level of security it provides. If you are implementing a secure password-protected system, make sure you have a good understanding of network security. For more information, see Integrating XML and Flash in a Web Application at www.macromedia.com/support/flash/interactivity/xml/ and the XML class entry in Chapter 12, ActionScript Dictionary, on page 205. Using the XMLSocket class ActionScript provides a built-in XMLSocket class that allows you to open a continuous connection with a server. A socket connection allows the server to publish (or push ) information to the client as soon as that information is available. Without a continuous connection, the server must wait for an HTTP request. This open connection removes latency issues and is commonly used for real-time applications such as chats. The data is sent over the socket connection as one string and should be in XML format. You can use the XML class to structure the data. To create a socket connection, you must create a server-side application to wait for the socket connection request and send a response to the SWF file. This type of server-side application can be written in a programming language such as Java. 184 Chapter 10: Working with External Data
From our experience, we can recommend PHP5 Web Hosting services, if you need affordable webhost to host and run your web application.

Web hosting reseller - The server receives the XML, generates an XML

Saturday, October 27th, 2007

The server receives the XML, generates an XML response, and sends it back to the SWF file. If the password is accepted, the server responds with the following: This XML includes a SESSION attribute that contains a unique, randomly generated session ID, which will be used in all communications between the client and server for the rest of the session. If the password is rejected, the server responds with the following message: The LOGINREPLY XML node must load into a blank XML object in the SWF file. The following statement creates the XML object loginreplyXML to receive the XML node: // B. Construct an XML object to hold the server’s reply loginReplyXML = new XML(); loginReplyXML.onLoad = onLoginReply; The second statement assigns the onLoginReply() function to the loginReplyXML.onLoad handler. The LOGINREPLY XML element arrives asynchronously, much like the data from a loadVariables() function, and loads into the loginReplyXML object. When the data arrives, the onLoad handler of the loginReplyXML object is called. You must define the onLoginReply() function and assign it to the loginReplyXML.onLoad handler so that it can process the LOGINREPLY element. You must also assign the onLoginReply() function to the frame that contains the Submit button. Sending and loading variables to and from a remote source 183
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.