Create image object programmatically

373 views Asked by At

I would like to create an image object programmatically and stretch image to view's size, not image size. Here is my code. what is missing ?

var createButton = new SMF.UI.Image();
createButton.image = "answer.png";
createButton.top = 5;
createButton.width = 38;
createButton.height = 38;
createButton.left = 5;
createButton.onShow = function(e) {
alert("object created");
};
1

There are 1 answers

0
Doruk COŞKUN On BEST ANSWER

You can create a strecth type image with the codelines below;

var createButton = new SMF.UI.Image();

createButton.image = "answer.png";
createButton.top = 5;
createButton.width = 38;
createButton.height = 38;
createButton.left = 5;
createButton.imageFillType = SMF.UI.ImageFillType.stretch;
createButton.onShow = function(e) {
alert("object created");
};

You can check more info from : http://docs.smartface.io/?topic=html/M_SMF_UI_Image__ctor.htm

Smartface.io Team