-
Notifications
You must be signed in to change notification settings - Fork 34
/
Main.hx
54 lines (48 loc) · 1.07 KB
/
Main.hx
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
/*
* Cocktail, HTML rendering engine
* http://haxe.org/com/libs/cocktail
*
* Copyright (c) Silex Labs
* Cocktail is available under the MIT license
* http://www.silexlabs.org/labs/cocktail-licensing/
*/
import js.Lib;
import js.Dom;
/**
* Getting Started with cocktail
*
* @author Raphael Harmel
* @date 2012-08-13
*/
class Main
{
/**
* Constructor
*/
public function new()
{
// get the image node
var image:Image = cast Lib.document.getElementById("icon");
// create interactivity
image.onmousedown = onMouseDown;
image.onmouseup = onMouseUp;
}
/**
* Mouse Down callback. Changes the image to be displayed.
* @param event
*/
public static function onMouseDown(event:Event):Void
{
var image:Image = cast(event.target);
image.src = "assets/icone_haxe_blanche_ombre.png";
}
/**
* Mouse Up callback. Resets the image to be displayed and loads the dynamic data.
* @param event
*/
public static function onMouseUp(event:Event):Void
{
var image:Image = cast(event.target);
image.src = "assets/icone_cocktail_blanche_ombre.png";
}
}