Gideros AceSlide object creates a sliding element to switch different objects. Great for providing and input to choose levels or packages in mobile games.

Here is a link to repository with Oop version of AceSlide which uses Gideros class system, I'm suggesting to use it instead of old AceSlide provided here.

You can navigate through objects by using provided function or allowing users to drag and drop to switch content.

Package contains Ace.Slide.lua and example Gideros application project.
 

Contents

Download

Example codes

--initialize slider
AceSlide.init({
	orientation = 'vertical',
	spacing = 100,
	parent = stage,
	speed = 5,
	unfocusedAlpha = 0.75,
	easing = nil,
	allowDrag = true,
	dragOffset = 10
})

--create 10 boxes
for i = 1, 10 do
	local box = Bitmap.new(Texture.new('images/crate.png'))
	box:setScale(2)
	AceSlide.add(box)
end

--display slider
AceSlide.show()

Example video

Video of module example app:

Method list

Constructor

Back to method list

Method name init(config);
Description Initialize AceSlide module
Input parameters

table config - lua table with configuration properties

  • string orientation - orientation of sliding, possible values horizontal and vertical (default: horizontal)
  • int spacing - space between elements in pixels (default: 100)
  • int speed - time in miliseconds to move for one pixel (default: 5)
  • double unfocusedAlpha - alpha value for unfocused items (default: 0.75)
  • bool allowDrag - allow switching elements by dragging (default: true)
  • int dragOffset - offset from start position of draging, when to switch elements (default: 10)
  • easing - easing function from easing.lua (default: no easing (linear))
  • object parent - where to add AceSlide (default: stage)
Example input
AceSlide.init({parent = group})

Add object

Back to method list

Method name add(elem, selected)
Description Add any object to slide
Input parameters

object elem - Gideros object, as Sprite, TextField, Bitmap, etc

bool selected - if provided as true, then this element will appear as currently visible/selected

Add button

Back to method list

Method name addButton(image, image_pressed, callback, selected)
Description Automatically creating Button object and add it to slide (requires button.lua)
Input parameters

string image - path to default image

string image_pressed - path to image when button is pressed

function callback - callback function for button's click event

bool selected - if provided as true, then this element will appear as currently visible/selected

Modify all elements

Back to method list

Method name applyToAll(callback)
Description Iterates through all elements and applies callback function to each of them. Better call it before calling show method, because all position calculations are done only once in show method
Input parameters

function callback - callback function which receives element previously provided to AceSlide

Show slider

Back to method list

Method name show()
Description Display AceSlide

Slide to specific element

Back to method list

Method name gotoItem(index)
Description Slide to item with specified index
Input parameters

int index - index of element in slider

Jump to specific element

Back to method list

Method name jumptoItem(index)
Description Jump to item with specified index
Input parameters

int index - index of element in slider

Next element

Back to method list

Method name nextItem()
Description Slide to next item

Previous element

Back to method list

Method name prevItem()
Description Slide to previous item

First element

Back to method list

Method name firstItem()
Description Slide to first item

Last element

Back to method list

Method name lastItem()
Description Slide to last item

Latest changes

  • 29.01.2012 - Some bug fixes with dragging and buttons