| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:s="library://ns.adobe.com/flex/spark" |
| title="Airline"> |
| |
| <fx:Script> |
| <![CDATA[ |
| import mx.collections.ArrayList; |
| |
| /** |
| * Returns a set of semi real world airline data |
| */ |
| public function createAirlineItems(numItems:int):ArrayList { |
| var airlineNames:Array = ["Airline", "Airlines", "Airline International", "Sky Airlines", "Sky Express"]; |
| var fromAirportCodes:Array = ["SFO", "YVR", "OGG", "YLW", "LAX"]; |
| var toAirportCodes:Array = ["LAX", "SJC", "LAS", "NYY", "OHC"]; |
| var fromTimes:Array = ["09:00am", "11:30am", "12:00pm", "05:45pm", "11:00pm"]; |
| var toTimes:Array = ["11:00am", "01:38pm", "6:31pm", "10:12pm", "11:59pm"]; |
| |
| var tempArray:Array = new Array(numItems); |
| |
| for (var i:int = 0; i < numItems; i++){ |
| var newItem:Object = new Object(); |
| newItem.airline = airlineNames[i % 5]; |
| newItem.logo = "../../../../Assets/Images/redrect.jpg"; |
| newItem.from = fromAirportCodes[i % 5]; |
| newItem.to = toAirportCodes[i % 5]; |
| newItem.numConnections = i % 2; |
| newItem.departureTime = fromTimes[i % 5]; |
| newItem.arrivalTime = toTimes[i % 5]; |
| |
| newItem.price = "$" + Number(300 + i); |
| tempArray[i] = (newItem); |
| } |
| |
| return new ArrayList(tempArray); |
| } |
| |
| ]]> |
| </fx:Script> |
| |
| <s:List id="target" width="100%" height="100%" |
| dataProvider="{createAirlineItems(100)}" |
| itemRenderer="renderers.AirlineItemRenderer"> |
| </s:List> |
| |
| </s:View> |