Other Apollo features
Back to: Apollo Documentation home page
This topic includes information on other features added to the Apollo runtime. These are available from ActionScript and JavaScript in Apollo. Note that these are not available to SWF content running in the browser (in Flash Player).
| Contents |
|---|
The URLRequest class
The URLRequest class lets you define more than simply the URL string. You can define the following properties as well:
| Name | Effect |
|---|---|
| contentType | The MIME content type of any POST data. |
| data | An object containing data to be transmitted with the URL request. |
| followRedirects | Specifies whether redirects are to be followed (true) or not (false). This is only supported in the Apollo runtime. |
| manageCookies | Specifies whether the HTTP protocol stack should manage cookies for this request. This is only supported in the Apollo runtime. |
| method | Controls whether the HTTP form submission method is a GET or POST operation. |
| requestHeaders | The array of HTTP request headers to be appended to the HTTP request. |
| shouldAuthenticate | Specifies whether authentication requests should be handled (true or not (false) for this request. This is only supported in the Apollo runtime. |
| shouldCacheResponse | Specifies whether successful response data should be cached for this request. This is only supported in the Apollo runtime. |
| useCache | Specifies whether the local cache should be consulted before this URLRequest fetches data. This is only supported in the Apollo runtime. |
| userAgent | Specifies the user-agent string to be used in the HTTP request. |
Note that the URLRequest class in Apollo includes support for the following properties, which are not supported in SWF content running in Flash Player:
- followRedirects
- manageCookies
- shouldAuthenticate
- shouldCacheResponse
- useCache
These properties, which define certain aspects of loading and caching content, are not available to SWF content running in Flash Player, because the browser defines these aspects for SWF content running in the browser. For details of these objects, see the URLRequest class in the Apollo ActionScript 3.0 Language Reference.
Also note that content running in the Apollo application security domain can specify strings other than "GET" or "POST" as the method property.
Using Apollo URL schemes in URLRequest object URLs
You can also use the Apollo URL schemes when defining a URL for a URLRequest object:
- file: Use this to specify a path relative to the root of the file system. For example:
- file:///c:/Apollo Test/test.txt
- app-resource: Use this to specify a path relative to the root directory of the installed application (the directory that contains the application.xml file for the installed application). For example, the following path points to a test.log file in a logs subdirectory of the directory of the installed application:
- app-resource:/logs/test.log
- app-storage:/ Use this to specify a path relative to the application store directory. For each installed application, Apollo defines a unique application store directory, which is a useful place to store data specific to that application. For example, the following path points to a prefs.xml file in a settings subdirectory of the application store directory:
- app-storage:/settings/prefs.xml
You can use the schemes in addition to the schemes that the URLRequest class supports in Flash Player (such as http:</tt>).
You can use a URLRequest object that uses any of these URL schemes to define the URL request for a number of different objects, such as a FileStream or a Sound object. You can also use these schemes in HTML content running in Apollo; for example, you can use them in the src attribute of an img tag.
The URLStream class
The URLStream class provides low-level access to downloading data from URLs. In the Apollo runtime, the URLStream class includes a new event: httpResponseStatus. Unlike the httpStatus event, the httpResponseStatus event is delivered before any response data. The httpResponseStatus event (defined in the HTTPStatusEvent class) includes a responseURL property, which is the URL that the response was returned from, and a responseHeaders property, which is an array of URLRequestHeader objects representing the response headers that the response returned.
The LocalConnection class
The LocalConnection class enables communications between Apollo applications, as well as among Apollo applications and SWF content running in the browser.
The connect() method of the LocalConnection class uses a connectionName parameter to identify applications. In content running in the Apollo application security sandbox (content installed with the Apollo application), Apollo uses the string app# followed by the application ID for the Apollo application (defined in the application descriptor file) in place of the superdomain used by SWF content running in the browser. For example a connectionName for an application with the application ID com.example.apollo.MyApp, the connectionName resolves to "app#com.example.apollo.MyApp:connectionName".
The ByteArray class
The Apollo runtime includes two new methods in the ByteArray class: deflate() and inflate(). You can use these to decompress and compress data the byte array using the DEFLATE and FLATE compression algorithm. For example, you could use these to decompress data in a ZIP file.
Back to: Apollo Documentation home page