1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
| import fl.controls.List;
import fl.controls.TextArea;
import flash.events.Event;
import fl.data.DataProvider;
import fl.controls.SelectableList;
import fl.managers.StyleManager;
import flash.events.MouseEvent;
import flash.display.DisplayObjectContainer;
import flashx.textLayout.container.ContainerController;
import flash.events.TimerEvent;
import flash.utils.Timer;
import flash.display.MovieClip;
/*-- "constructeur_List" = List of vehicules which are selectable by click on the left list----------*/
var vehicule_List:List = new List();
vehicule_List.setSize(445, 355);
vehicule_List.move(55,195);
addChild(vehicule_List);
var vehicule:Array = [
{label:"Voitures"},
{label:"Avions"},
{label:"Camions"},
{label:"Helicoptères"},
];
vehicule_List.dataProvider = new DataProvider(vehicule);
/*-------------------------------------- to select constructeur avion list------------------------*/
vehicule_List.addEventListener(Event.CHANGE, gr_itemClick);
function gr_itemClick(event:Event):void {
switch (event.target.selectedItem.label)
{
case "Avions":
addChild(constructeur_A_List);
break;
}
}
/*// list constructeur avions*/
var constructeur_A_List:List = new List();
constructeur_A_List.setSize(165, 355);
constructeur_A_List.move(530,195);
var constructeur_A:Array = [
{label:"Boeing"},
{label:"Airbus"},
{label:"Bombardier"},
{label:"Mc Donnell Douglas"},
];
constructeur_A_List.dataProvider = new DataProvider(constructeur_A);
/*-------------------------------------------------------------------------------------------------*/
/*---to select or deselect constructeur avions ------------*/
var selected_constructeur_List:List = new List(); // creates the third list (empty)
selected_constructeur_List.setSize(165, 355); // size of the third list
selected_constructeur_List.move(800,195); // position of the thrid list on the screen
constructeur_A_List.addEventListener(Event.CHANGE, gr_hwClick); // permits to select and to remove an item from the second list and to place it into the third
function gr_hwClick(event:Event):void {
addChild(selected_constructeur_List);
selected_constructeur_List.addItem(event.target.selectedItem);
constructeur_A_List.removeItem(event.target.selectedItem);
}
selected_constructeur_List.addEventListener(Event.CHANGE, gr_hw_back_Click); // permits to select and to remove an item from the third list and to place it into the second
function gr_hw_back_Click(event:Event):void{
addChild(selected_constructeur_List);
constructeur_A_List.addItem(event.target.selectedItem);
selected_constructeur_List.removeItem(event.target.selectedItem);
}
/* ----------------------clock------------------*/
var time:Date = new Date();
var seconds = time.getSeconds()
var minutes = time.getMinutes()
var hours = time.getHours()
if (seconds<10){
seconds = "0" + seconds;
}
if (minutes<10){
minutes = "0" + minutes;
}
if (hours<10){
hours = "0" + hours
}
clock_text.text = hours + ":" + minutes + ":" + seconds; |
Partager