shinu.s

shinu.s's page

19
Dec

For setting the stroke width and stroke colour of vector objects (display.newRect, display.newRoundedRect, and display.newCircle) in Corona SDK, see the example given below,

local urRectangle = display.newRect(130, 110, 70, 70)
urRectangle:setFillColor(255, 255, 255) 

urRectangle:setStrokeColor(250, 130, 200)  --setting the stroke color
urRectangle.strokeWidth = 7 --setting the stroke width

19
Dec

For getting/changing the height of a display object in Corona,

For getting the height of a display object, syntax is

local var1 = urObj.height

For setting the height of a display object , syntax is

urObj.height = urValue

19
Dec

Different Reference Points available for Display Objects in Corona SDK,

display.CenterReferencePoint
display.TopLeftReferencePoint
display.TopCenterReferencePoint
display.TopRightReferencePoint
display.CenterRightReferencePoint
display.BottomRightReferencePoint
display.BottomCenterReferencePoint
display.BottomLeftReferencePoint
display.CenterLeftReferencePoint

Usage ->
urObj:setReferencePoint(display.CenterLeftReferencePoint);

05
Dec

For getting the number of audio channels available for playback in Corona, use the following code,

local result = audio.unreservedFreeChannels

05
Dec

For getting the number of audio channels that are currently in use, (playing/paused),

local result = audio.usedChannels

05
Dec

For getting the total number of audio channels in Corona…

local result = audio.totalChannels

audio.totalChannels returns the total number of audio channels.

05
Dec

For getting the current frame of a movieclip animation in corona,

oneVal = myAnim.currentFrame()

oneVal, contains the currentFrame number of the movieclip animation myAnim

24
Nov

For setting different drawing modes of physics engine while debugging in Corona,

physics.setDrawMode( “debug” ) — shows collision engine outlines only
physics.setDrawMode( “hybrid” ) — overlays collision outlines on normal Corona objects
physics.setDrawMode( “normal” ) — the default Corona renderer, with no collision outline

, , , , , ,

21
Nov

For adding a new button widget in Corona ,

local widget = require "widget"

    local onButtonEvent = function (event )
        if event.phase == "release" then
            print( "You pressed and released a button!" )
        end
    end

    local myButton = widget.newButton{
        id = "btn1",
        left = 100,
        top = 200,
        label = "Button",
        width = 150, height = 28,
        cornerRadius = 8,
        onEvent = onButtonEvent
    }

, ,

21
Nov

For creating a slider widget using corona sdk,

local widget = require "widget"
local sliderListener = function( event )
        local sliderObj = event.target
        print( "New value is: " .. event.target.value )
    end
local mySlider = widget.newSlider{
        width=150,
        callback=sliderListener
}

, , , , , ,