A Flash movie must be embedded inside an HTML page to play on a Pocket PC device, even when using external applications to wrap your content such as custom standalone program. There currently is not a standalone Flash Player from Macromedia, but stand alone-like functionality is possible; we'll get into that later in the "Advanced Topics" section.
Internet Explorer for Pocket PC is HTML 3.2 compliant, with some minor exceptions. In most cases all HTML tags that are defined by this standard can be displayed in Internet Explorer for Pocket PC.
In general, try to avoid complex HTML when possible. It takes up processing time as well as causing scrolling and loss of screen real estate. If you're using frames, nested tables, and multiple instances of ActiveX controls, performance will be sluggish. Also, try to only use supported HTML to avoid unpredictable results.
When using Flash to create content for the Pocket PC, use variables as placeholders for Multilanguage support. This allows you to load in other languages as needed without re-authoring the Flash content. Use the supported character sets for the target device if mixing HTML and Flash. If the device doesn't support multiple languages but the project demands multilanguage support you can use Flash and allow the user to select preferred language by creating multiple versions of the content within Flash. For example, the device can be US/English-based, but the content and character sets can be Japanese (see Figure 2.38).
Figure 2.38. Multiple language support with Flash for the Pocket PC.
You could do this by using variables as placeholders for all of the content, and then using loadVariables to load the language specific data at runtime.
Flash can also provide the user with a graphical representation of requested content that's independent of the device. For instance, if deploying location-based information such as maps, use variables for the legend and corresponding information in the user's preferred language. This information can also be hard coded into the application in the native language of the user. To deliver exactly what the user wants in the preferred language is value-added personalization that will help make your application an intimate part of the user's life. Keeping the content separated from the design is also a good way to keep development costs and QA times down.
Embedding Your Flash Application into HTML for Pocket Internet Explorer
When putting Flash content on a Pocket PC, just as the desktop, you must provide specific tags in the HTML file so the content can be displayed.
The most important tag is the <Object> tag. The <Object> tag is used by Internet Explorer for Pocket PC to instantiate the ActiveX control (in this case Flash for the Pocket PC). When deploying to a desktop browser, you can use either OBJECT or EMBED tags (EMBED tags are used for Netscape based browsers). However, Internet Explorer for Pocket PC only supports the <Object> tag, and this <Embed> is not needed.
The following is an example of the typical code required to display a Flash 5 movie in the Flash Player 5 on Pocket PC:
<HTML> <HEAD> <TITLE>Your Ad Here</TITLE> </HEAD> <BODY bgcolor="#FFFF00" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <OBJECT class WIDTH="240" HEIGHT="240"> <PARAM NAME=movie VALUE="youradhere.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFF00> </OBJECT> </OBJECT> </CENTER> </BODY> </HTML>
Note that the quality and bgcolor params are not necessary to view the file.
If you compare this example to the desktop version, you'll notice that the code base attribute is not required because Pocket Internet Explorer will not download ActiveX controls that it doesn't have installed.
When creating content for the Pocket PC, it's sometimes a good idea and reduces file size to not include tags that you don't need in the HTML file, and thus reduce download time. But, there are sometimes more benefits than saving a few bites by allowing your content to run on multiple systems without modification.
There have been many times when content that developers have created for the Pocket PC has run on other systems such as Linux-based set-top boxes, Sony Direct TV boxes, Compaq home appliances, and more. This is all possible because the content, which was being tested, had all the necessary tags to run on multiple browsers.
<HTML> <HEAD> <TITLE>Your Ad Here</TITLE> </HEAD> <BODY bgcolor="#FFFF00" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <CENTER> <OBJECT class codebase="http:// download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab# version=5,0,0,0" ID=PocketPC WIDTH=240 HEIGHT=240> <PARAM NAME=movie VALUE="youradhere.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFF00> <EMBED src="/books/2/36/1/html/2/youradhere.swf" quality=high bgcolor=#FFFF00 WIDTH=240 HEIGHT=255 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http:// www.macromedia.com/shockwave/download/index.cgi?P1_Prod_ Version=ShockwaveFlash"></EMBED> </OBJECT> </CENTER> </BODY> </HTML>
Enclosed between <Object> and </Object>, is the required tag <Param name="movie" value="youradhere.swf"> where "youradhere.swf" should be the actual filename of the SWF movie in the same directory as the HTML file. Also, the margins have been set to zero and the movie is centered in the HTML page. As mentioned previously, do not use "%" when defining width and height in the HTML embed tag. There is one tag in the example that is optional, the ID tag. Back when the Flash 4 Player for Pocket PC was the only game in town the ID tag was needed. In some cases there still may be users using Flash 4 for the Pocket PC, so some developers still include the tag, provided their Flash content is Flash 4 based. The Flash Player 4 for Pocket PC will not play Flash 5 content, so see the "Version Detection" section of this chapter to detect what version the user has on his device. Adding the ID tag will not affect the playback of Flash movies in the Flash Player 5, and thus it is a good idea to include it.
Just as in the desktop player, other tags are available to influence the playback of the Flash movie.
<PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#000000>
Developers can also pass data into the Flash movie to be used with variables inside the Flash application through the HTML file, provided it follows the Flash variable format. For example:
<PARAM NAME=movie VALUE="youradhere.swf?mydata1=youradhere">
Using the Flash Player 5 for Pocket PC Templates
A developer should spend more time creating great applications and content and not toiling in the details of HTML tags. That said, we've created a series of HTML templates that you can use in the Flash authoring environment. To get the templates, visit Flashenabled.com/book and download the templates. Once downloaded, place the templates in one of the following directories on your system:
In the Publish Settings dialog box (File, Publish Settings, HTML tab) you can select the file in the Publish Settings (see Figure 2.39). It is called Pocket PC in the pull-down list.
Figure 2.39. The Pocket PC template in the Publish Settings dialog box.
This template should be used when your project requires the Flash movie to be 240x240, centered with zero borders. We've also included other templates for other case scenarios such as address bar up and full screen.
If you're manually publishing, choose the Pixels option to set the values of the WIDTH and HEIGHT in the HTML Publish Settings. To avoid undesirable results do not choose Percent.
If your project requires additional information to be included in the HTML file and you would like to automate that process, refer to the details on the HTML Publish Settings in the Flash manual and help documentation.
Copying Content to the Pocket PC: A Checklist
When copying content to the Pocket PC, be sure to do the following:
If enabling Pocket PC content to be viewed via a wireless connection on the Pocket PC, see the "Internet Explorer for Pocket PC" section of this chapter for more information.
You can set the HTML quality to any of the following: Low, High, Auto Low, Auto High, Medium, or Best (see Figure 2.40). The Quality Setting in the Publish area specifies the level of anti-aliasing, or smoothing, to be used during movie playback. The templates on Flashenabled.com/mobile are all set to High quality.
Figure 2.40. The Quality settings in the Flash Publish Settings.
Lower-quality settings often improve playback performance but they degrade the quality of the graphics and especially text. Always test the application on the devices to ensure the desired playback. Because anti-aliasing requires a faster processor to smooth each frame of the movie before it is rendered on the viewer's screen, choosing a value based on speed or appearance is always a good idea:
Setting the _highquality property to true in ActionScript will not force the player to Best mode because the highest possible quality is Medium. The default value for quality is Medium if this attribute is omitted.
Most developers use Auto High for their Flash Pocket PC applications; that way a desktop system will play the content at the best possible quality, as will the device.