package carbadges;

import carbadges.BMW;
import carbadges.Chrysler;
import carbadges.Mitsubishi;
import carbadges.VW;
import javafx.scene.Group;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.Scene;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;

var bmw = BMW{};
var mitsubishi = Mitsubishi{};
var chrysler = Chrysler{};
var vw = VW{};

Stage {
	title: "Car Badges"
	scene: Scene {
		content: [

			Group {
				content: [
					Rectangle {
						width: 500,
						height: 500
						fill: Color.BLACK
					}

					HBox {
						spacing: 2
						content: [

							VBox {
								spacing: 2
								content: [
							bmw, mitsubishi
								] // VBox1 content
							} // VBox1

							VBox {
								spacing: 2
								content: [
							chrysler,vw
								] // VBox2 content
							} // VBox2
						] // HBox content
					} // HBox
				] // group content
				onMouseClicked: function( e: MouseEvent ):Void {
					play();
				}
			} // group
		] // scene content
	} // scene
} // stage
play();

function play() : Void {
	bmw.timeline.playFromStart();
	mitsubishi.timeline.playFromStart();
	chrysler.timeline.playFromStart();
	vw.timeline.playFromStart();
}