Merge remote-tracking branch 'gravitystorm/fix_stylesheets' into refactor
[potlatch2.git] / potlatch2.mxml
1 <?xml version="1.0" encoding="utf-8"?>
2 <mx:Application 
3         xmlns:mx="http://www.adobe.com/2006/mxml" 
4         xmlns:halcyon="net.systemeD.halcyon.*"
5         xmlns:potlatch2="net.systemeD.potlatch2.*"
6         layout="vertical"
7         horizontalScrollPolicy="off"
8         verticalScrollPolicy="off"
9         horizontalAlign="center" 
10         addedToStage="startInit()"
11         preloader="net.systemeD.potlatch2.Preloader">
12
13     <map:LocalizationMap xmlns:map="l10n.map.*" />
14
15         <mx:Style source="styles/Application.css"/>
16
17     <mx:Glow id="glowImage" duration="100" 
18         alphaFrom="0.3" alphaTo="1.0" 
19         blurXFrom="0.0" blurXTo="5.0" 
20         blurYFrom="0.0" blurYTo="5.0" 
21         color="0xFF8000"/>
22     <mx:Glow id="unglowImage" duration="100" 
23         alphaFrom="1.0" alphaTo="0.3" 
24         blurXFrom="5.0" blurXTo="0.0" 
25         blurYFrom="5.0" blurYTo="0.0" 
26         color="0xFF8000"/>
27     <mx:WipeLeft id="wipeOut" duration="250"/>
28     <mx:WipeRight id="wipeIn" duration="250"/>
29
30     <mx:ApplicationControlBar dock="true">
31         <mx:PopUpButton id="bgButton" label="Background" openAlways="true" styleName="appBarButton"
32             creationComplete="bgButton.popUp = new BackgroundSelector();"/>
33         <mx:PopUpButton id="styleButton" label="Map Style" openAlways="true" styleName="appBarButton"
34             creationComplete="styleButton.popUp = new StyleSelector();"/>
35                 <mx:PopUpMenuButton id="gpsButton" styleName="appBarButton"
36                     itemClick="if (event.index==0) { trackLoader.load(); } 
37                           else if (event.index==1) { new MyGpxDialog().init(); } 
38                                               else { mx.controls.Menu(gpsButton.popUp).selectedIndex=0; 
39                                                      mx.controls.Menu(gpsButton.popUp).selectedIndex=0; /* Yes, we do need to call it twice */
40                                                      theMap.removeLayerByName('GPS tracks'); }">
41                         <mx:dataProvider>
42                                 <mx:Array>
43                                         <mx:Object label="GPS data" id="gpsData" />
44                                         <mx:Object label="My tracks" id="myTracks" />
45                                         <mx:Object label="Clear" id="clearGps" />
46                                 </mx:Array>
47                         </mx:dataProvider>
48                 </mx:PopUpMenuButton>
49         <mx:Spacer width="100%"/>
50         <mx:Button id="undo" label="Undo" click="MainUndoStack.getGlobalStack().undo();" styleName="appBarButton"
51             enabled="{MainUndoStack.getGlobalStack().canUndo()}"
52             toolTip="{MainUndoStack.getGlobalStack().getUndoDescription() ? 'Undo '+MainUndoStack.getGlobalStack().getUndoDescription() : 'Undo last action'}" />
53         <mx:Button id="redo" label="Redo" click="MainUndoStack.getGlobalStack().redo();" styleName="appBarButton"
54             enabled="{MainUndoStack.getGlobalStack().canRedo()}"/>
55         <mx:Spacer width="100%"/>
56         <mx:Button id="helpButton" label="Help" click="new HelpDialog().init();" styleName="appBarButton" />
57         <mx:Button id="optionsButton" label="Options" click="new OptionsDialog().init();" styleName="appBarButton" />
58         <mx:Button label="Save" icon="@Embed('embedded/upload.svg')" disabledIcon="@Embed('embedded/upload_disabled.svg')" styleName="appBarButton"
59                         click="SaveManager.saveChanges(theMap.editableLayer.connection);" id="saveButton" enabled="false"/>
60     </mx:ApplicationControlBar>
61     
62     <mx:HDividedBox width="100%" height="100%">
63
64           <!-- Tag viewer -->
65           <potlatch2:TagViewer width="25%" height="100%" id="tagViewer"/>
66
67       <mx:Canvas width="75%" height="100%">
68         <mx:Canvas id="map_area" resize="onResizeMap()"
69             top="0" left="0" width="100%" height="100%" dragEnter="dragEnterHandler(event);" dragDrop="dragDropHandler(event);">
70         </mx:Canvas>
71         <mx:Image source="@Embed('embedded/zoomIn.svg')" right="3" top="3" click="theMap.zoomIn();"
72             rollOverEffect="glowImage" rollOutEffect="unglowImage" toolTip="{'Zoom in - currently z'+getScale()}" />
73         <mx:Image source="@Embed('embedded/zoomOut.svg')" right="3" top="20" click="theMap.zoomOut();"
74             rollOverEffect="glowImage" rollOutEffect="unglowImage" toolTip="{'Zoom out - currently z'+getScale()}" />
75         <mx:Image source="@Embed('embedded/search.svg')" right="3" top="40" click="new FindDialog().init();"
76             rollOverEffect="glowImage" rollOutEffect="unglowImage" toolTip="Find place" />
77         <mx:TextArea id="dataWorking" text="" right="20" top="3" disabledColor="black" backgroundDisabledColor="0xFFFFEA" height="18"
78             enabled="false" borderThickness="0"
79             showEffect="{wipeIn}" hideEffect="{wipeOut}"/>
80         <mx:TextArea id="coordsbox" left="0" top="0" disabledColor="black" backgroundDisabledColor="0xFFFFEA" height="33"
81             width="57" enabled="false" borderThickness="0" visible="false"/>
82
83     </mx:Canvas>
84
85     </mx:HDividedBox>
86
87         <mx:Script><![CDATA[
88                 import net.systemeD.halcyon.*;
89                 import net.systemeD.halcyon.connection.*;
90                 import net.systemeD.potlatch2.*;
91                 import net.systemeD.potlatch2.save.SaveManager;
92                 import net.systemeD.potlatch2.find.*;
93                 import net.systemeD.potlatch2.collections.*;
94                 import net.systemeD.potlatch2.controller.*;
95                 import net.systemeD.potlatch2.help.*;
96                 import net.systemeD.potlatch2.options.*;
97                 import net.systemeD.potlatch2.utils.*;
98         import net.systemeD.potlatch2.mygpx.*;
99                 import net.systemeD.controls.FloatingAlert;
100                 import mx.managers.PopUpManager;
101                 import flash.system.Security;
102                 import flash.net.*;
103                 import flash.events.MouseEvent;
104                 import flash.display.Sprite;
105                 import mx.core.IChildList;
106         import mx.containers.Canvas;
107                 import mx.core.Application;
108         import mx.events.DragEvent;
109         import mx.events.CloseEvent;
110         import mx.managers.DragManager;
111         import mx.core.DragSource;
112         import mx.controls.Alert;
113         import com.mindspace.l10n.events.LocaleEvent;
114
115         public var theMap:Map;
116         public var theController:EditController;
117                 public var yahoo:Yahoo;
118                 public var trackLoader:TrackLoader;
119                 public var toolbox:Toolbox;
120         public var bugLoader:BugLoader;
121         public var bikeShopLoader:BikeShopLoader;
122
123                 private var savecount:uint=0;
124                 private var loadcount:uint=0;
125
126         include "version.as";
127
128                 private function startInit():void {
129             /* For reasons that I don't yet understand, the en_US locale is the default and doesn't work at all. */
130             /* Change this to another locale (e.g. fr_FR) to see the differences. */
131             if (loaderInfo.parameters['locale']) {
132               dispatchEvent(new LocaleEvent(LocaleEvent.LOAD_LOCALE,loaderInfo.parameters['locale']));
133             }
134
135                         // Load font and don't do anything until that's done
136                         var loader:Loader = new Loader();
137                         loader.contentLoaderInfo.addEventListener(Event.COMPLETE, continueInit);
138                         loader.load(new URLRequest("FontLibrary.swf"));
139                 }
140                 
141                 private function continueInit(r:Event):void {
142                         // Set font
143                         var FontLibrary:Class = r.target.applicationDomain.getDefinition("FontLibrary") as Class;
144                         Font.registerFont(FontLibrary.DejaVu);
145
146                         Globals.vars.map_area = map_area;
147                         Globals.vars.root = map_area.rawChildren;                       // set up global reference to root level
148                         var _root:IChildList = map_area.rawChildren;            // convenient local shorthand
149                         Globals.vars.nocache = loaderInfo.parameters['nocache'] == 'true';
150                         Globals.vars.flashvars = loaderInfo.parameters;
151
152                         // populate sharedObject with loaderInfo parameters if supplied
153                         var obj:SharedObject = SharedObject.getLocal("user_state");
154                         var objChanged:Boolean = false;
155                         if (loaderInfo.parameters['tileurl']) {
156                                 obj.setProperty('background_url',loaderInfo.parameters['tileurl']); 
157                                 obj.setProperty('background_name','Custom'); 
158                                 objChanged=true;
159                         }
160                         if (loaderInfo.parameters['style']) { 
161                                 obj.setProperty('stylesheet_url',loaderInfo.parameters['style']);
162                                 obj.setProperty('stylesheet_name','Custom');
163                                 objChanged=true; 
164                         }
165                         if (objChanged) { obj.flush(); }
166
167                         // map backdrop object
168             var w:uint = map_area.width;
169             var h:uint = map_area.height;
170             var b:Sprite = new Sprite();
171             b.height=h; b.width=w;
172             b.graphics.beginFill(0xFFFFEA,100); 
173             b.graphics.drawRect(0,0,w,h); 
174             b.graphics.endFill();
175                         _root.addChild(b);
176
177                         // pass additional parameters to map
178                         var params:Object={}; var k:String;
179                         for (k in this.loaderInfo.parameters) params[k]=this.loaderInfo.parameters[k];
180                         for (k in SharedObject.getLocal('user_state').data) params[k]=SharedObject.getLocal('user_state').data[k];
181
182                         // Create map
183                         theMap=new Map();
184                         theMap.backdrop=b;
185             theMap.updateSize(w,h);
186                         theMap.addEventListener(MapEvent.SCALE, scaleHandler);
187
188                         yahoo=new Yahoo(theMap);
189                         yahoo.hide();
190                         _root.addChild(yahoo);
191                         _root.addChild(theMap);
192
193                         // Initialise stylesheets
194                         Stylesheets.instance().init();
195                         Stylesheets.instance().addEventListener(CollectionEvent.SELECT,
196                                 function(e:CollectionEvent):void { theMap.editableLayer.setStyle(String(e.data)); }
197                         );
198
199                         // Add core data layer
200                         var conn:Connection = new XMLConnection("Main", params['api'], params['policy'], params);
201             conn.addEventListener(Connection.LOAD_STARTED, onDataStart);
202             conn.addEventListener(Connection.LOAD_COMPLETED, onDataComplete);
203             conn.addEventListener(Connection.SAVE_STARTED, onDataStart);
204             conn.addEventListener(Connection.SAVE_COMPLETED, onDataComplete);
205             conn.addEventListener(Connection.DATA_DIRTY, onDataDirty);
206             conn.addEventListener(Connection.DATA_CLEAN, onDataClean);
207                         conn.addEventListener(MapEvent.ERROR, onMapError);
208                         conn.addEventListener(AttentionEvent.ATTENTION, onAttention);
209                         conn.addEventListener(AttentionEvent.ALERT, onAlert);
210                         theMap.addLayer(conn, Stylesheets.instance().selected, false, true);
211
212             // Auto-load vector backgrounds from config
213             theMap.addEventListener(MapEvent.INITIALISED, function(e:Event):void { VectorBackgrounds.instance().init(theMap); });
214
215                         // Set start position of map
216                         // ** FIXME: if lat/lon/zoom aren't supplied, we need to keep the map in a non-loading state 
217                         //           until the user has decided where to start editing (e.g. when the first GPX loads)
218                         theMap.init(params['lat'], params['lon'], params['zoom']);
219
220                         // add attribution/logo sprite
221                         var overlay:Sprite=new Sprite();
222                         var attribution:TextField=new TextField();
223                         attribution.width=220; attribution.height=300;
224                         attribution.multiline=true;
225                         attribution.wordWrap=true;
226                         attribution.selectable=false;
227                         attribution.defaultTextFormat=new TextFormat("_sans", 9, 0, false, false, false);
228                         overlay.addChild(attribution);
229                         var terms:TextField=new TextField();
230                         terms.width=200; terms.height=15;
231                         terms.selectable=false;
232                         terms.defaultTextFormat=new TextFormat("_sans", 9, 0, false, false, true);
233                         overlay.addChild(terms);
234                         _root.addChild(overlay);
235
236                         // mouse-up handler attached to stage, so the user can release outside the map
237                         stage.addEventListener(MouseEvent.MOUSE_UP, theMap.mouseUpHandler);
238                         Globals.vars.map_area.addEventListener(MouseEvent.MOUSE_MOVE, theMap.mouseMoveHandler);
239                         Globals.vars.map_area.addEventListener(MouseEvent.MOUSE_DOWN, theMap.mouseDownHandler);
240
241                         // initialise imagery
242                         theMap.tileset.blocks=[new RegExp("google","i")];       // hard-coded block on Google tiles
243                         theMap.tileset.setDimming(params['background_dim']    ==null ? true  : params['background_dim']);
244                         theMap.tileset.setSharpen(params['background_sharpen']==null ? false : params['background_sharpen']);
245                         Imagery.instance().init(theMap, overlay, yahoo);
246                         Imagery.instance().addEventListener(MapEvent.BUMP, bumpHandler);
247                         Imagery.instance().addEventListener(CollectionEvent.SELECT,
248                                 function(e:CollectionEvent):void { theMap.tileset.init(e.data, e.data!=''); }
249                         );
250
251                         // keyboard event attached to stage
252                         stage.addEventListener(KeyboardEvent.KEY_UP, theMap.keyUpHandler);
253             
254                         // mouse-position listener for co-ordinate display
255             theMap.addEventListener(MapEvent.MOUSE_MOVE, mouseoverHandler);
256
257                         // position toolbox
258                         toolbox=Toolbox(PopUpManager.createPopUp(this,Toolbox,false));
259                         toolbox.init(theController);
260                         toolbox.x=stage.stageWidth-toolbox.width-5;
261                         toolbox.y=stage.stageHeight-toolbox.height-5;
262
263                         // add debug field
264                         var t:TextField=new TextField();
265                         t.width=500; t.height=150; t.border=true;
266                         t.multiline=true;
267                         _root.addChild(t);
268                         Globals.vars.debug=t;
269             t.visible = loaderInfo.parameters["show_debug"] == 'true';
270                         Globals.vars.root=theMap;       // just for the addDebug function
271
272                         // create controller
273             theController = new EditController(theMap, tagViewer, toolbox);
274             theController.setActive();
275                         theController.addEventListener(AttentionEvent.ATTENTION, onAttention);
276                         theController.addEventListener(AttentionEvent.ALERT, onAlert);
277             
278             // set the access token from saved cookie
279             var tokenObject:SharedObject = SharedObject.getLocal("access_token");
280             conn.setAccessToken(tokenObject.data["oauth_token"], tokenObject.data["oauth_token_secret"]);
281
282             // Load any requested GPX track
283             if (loaderInfo.parameters['gpx']) {
284                 var id:Number = loaderInfo.parameters['gpx'];
285                 if (conn.hasAccessToken()) { 
286                     loadTrace(id);
287                 } else {
288                     SaveManager.ensureAccess(function ():void { loadTrace(id); }, conn);
289                 }
290             }
291
292                         // Load arbitrary GPX from provided URL
293                         if (loaderInfo.parameters['gpx_url']) {
294
295                 var gpx_url:String = loaderInfo.parameters['gpx_url'];
296
297                 var connection:Connection = new Connection(name, gpx_url, null, null);
298                 var gpx:GpxImporter=new GpxImporter(connection, theMap, [gpx_url],
299                                                 function(success:Boolean,message:String=null):void {
300                                                     if (!success) return;
301                                                     var paint:MapPaint = theMap.addLayer(connection, "stylesheets/gpx.css");
302                                                     paint.updateEntityUIs(false, false);
303                                                     dispatchEvent(new Event("layers_changed"));
304                                                 }, false);
305                         }
306
307                         // create GPS trackloader
308                         trackLoader=new TrackLoader(theMap,conn.apiBase);
309
310             // Force authentication on startup, if required
311             // force_auth == force => checks for access token, and displays OAuth panel if needed
312             var force_auth:String = loaderInfo.parameters["force_auth"];
313             if (!conn.hasAccessToken() && force_auth == 'force') {
314               SaveManager.ensureAccess(onAccessChecked, conn);
315             }
316
317             // show help dialog on startup, if required
318             // show_help == always => on every startup
319             // show_help == once => show on first startup only
320             var show_help:String = loaderInfo.parameters["show_help"];
321
322             if (show_help == 'always' || (show_help == 'once' && obj.data["help_shown"] != "true")) {
323               new HelpDialog().init();
324             }
325
326             // Check if Tiger highlighting should be enabled from saved object
327             Globals.vars.highlightTiger = obj.data['tiger_highlighted'];
328                 }
329                 
330                 public function onMapError(mapEvent:MapEvent):void {
331                         var buttons:uint=0;
332                         if (mapEvent.params.no) { trace("no is set"); }
333                         if (mapEvent.params.yes             ) buttons|=mx.controls.Alert.YES;
334                         if (mapEvent.params.no              ) buttons|=mx.controls.Alert.NO;
335                         if (mapEvent.params.cancel          ) buttons|=mx.controls.Alert.CANCEL;
336                         if (mapEvent.params.ok || buttons==0) buttons|=mx.controls.Alert.OK;
337                         trace("showing alert with "+buttons);
338                         Alert.show(mapEvent.params.message, 'Error', buttons, null, function(closeEvent:CloseEvent):void { 
339                                 switch (closeEvent.detail) {
340                                         case mx.controls.Alert.CANCEL:  mapEvent.params.cancel(); break; //fixme? this gets called if user presses escape, even if there's no cancel button.
341                                         case mx.controls.Alert.YES:             mapEvent.params.yes(); break;
342                                         case mx.controls.Alert.NO:              mapEvent.params.no(); break;
343                                         default:                                                if (mapEvent.params.ok) mapEvent.params.ok();
344                                 }
345                         });
346                 }
347
348                 /** Highlight an entity in response to an 'attention' event */
349
350                 public function onAttention(event:AttentionEvent):void {
351                         var entity:Entity=event.entity;
352                         if (entity is Relation) {
353                                 // If it's a relation, just bring up the editor panel
354                                 var panel:RelationEditorPanel = RelationEditorPanel(
355                                         PopUpManager.createPopUp(Application(Application.application), RelationEditorPanel, true));
356                                 panel.setRelation(entity as Relation);
357                                 PopUpManager.centerPopUp(panel);
358                                 return;
359                         }
360
361                         var lat:Number, lon:Number;
362                         var panTo:Boolean=true;
363                         if (entity is Way) {
364                                 // If it's a way, find if it's on-screen
365                                 for (var i:uint=0; i<Way(entity).length; i++) {
366                                         var node:Node=Way(entity).getNode(i)
367                                         if (node.within(theMap.edge_l,theMap.edge_r,theMap.edge_t,theMap.edge_b)) { panTo=false; }
368                                         lat=node.lat; lon=node.lon;
369                                 }
370                         } else if (entity is Node) {
371                                 // If it's a node, check if it's on-screen
372                                 if (entity.within(theMap.edge_l,theMap.edge_r,theMap.edge_t,theMap.edge_b)) { panTo=false; }
373                                 lat=Node(entity).lat; lon=Node(entity).lon;
374                         }
375                         // Pan if required, and select the object
376                         if (panTo) { theMap.moveMapFromLatLon(lat,lon); }
377                         theController.setState(theController.findStateForSelection([entity]));
378                 }
379
380                 /** Display floating warning in response to an 'alert' event */
381
382                 public function onAlert(event:AttentionEvent):void {
383                         var alert:FloatingAlert=new FloatingAlert(event.message);
384                         stage.addChild(alert);
385                 }
386
387         public function onResizeMap():void {
388             if ( theMap != null )
389                 theMap.updateSize(map_area.width, map_area.height);
390
391                         if (toolbox) {
392                                 toolbox.x=Math.min(toolbox.x,stage.stageWidth-toolbox.width-5);
393                                 toolbox.y=Math.min(toolbox.y,stage.stageHeight-toolbox.height-5);
394                         }
395         }
396                 private function bumpHandler(e:MapEvent):void {
397                         if (toolbox) {
398                                 toolbox.y=Math.min(toolbox.y,stage.stageHeight-toolbox.height-10-e.params.y);
399                         }
400                 }
401
402         private function mouseoverHandler(e:MapEvent):void {
403             if (coordsbox.visible) {
404                 coordsbox.text= Number(e.params.x).toFixed(5) + "\n " + Number(e.params.y).toFixed(5); // Not sure if 5 dp's really required.
405             }
406         }
407
408         private function onDataStart(event:Event):void {
409                         switch (event.type) {
410                                 case Connection.LOAD_STARTED:   loadcount++; break;
411                                 case Connection.SAVE_STARTED:   savecount++; break;
412                         }
413                         updateDataWorking();
414         }
415         private function onDataComplete(event:Event):void {
416                         switch (event.type) {
417                                 case Connection.LOAD_COMPLETED: loadcount--; break;
418                                 case Connection.SAVE_COMPLETED: savecount--; break;
419                         }
420             updateDataWorking();
421         }
422                 private function updateDataWorking():void {
423                         if (loadcount>0 && savecount>0) { dataWorking.text="Loading/saving..."; }
424                         else if (loadcount>0)           { dataWorking.text="Loading data..."; }
425                         else if (savecount>0)           { dataWorking.text="Saving data..."; }
426                         else                            { dataWorking.text=""; }
427                         dataWorking.visible=(dataWorking.text!="");
428                 }
429         private function onDataDirty(event:Event):void {
430                         saveButton.enabled=true;
431             if (ExternalInterface.available) {
432               ExternalInterface.call("markChanged", false);
433             }
434                 }
435                 private function onDataClean(event:Event):void {
436                         saveButton.enabled=false;
437             if (ExternalInterface.available) {
438               ExternalInterface.call("markChanged", true);
439             }
440                 }
441                 
442
443
444                 private function scaleHandler(event:MapEvent):void {
445                         dispatchEvent(new Event("rescale"));
446                 }
447                 
448                 [Bindable(event="rescale")]
449                 private function getScale():String {
450                         return String(theMap.scale);
451                 }
452
453         private function dragEnterHandler(event:DragEvent):void {
454             // Get the drop target component from the event object.
455             var dropTarget:Canvas=event.currentTarget as Canvas;
456             // Accept the drag only if the user is dragging poi with tags
457             if (event.dragSource.hasFormat('tags')) 
458             {
459                 DragManager.acceptDragDrop(dropTarget);
460             }
461         }
462         
463         private function dragDropHandler(event:DragEvent):void {
464                         // Deselect the dragged icon
465                         if (event.dragSource.dataForFormat('container')) {
466                                 event.dragSource.dataForFormat('container').selectedItem=-1;
467                         }
468
469                         // Get the tags
470             var tags:Array = event.dragSource.dataForFormat('tags') as Array;
471
472             // If you dnd quick enough, this exposes a flex bug and event.stageX/Y become negative.
473             // Take the mouse positions from a displayObject's stage for consistent results.
474             var mapLoc:Point = Globals.vars.root.globalToLocal(new Point(event.target.stage.mouseX, event.target.stage.mouseY));
475             var lat:Number = Globals.vars.root.coord2lat(mapLoc.y);
476             var lon:Number = Globals.vars.root.coord2lon(mapLoc.x);
477             
478             var createAction:CompositeUndoableAction = new CompositeUndoableAction("Create POI");
479             
480                         var conn:Connection = theMap.editableLayer.connection;
481             var node:Node = conn.createNode({}, lat, lon, createAction.push);
482             for each ( var tag:Object in tags ) {
483                 node.setTag(tag.k, tag.v, createAction.push);
484             }
485                         conn.registerPOI(node);
486                         MainUndoStack.getGlobalStack().addAction(createAction);
487             theController.setState(new SelectedPOINode(node));
488         }
489
490         /* Called when forcing an initial access token check. */
491         private function onAccessChecked():void {
492             // Floaty panel message "You now have access";
493         }
494
495         private function loadTrace(id:Number):void {
496             var conn:Connection = theMap.editableLayer.connection;
497             conn.addEventListener(Connection.TRACES_LOADED, function (e:Event):void {
498                 for each (var trace:Trace in conn.getTraces()) {
499                     if (trace.id == id) { trace.addToMap(); }
500                 }
501             });
502             conn.fetchUserTraces();
503         }
504
505         ]]></mx:Script>
506
507 </mx:Application>
508