Quantcast
Channel: Adobe Community : Popular Discussions - Using Flash Builder
Viewing all articles
Browse latest Browse all 70427

URGENT! Alive PDF - export PDF file ("my computer" prompt to save the file, not create in browser)

$
0
0

Hi - I'm having issues with my code and I'm not an ActionScript coder by any means. I'm using Flash Builder 4. I've been able to figure out how to export to PNG and to XLS but PDF is really killing me.

Below is my code and it's not causing errors when I do the release build but the my button doesn't work to export to PDF.  I'm trying to create a PNG using the PNGEncoder and then push that out to PDF (when the PDF button is selected). I used some sample code and I've commented out parts that I didn't want to use or didn't seem to apply to my application. Unfortunately, I have a deadline of May 3rd on this and there is no one else in the office here to help me... hope someone out there can.

 

 

<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="650" width="850">    <mx:Script>        <![CDATA[            import mx.collections.ArrayCollection;                       import flash.events.Event;            import mx.events.DropdownEvent;            import mx.events.*;            import mx.graphics.codec.PNGEncoder;            import org.alivepdf.display.*;            import org.alivepdf.images.ColorSpace;            import org.alivepdf.fonts.*;            import org.alivepdf.layout.*;            import org.alivepdf.pdf.*;            import org.alivepdf.saving.*;            import mx.controls.Alert;                                  //PDF Export information            protected var pdf:PDF;                               protected function savePDF(event:MouseEvent): void {                pdf = new PDF(Orientation.LANDSCAPE, Unit.MM, Size.LETTER);                pdf.setDisplayMode(Display.FULL_WIDTH);                pdf.addPage();                //                var bd:BitmapData = new BitmapData(cChart.width,cChart.height);                bd.draw(cChart);                               var png:PNGEncoder = new PNGEncoder();                var ba:ByteArray = png.encode(bd);                //                //try {                pdf.addImageStream(ba, ColorSpace.DEVICE_RGB, new Resize ( Mode.FIT_TO_PAGE, Position.CENTERED ), 10, 10, 800, 800, 0, 1, "Normal", null);                //} catch (e:Error) {                //    trace("Error occurred!");                //    Alert.show(e,"");                //}                //myPDF.addImageStream(new jpgBytes() as ByteArray, ColorSpace.DEVICE_RGB, null, 0, 0, 500, 500, 0, 1, "Normal", null);                //imageBytes:ByteArray, colorSpace:String, resizeMode:Resize=null, x:Number=0, y:Number=0, width:Number=0, height:Number=0, rotation:Number=0, alpha:Number=1, blendMode:String="Normal", link:ILink=null):                               //pdf.setFont(FontFamily.ARIAL, Style.NORMAL, 12);                //pdf.addText("Grafico de Rata de Fallas", 100, 40); // title                //pdf.addImage(imprimirRata, 50, 50, 200, 150); // captured canvas with charts                //      pdf.addImage(leyendaImprimir, 50, 120, 20,20); // captured leyend of charts                               //pdf.addText("RTP Software. Modulo de Score Card.", 10, 200); // header of the document                //pdf.addText("Creado: " + new Date(), 180, 200); // Add the created date as a leyend or footer on document                //                var fr:FileReference = new FileReference();                fr.save(pdf.save(Method.LOCAL), "nep_piefy11.pdf");                //                               /*var fs:FileStream = new FileStream();                var file: File = File.desktopDirectory.resolvePath("nep_piefy11.pdf"); // Name of the file                fs.open(file, FileMode.WRITE);                fs.writeBytes(pdf.save(Method.LOCAL));                fs.close();*/                //Alert.show("El reporte ha sido generado", "Informacion"); // Confirmation message as a pop-up            }                                  //Pie Chart Creation information            [Bindable]            public var ds:ArrayCollection = sel;                       private function changeEvt(event:Event):void {                if(filterCombo.selectedItem == 'Select NEP') {ds = sel;}                if(filterCombo.selectedItem == 'Albemarle-Pamlico Estuary Program') {ds = nep1;}                if(filterCombo.selectedItem == 'Barataria-Terrebonne Estuary Program') {ds = nep2;}                if(filterCombo.selectedItem == 'Barnegat Bay Estuary Program') {ds = nep3;}                if(filterCombo.selectedItem == 'Buzzards Bay National Estuary Program') {ds = nep4;}                if(filterCombo.selectedItem == 'Casco Bay Estuary Partnership') {ds = nep5;}                if(filterCombo.selectedItem == 'Charlotte Harbor Estuary Program') {ds = nep6;}                if(filterCombo.selectedItem == 'Coastal Bend Bays and Estuaries Program') {ds = nep7;}                if(filterCombo.selectedItem == 'Delaware Estuary Program') {ds = nep8;}                if(filterCombo.selectedItem == 'Delaware Inland Bays Estuary Program') {ds = nep9;}                if(filterCombo.selectedItem == 'Galveston Bay Estuary Program') {ds = nep10;}                if(filterCombo.selectedItem == 'Indian River Lagoon NEP') {ds = nep11;}                if(filterCombo.selectedItem == 'Long Island Sound Study') {ds = nep12;}                if(filterCombo.selectedItem == 'Lower Columbia River Estuary') {ds = nep13;}                if(filterCombo.selectedItem == 'Maryland Coastal Bays Program') {ds = nep14;}                if(filterCombo.selectedItem == 'Massachusetts Bays NEP') {ds = nep15;}                if(filterCombo.selectedItem == 'Mobile Bay Estuary Program') {ds = nep16;}                if(filterCombo.selectedItem == 'Morro Bay Estuary Program') {ds = nep17;}                if(filterCombo.selectedItem == 'Narragansett Bay Estuary Program') {ds = nep18;}                if(filterCombo.selectedItem == 'New York-New Jersey Harbor Estuary Program') {ds = nep19;}                if(filterCombo.selectedItem == 'Peconic Estuary Program') {ds = nep20;}                if(filterCombo.selectedItem == 'Piscataqua Region Estuaries Partnership') {ds = nep21;}                if(filterCombo.selectedItem == 'Puget Sound Partnership') {ds = nep22;}                if(filterCombo.selectedItem == 'San Francisco Estuary Project') {ds = nep23;}                if(filterCombo.selectedItem == 'San Juan Bay NEP') {ds = nep24;}                if(filterCombo.selectedItem == 'Santa Monica Bay Restoration Project') {ds = nep25;}                if(filterCombo.selectedItem == 'Sarasota Bay Estuary Program') {ds = nep26;}                if(filterCombo.selectedItem == 'Tampa Bay Estuary Program') {ds = nep27;}                if(filterCombo.selectedItem == 'Tillamook Estuaries Partnership') {ds = nep28;}            }                       [Bindable]            private var sel:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 0.5},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 0},                { habtype: "Wetland", Acres: 0} ]);                       [Bindable]            private var nep1:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 778.44},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 0.45},                { habtype: "Estuarine Shoreline", Acres: 1276.30},                { habtype: "Instream", Acres: 1.0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0.75},                { habtype: "Upland", Acres: 779.74},                { habtype: "Wetland", Acres: 3268.31} ]);                       [Bindable]            private var nep2:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 0},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 7.25},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 0},                { habtype: "Wetland", Acres: 1185} ]);                       [Bindable]            private var nep3:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 0},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 35.21},                { habtype: "Upland", Acres: 852.57},                { habtype: "Wetland", Acres: 197.82} ]);                       [Bindable]            private var nep4:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 0},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 751.82},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 321.82},                { habtype: "Wetland", Acres: 157.35} ]);                       [Bindable]            private var nep5:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 217},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 0},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 324.5},                { habtype: "Wetland", Acres: 0} ]);                       [Bindable]            private var nep6:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 1268},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 50},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 61},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 809},                { habtype: "Wetland", Acres: 1690} ]);                       [Bindable]            private var nep7:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 0},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 0},                { habtype: "Wetland", Acres: 726} ]);                       [Bindable]            private var nep8:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 0.28},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 82},                { habtype: "Estuarine Shoreline", Acres: 0.14},                { habtype: "Instream", Acres: 2.3},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 643},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 501.9},                { habtype: "Upland", Acres: 148.71},                { habtype: "Wetland", Acres: 2586.02} ]);                       [Bindable]            private var nep9:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 26.21},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 37},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 27},                { habtype: "Wetland", Acres: 646} ]);                       [Bindable]            private var nep10:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 0},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 2868},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 0},                { habtype: "Wetland", Acres: 407.06} ]);                       [Bindable]            private var nep11:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 5},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 3},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 43},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 12910.5},                { habtype: "Wetland", Acres: 5026} ]);                       [Bindable]            private var nep12:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 67},                { habtype: "Beach/Dune", Acres: 21.95},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 0},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 120.72},                { habtype: "Wetland", Acres: 151.08} ]);                       [Bindable]            private var nep13:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 0},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 12},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 194},                { habtype: "Upland", Acres: 0},                { habtype: "Wetland", Acres: 200} ]);                       [Bindable]            private var nep14:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 58},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 153},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 494.3},                { habtype: "Wetland", Acres: 0} ]);                       [Bindable]            private var nep15:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 1313},                { habtype: "Estuarine Shoreline", Acres: 8},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 0},                { habtype: "Wetland", Acres: 543.8} ]);                       [Bindable]            private var nep16:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 40},                { habtype: "Estuarine Shoreline", Acres: 6.5},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 195},                { habtype: "Wetland", Acres: 85} ]);                       [Bindable]            private var nep17:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 1109.9},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 1.14},                { habtype: "Estuarine Shoreline", Acres: 0.28},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 0.71},                { habtype: "Wetland", Acres: 0} ]);                       [Bindable]            private var nep18:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 0},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 1099},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 0},                { habtype: "Wetland", Acres: 0} ]);                       [Bindable]            private var nep19:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 0},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 0},                { habtype: "Wetland", Acres: 101.3} ]);                       [Bindable]            private var nep20:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 98.72},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 17.99},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 106.13},                { habtype: "Wetland", Acres: 12.97} ]);                       [Bindable]            private var nep21:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 9},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 3},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 2},                { habtype: "Upland", Acres: 1451},                { habtype: "Wetland", Acres: 27} ]);                       [Bindable]            private var nep22:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 26},                { habtype: "Beach/Dune", Acres: 1.65},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 240.39},                { habtype: "Estuarine Shoreline", Acres: 314.97},                { habtype: "Instream", Acres: 505.87},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 1450.47},                { habtype: "Upland", Acres: 1176.7},                { habtype: "Wetland", Acres: 850.58} ]);                       [Bindable]            private var nep23:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 0},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 43.05},                { habtype: "Upland", Acres: 4519},                { habtype: "Wetland", Acres: 3271} ]);                       [Bindable]            private var nep24:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 1},                { habtype: "Coral Reef", Acres: 0.13},                { habtype: "Estuarine", Acres: 0},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 1},                { habtype: "Upland", Acres: 0},                { habtype: "Wetland", Acres: 10} ]);                       [Bindable]            private var nep25:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 1.6},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 7},                { habtype: "Riparian", Acres: 100},                { habtype: "Upland", Acres: 6.2},                { habtype: "Wetland", Acres: 0} ]);                       [Bindable]            private var nep26:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 5.5},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 4.5},                { habtype: "Estuarine Shoreline", Acres: 15},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 82},                { habtype: "Wetland", Acres: 40} ]);                       [Bindable]            private var nep27:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 0},                { habtype: "Beach/Dune", Acres: 5.1},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 23},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 4.8},                { habtype: "Mangrove", Acres: 3.5},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 0},                { habtype: "Upland", Acres: 1221},                { habtype: "Wetland", Acres: 17.4}]);                          [Bindable]            private var nep28:ArrayCollection = new ArrayCollection( [                { habtype: "Agriculture/Ranch Land", Acres: 67},                { habtype: "Beach/Dune", Acres: 0},                { habtype: "Coral Reef", Acres: 0},                { habtype: "Estuarine", Acres: 2},                { habtype: "Estuarine Shoreline", Acres: 0},                { habtype: "Instream", Acres: 0},                { habtype: "Island", Acres: 0},                { habtype: "Lake/Pond", Acres: 0},                { habtype: "Mangrove", Acres: 0},                { habtype: "Other", Acres: 0},                { habtype: "Riparian", Acres: 31.33},                { habtype: "Upland", Acres: 0},                { habtype: "Wetland", Acres: 74.24}]);                                                 private function displayAcres(data:Object, field:String, index:Number, percentValue:Number):String {                var temp:String= (" " + percentValue).substr(0,6);                return data.habtype + ": " + '\n ' + data.Acres + " Acres" + '\n ' + temp + "%";            }                       //Export to PNG information            private function saveImageAs(event:MouseEvent):void            {                var bd:BitmapData = new BitmapData(cChart.width,cChart.height);                bd.draw(cChart);                               var png:PNGEncoder = new PNGEncoder();                var ba:ByteArray = png.encode(bd);                var fr:FileReference = new FileReference();                fr.save(ba, "nepfy11-piechart.png");            }        ]]>    </mx:Script>       <!--mx:SeriesInterpolate id="chartChange" duration="2000" /-->    <mx:Panel id="cChart" title="2011 Habitat Efforts" width="825" height="600" chromeColor="#527EAC" layout="vertical" color="#FFFFFF" verticalGap="10" x="15" y="15">        <mx:HBox width="400" height="20">            <mx:ComboBox id="filterCombo" x="140" y="140" change="changeEvt(event)" color="#000000" >                <mx:String>Select NEP</mx:String>                <mx:String>Albemarle-Pamlico Estuary Program</mx:String>                <mx:String>Barataria-Terrebonne Estuary Program</mx:String>                <mx:String>Barnegat Bay Estuary Program</mx:String>                <mx:String>Buzzards Bay National Estuary Program</mx:String>                <mx:String>Casco Bay Estuary Partnership</mx:String>                <mx:String>Charlotte Harbor Estuary Program</mx:String>                <mx:String>Coastal Bend Bays and Estuaries Program</mx:String>                <mx:String>Delaware Estuary Program</mx:String>                <mx:String>Delaware Inland Bays Estuary Program</mx:String>                <mx:String>Galveston Bay Estuary Program</mx:String>                <mx:String>Indian River Lagoon NEP</mx:String>                <mx:String>Long Island Sound Study</mx:String>                <mx:String>Lower Columbia River Estuary</mx:String>                <mx:String>Maryland Coastal Bays Program</mx:String>                <mx:String>Massachusetts Bays NEP</mx:String>                <mx:String>Mobile Bay Estuary Program</mx:String>                <mx:String>Morro Bay Estuary Program</mx:String>                <mx:String>Narragansett Bay Estuary Program</mx:String>                <mx:String>New York-New Jersey Harbor Estuary Program</mx:String>                <mx:String>Peconic Estuary Program</mx:String>                <mx:String>Piscataqua Region Estuaries Partnership</mx:String>                <mx:String>Puget Sound Partnership</mx:String>                <mx:String>San Francisco Estuary Project</mx:String>                <mx:String>San Juan Bay NEP</mx:String>                <mx:String>Santa Monica Bay Restoration Project</mx:String>                <mx:String>Sarasota Bay Estuary Program</mx:String>                <mx:String>Tampa Bay Estuary Program</mx:String>                <mx:String>Tillamook Estuaries Partnership</mx:String>            </mx:ComboBox>        </mx:HBox>        <mx:HBox horizontalGap="20" width="822" height="535">            <mx:PieChart id="chart" showDataTips="true" dataProvider="{ds}" width="634"  height="534" paddingTop="10" fontSize="9" fontFamily="Arial" color="#000000" textAlign="left">                <mx:series>                    <mx:PieSeries id="seriesId" explodeRadius="0.06" nameField="habtype" labelPosition="callout" color="#000000" insideLabelSizeLimit="8" field="Acres" labelFunction="displayAcres">                    </mx:PieSeries>                </mx:series>            </mx:PieChart>            <mx:Legend dataProvider="{chart}" dropShadowVisible="true" width="150" color="#000000" height="350" chromeColor="#527EAC" borderColor="#527EAC" direction="vertical"/>                  </mx:HBox>    </mx:Panel>    <mx:Button x="734" y="623" label="Export Pie Chart" id="btnSnap" click="saveImageAs(event)"/>    <mx:Button x="444" y="623" label="PDF" click="savePDF(event)" /></mx:Application>

 

Thank you in advance,

Alison


Viewing all articles
Browse latest Browse all 70427

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>