The source code for the flash is available here. The widget was created with Macromedia Flash 8, so will require that version or higher to read and modify.
The flash itself is a one-frame 'animation', with several Action Script classes attached. The flash dynamically reads information from the remote feed provided from MapLight, although a test xml is included for testing purposes from a local server.
The file reads data from the query string, with the following variables expected:
- widget_title: the title to display as the title of the widget
- show_names: 'full' or 'last'; determines whether to display the full or last names (only) of the candidates
- show_party: 'show' or 'hide'; determines whether to display the first letter of the candidate's party
- show_bars: 'show' or 'hide'; determines whether to display the horizontal graph bars
- sort_by: 'amount', 'name', 'party_dem', 'party_rep'; how to sort the candidates
- candidates: a list of candidate codes (see the API for details)
- color_title: the color of the title, in the format of #FFFFFF or 0x000000
- color_candidates: the color for the candidate names
- color_amounts: if given, the color for the candidate amounts (defaults to color_candidates)
- color_bars_democrat: the color for democratic candidate bars
- color_bars_republican: the color for republican bars
- color_bars_independent: the color for the rest of the candidate bars
- color_background_top: the top color for the gradient background
- color_background_bottom: the bottom color for the gradient background
- code: the hash code to attach to the url on the logo link (used on our widget pages)
The following classes are provided:
- Bar.as: The code to change colors of the candidate bars
- Candidate.as: This creates the bar, sets its width, and sets candidate names & amounts
- candidate_xml_parser.as: This is the heart of the widget, which reads the xml document, parses it, and creates the appropriate candidate clips
- Gradient.as: This changes the gradient background
- Logo.as: This provides clicking functionality for the logo (allowing it to be more dynamic than the built-in buttons in flash)
- MoneyFormat.as: This formats money in $xx,yyy,zzz format
- Widget.as: This sets the colors for the various elements of the widget
Other files included:
- presidential-widget.fla: this is the main flash file
- financial-summaries.xml: this is a test xml file (see our API for format)
- presidential-widget.swf: a compiled flash widget so you can see it in action
- presidential-widget.html: a blank html page for testing
Please read through the rest of the documentation within the files themselves for more information. Feel free to contact us for any questions you might have about where to go from here!
Copyright© 2007 MAPLight.org
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Softwareâ€), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- Whenever data provided by MAPLight.org is displayed to the user, the Software must credit MAPLight.org and include a hyperlink to this URL: “http://www.maplight.orgâ€. This could be done, for example, by including the text “Data from MAPLight.org†or "Contribution data from MAPLight.org" or "Data courtesy MAPLight.org", with "MAPLight.org" hyperlinked.
- The software may not display the text "MAPLight.org" in green and may not display the MAPLight.org logo.
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS ISâ€, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| Attachment | Size |
|---|---|
| presidential-widget.zip | 45.59 KB |