Frequently Asked Questions

Image Slider
Last Updated 2 years ago

ACTIVATE PLUGIN

Add this code to build.setting file

["plugin.imageslider"] = {
    publisherId = "com.dijitaladam"
}


PARAMETERS

images
Type: Table
You can load images from url or local directory.

startImage
Type: number
When slider opened, goes to # index of image

loadingText
Type: string

closeBtnImage
Type: string
If you set this parameter, close button will be shown on slider.

closeBtnX
Type: number
Set close button x axis.

closeBtnY
Type: number
Set close button y axis.

backgroundColor
Type: table {r,g,b}
Set background rgb color of slider. Default: {0,0,0}

width
Type: number
Set width of slider.

height
Type: number
Set height of slider.

x
Type: number
Set x axis of slider.

y
Type: number
Set x axis of slider.

autoMoveTime
Type: number(In miliseconds)
If you set, slider will auto slide.

animationSpeed
Type: number(In miliseconds)
Animation move speed of slide. Default: 400

mode
Type: string (cover, contain, stretch)
Set scale mode of images. Default: contain

minimumDragTolerance
Type: number
Default: 90

transition
Type: easing.* (Ref: https://docs.coronalabs.com/api/library/easing/index.html)
When slide move to another that sliding with animation. Default: easing.outExpo

clickCallBack
Type: function
Parameter: index
When user tap to any slide that triggers this callback function(index)

changeCallBack
Type: function
Parameter: index
When slide move to another that triggers this callback function(index)


METHODS

nextImage()

prevImage()


NOTE

On Android, you are trying to access images in system.ResourceDirectory. Please read the Gotcha section of: https://docs.coronalabs.com/api/library/system/ResourceDirectory.html

Next, to download images you need to have:

android =
{
usesPermissions =
{
"android.permission.INTERNET",
},
},
in your build.settings.

Next on iOS and MacOS you have to use https: only sites with network.* or include Apple's ATS requirements. See: https://docs.coronalabs.com/guide/hardware/appleATS/index.html

Note, you will need both an "iphone" table and a "macos" table.


FULL SAMPLE

local slider = require "plugin.imageslider"
local myImages={"images/imageSlider/1.jpg","images/imageSlider/2.jpg","http://www.resimyukleyin.net/images/2016/02/13/en-iyi-resim-ve-fotograf-format-donusturme-manset_640x360.jpg","http://www.resimyukleyin.net/images/2016/02/13/Lamborghini-Aventador-Resim.jpg","https://previews.123rf.com/images/ivantagan/ivantagan1505/ivantagan150500023/40613777-Wonderful-and-beautiful-underwater-world-with-corals-and-tropical-fish--Stock-Photo.jpg","http://visuall.net/wp-content/uploads/2011/10/00055-BoscoVerticale06.jpg"}

myClickCallBackFunction=function(index)
    native.showAlert("Click",index..". image clicked",{"Ok"})
end

myChangeCallBackFunction=function(index)
    print( "IMAGE CHANGED INDEX : "..index)
end

local imageSlider = slider:create({
    images=myImages,
    startImage=1,
    loadingText="Loading..",
    --transition=easing.outExpo
    --closeBtnImage="images/imageSlider/cancel.png",
    --closeBtnX=display.actualContentWidth-50,
    --closeBtnY=50,
    backgroundColor={0,0,0}, --RGB
    width=display.actualContentWidth,
    height=400,
    --x=500,
    y=200,
    --autoMoveTime=2000,
    --animationSpeed=1000, --400 Default
    mode="cover",--cover,contain,stretch
    minimumDragTolerance=5,
    clickCallBack=myClickCallBackFunction,
    changeCallBack=myChangeCallBackFunction
})

Please Wait!

Please wait... it will take a second!