For this lab we focused on using the Adobe Flash Builder (4.6) to write scripts. The language used for all scripts was MXML.
Methods:
The most important step in the lab was done in the first steps of starting a new flex project. When a new Flex project is create a window is opened with three tabs: project location, server settings, and build paths.
The project location lets you name your project, designate a folder location, pick your application type, and your flex version. For this lab the 'web' application type and Flex version '4.6.0' were used. We left the server settings alone, but the 'build paths' tab was a crucial part of the lab. This was where we browsed our local network drive to retrieve the 'Flex API' library. Without this library the reference words in the code would have no meaning and the script would be useless. To add a library we clicked on the 'add SWC' button and browsed the local network for the folder. Once added the library appeared in the 'build path libaries' box, found in the 'library path' tab of the flex builder path window.
After the code was successfully written for each individual layer, the corresponding icon would appear in the outline menu in the lower left hand corner (default location) of the flex builder application.
The first script, shown in figure 1 below, was a map of population density for the world in a Web Mercator projection.
| Figure 1, script for world map of population density. |
The next script we created was a map of the united states with pop-up enabled features which were the result of the action script we wrote within the code block.
The last map created used a pre-existing script for South Carolina with mouse over pop-ups for various population statistics. To edit the script to our purposes a few things had to be changed. First off, every time 'south carolina' appeared in the code, it had to be changed to 'wisconsin.' Also, since it is a map divided by counties, that number had to be changed to accurately reflect the number of counties within Wisconsin, 72 of them. Finally the viewer extent had to be changed so the application would know to focus on Wisconsin and not South Carolina. To find the extent the following website was used (http://help.arcgis.com/en/webapps/flexviewer/extenthelper/flexviewer_extenthelper.html). This was done by zooming in the Wisconsin at the proper scale and recording the numbers which defined the extent of the current map's position and scale.
Problems:
I encountered a few problems while working on this lab. The smallest problem was a general coding error that evaded me for quite some time. The next two errors stemmed from the same problem.
While I was working on the lab I was too focused on the instructions and I didn't organize the folders how I normally would with separate file folders in a hierarchy pattern. I had finished most of the lab and came back to work on it the next morning. However, when I went to look for the script in my "lab 4" folder it was not there. It was only after I restarted the lab that I realized the file was in a "bin-debug" folder. I had looked here already, but when I went to run the script it ran in an "ant" form and did not produce a map online successfully. Another problem that came from this was when I tried to make a new flex project. I would add the Flex API library to the project, but it would not show up in the left hand menu of Adobe Flex Builder. I'm still not sure the reason for this and it was at this point that I decided to restart the lab. Although it was a drain on time I planned to use for other projects, I feel I learned the Flex project builder much better and I understood the process of adding a reference library to the point where I would remember to do that again without prior instruction to do so.
No comments:
Post a Comment