Image slider on Smartface

79 Views Asked by At
1

There are 1 best solutions below

0
On

You can make image slider by using scrollview. This document help you to create it. Also you can see an image slider example if you download 'Smartface In Action' in App Store.

Here is the sample code:

var imageSlider = new SMF.UI.ScrollView({
        top : "10%",
        left : "10%",
        width : "80%",
        height : "60%",
        contentHeight : "200%",
        contentWidth : "100%",
        autoSize : true,
        layoutType : SMF.UI.LayoutType.linear,
        orientation : SMF.UI.Orientation.horizontal,
        enableHorizontalPaging : true,
        enableHorizontalScrolling : true,
        horizontalGap : "0dp",
        verticalGap : "0dp",
    });
Pages.Page1.add(imageSlider);
   function fillScrollView() {
    for (var i = 1; i <= 10; i++) {
        var image = new SMF.UI.Image({
                width : "80%",
                height : "30%",
                top : "5%",
                left : "5%",
                image : "myimage.png",
                multipleLine : false
            });
        imageSlider .add(image);
    }
}
fillScrollView();