April 2008
Beginner
350 pages
8h 21m
English
The HTML component will support the display of Adobe PDF only if the installed version is Acrobat Reader 8.1 or later. You can test for this by using the static pdfCapability property of the HTML class. The easiest way to confirm that a user can load PDF files into the HTML component is to test HTML.pdfCapability against the STATUS_OK static property of the HTMLPDFCapability class. Listing 15-12 shows a simple function that will check to see if the user has the correct version of Adobe Reader. If Reader is found, a sample PDF is loaded; if not, the user is shown the Adobe Reader download page. The results can be seen in Figures 15-9 and 15-10.
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="testPDFCapability()" width="825" height="625">
<mx:Script>
<![CDATA[
private function testPDFCapability():void{
if(HTML.pdfCapability== HTMLPDFCapability.STATUS_OK){
html.location="http://www.everythingflex.com/assets/pdfs/sample.pdf";
}else{
html.location="http://www.adobe.com/products/acrobat/readstep2.html";
}
}
]]>
</mx:Script>
<mx:HTML id="html" width="800" height="600"/>
</mx:WindowedApplication>
|
Read now
Unlock full access