DYNAMIC CONTENT


Flash Player contains full support for all the ActionScript functions that allow the loading of dynamic data into the Flash movie at runtime. However, a few issues exist when developing dynamic Flash content for the Nokia 9200 Communicator Series.

Figure A.19. The Ringtone Generator allows the user to create custom ringtones and download them to the Nokia 9200 Communicator (created by James Rowley of ifdnrg.com).

graphics/apafig19.gif

Connected Versus Unconnected

If the Flash movie makes a request for data and the device is not currently connected, then the phone prompts the user to connect. While the dialog box is present and the phone connects, the ActionScript pauses until the data downloads. See the Network Connection Flow Diagram (see Figure A.20) for a chart on actions and events possible when using the Flash Player.

Figure A.20. Network connection flow diagram.

graphics/apafig20.gif

graphics/01icon12.gif

The connection dialog box may be disabled if the user chooses this Internet-settings option. If this occurs, the connection will proceed right away.


The user will be notified of the status of the connection via a small window. If the player is not able to connect, the user will also be notified.

Once the connection is made, the Flash Player keeps it open as long as necessary (see Figure A.20).

Domain Restrictions

When a Flash movie is loaded from the Internet to the player, all the usual data- and content-loading security and domain restrictions apply. However, if a movie is loaded from the file system, these restrictions do not apply.

Figure A.21. GridBlock Multiple player online game (created by Team SmartyPants.)

graphics/apafig21.gif

Bandwidth Considerations

Keep bandwidth considerations in mind when loading data from external locations. Only send data that is necessary for your movie. If you have to send large amounts of data, consider loading it in chunks so the movie appears to be more responsive to the user. Also consider using short variable names and XML tags.

For example, instead of:

 <firstName>Mike</firstName> 

try:

 <fn>Mike</fn> 

This shorter tag can help significantly reduce the amount of data that needs to be transferred.

Data Processing Considerations

After the data loads, the actual processing can be CPU-intensive and adversely affect the playback and performance of the Flash movie. If possible, try to process small chunks of data, as opposed to processing large amounts of data all at once.

Although the XML parsing in the Flash Player has been optimized for the Nokia 9200 Communicator series, parsing large amounts of XML data can still be processor-intensive. If all the data is not needed at once, consider making more frequent requests for smaller amounts of data. However, time spent loading the data from the network needs to balance against the added time required to load the data from an external source.

The Flash community has written an optimized ActionScript String object:

String.as This ActionScript library rewrites some of the built-in String functions, resulting in better performance. In particular, the String.split() method has a significant performance increase. You may download the String.as library from: http://chattyfig.figleaf.com/~bhall/code/string.as.

Device Detection

Client-side device detection through Flash is possible. It requires checking the Flash Player version number in ActionScript through the $version variable available on level0 of the movie.

For example:

 var playerVersion = _level0.$version;  trace(playerVersion) 

The player version for Flash Player on the Nokia 9200 Communicator is as follows:

NOK9200 5,0,95,0

graphics/01icon12.gif

The exact version may vary slightly. Check the Macromedia web site for any changes.


When detecting Flash Player on the Nokia 9200 Communicator, the first part of the version is the most important and reliable section. The second part is the specific version number of the player and could change depending on future releases.

This code detects the Flash Player for the Nokia 9200 Communicator series:

 var playerVersion = _level0.$version;  if(playerVersion.beginsWith ("NOK9200"))  {           //Player is on Nokia Communicator  }  else  {           //Player is not on Nokia Communicator  }  /*  *       This is a simple function added to the built in String object that checks  *       if a String begins with the string passed into the function.  */  String.prototype.beginsWith = function(s)  {           return(s == this.substring(0, s.length));  } 

You can use a stub movie that simply checks the Flash Player version and device that the movie is running on and then loads the appropriate movie.

Even though Flash movies can only be run through the Flash Player (and not a web browser on the Nokia 9200 Communicator) it is still possible to do server-side device detection. This step allows you to determine the type of device that the request is coming from, as well as which Flash movie to return.

When the Flash Player makes a request for a Flash movie, it sends the following HTTP_USER_AGENT value in the header of the request:

FlashPlayer/5.0 09/19/01

Retrieving this value on the server side, you can write middleware code that detects whether the request for a Flash movie is coming from a Nokia 9200 Communicator device. This detection basically lets the server send the appropriate content for the device. However, because new versions of the browser or operating system may be released in the future, the string above should only be used as a guide. Remember to always thoroughly test your detection scheme.

When the Flash Player makes a request for a movie, the middleware code that does the device detection must return a Flash movie to the player. The Flash Player for the Nokia 9200 Communicator series will not follow redirect requests.



Macromedia Flash Enabled. Flash Design and Development for Devices
Macromedia Flash Enabled. Flash Design and Development for Devices
ISBN: 735711771
EAN: N/A
Year: 2002
Pages: 178

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net