02.02.2013 Views

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 20: Using <strong>Flash</strong> on a PocketPC<br />

Scroll bars<br />

Pocket Internet Explorer has two view settings. You can choose ‘Fit <strong>to</strong> Screen’ in which case<br />

a document is resized <strong>to</strong> fit in<strong>to</strong> the 240 width of the PPC. If ‘Fit <strong>to</strong> Screen’ is disabled then a<br />

document will have a default virtual size of 640 × 480 pixels. Consequently the bot<strong>to</strong>m scroll bar<br />

will always be on, which occupies 11 pixels above the Command bar. If this is the case and your<br />

user also has the Address bar active then the available screen height goes down from 320 <strong>to</strong> 234<br />

pixels. This makes the ideal size for a <strong>Flash</strong> movie that is viewed in PIE <strong>to</strong> be 240 × 234 pixels.<br />

This will be visible on all user setups.<br />

Server side detection<br />

More and more PPCs are capable of a direct connection <strong>to</strong> the web. So what do you do when you<br />

have multiple versions of your game available, one for the PPC and one for desk<strong>to</strong>p machines?<br />

The best option is <strong>to</strong> use a server side detection script. When Pocket Internet Explorer sends a<br />

request <strong>to</strong> your HTTP server, the following specific information is included in the HTTP request<br />

header:<br />

1 UA-pixels: {i.e. 240x320}<br />

2 UA-color: {mono2 | mono4 | color8 | color16 | color24 | color32}<br />

3 UA-OS: {Windows CE (POCKET PC) - Version x.x}<br />

4 UA-CPU = {}<br />

Listing 20.2<br />

Using the following server side JScript (ASP) lines you can create specially optimized pages as soon<br />

as a Pocket Internet Explorer attempts <strong>to</strong> access games from your site.<br />

1 // Check for Windows CE (Pocket PC, Palm-size PC,<br />

2 // Handheld PC, Handheld PC Pro)<br />

3 var strNav = naviga<strong>to</strong>r.userAgent;<br />

4 var isCE = strNav.indexOf("Windows CE");<br />

5 if(isCE > -1) {<br />

6 //add Windows CE specific code<br />

7 }else {<br />

8 //add code for other platforms<br />

9 }<br />

Listing 20.3<br />

1 ’Check for Pocket PC<br />

2 var isPPC = strNav.indexOf("240x320");<br />

3 if(isPPC > -1) {<br />

4 // add Pocket PC specific code<br />

321

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!