HTMLcopy
1
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
var stage = acgraph.create('container');
2
3
var textObject = stage.text(70, 55, 'Click on this TEXT');
4
textObject.style({fontStyle: 'italic', fontSize: '18px', color: '#2196F3', hAlign: 'center'});
5
6
var counter = 0;
7
8
acgraph.events.listen(textObject, 'click', function (e) {
9
counter++;
10
textObject.text('You clicked ' + counter + ' times. ' + 'Click again');
11
});
12
13
acgraph.events.listen(textObject, 'mousemove', function (e) {
14
// Prevent default event (try to select text).
15
e.preventDefault();
16
});