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
layer = stage.layer();
4
5
layer.rect(0, 0, 500, 300).fill("#FFFFFF 0.01");
6
7
var textObject = layer.text(70, 55, "This text will be redrawn on a stage each time, when the stage is resized. Check it by resizing the stage.");
8
textObject.style({fontSize: "18px", width: "600", textOverflow: "true", textWrap: "byLetter", height: "50"});
9
textObject.selectable(false);
10
11
var counter = 0;
12
13
stage.listen("stageresize", function(){
14
var w = stage.width()-300;
15
textObject.width(w);
16
var h = textObject.height();
17
if ((h<=100) && (w<600)) textObject.height(600/w);
18
if (w>600) textObject.height(100)
19
});