corona


adding objects to screen in corona sdk without defining x y coordinates? corona sdk


A very simple beginners question... I assume this must be possible....
How do you add objects to a screen in Corona (take simple standard widget items like buttons) in a way that they just appear below each other and so avoid having to give each item a "top" value that is relative to the top of the screen? Surely there is a way of doing this either automatically or referencing the previous object to place the next objects position?
I thought grouping items may assist with this but hasn't with my experiments so far.
You can use variables and information about other objects to define positions of buttons. Let's say you have an object, button1. You want another object, button2, to be 20 pixels above it.
button1.y = 45
print(button1.y)--You'll get 45.
button2.y = button1.y - 20--Remember that the origin (0,0) is at the top left. Subtracting 20 makes the object closer to the top.
print(button2.y)--You'll get 25.
X, Y coordinates can be defined by a combination of variables with mathematical operations. You can greatly speed up your code by defining many objects relative to one central object.
button2.x=button1.x
button2.y=button1.y+20
....
button3.x=button2.x+20
button3.y=button2.y+20
You can design this way, in this way you can set the relative position of the buttons.
I hope it will help you.

Related Links

How to parse JSON Data in Corona SDK [duplicate]
How to make an object change its look on collision with another object in corona sdk
Drop Down animation for Image on Tap
Sound is not working properly in Corona SDK
How can i properly align Arabic text using the Corona SDK?
Can we change physics body properties in runtime - corona sdk
How to slide pages in Corona SDK
Return Data on showwebpopup
How to pause game and display new layer in corona
Corona SDK pathToFile issue
How to integrate fortumo In-App purchase plugin to Corona Sdk game?
How to make the PNG's transparent region not be listened by the EventListener when a touch event happened?
Corona SDK - group with image rect, wrong reference point
CORONA SDK Physics that dont affect every sprite
corona storyboard dispatch event error
Web view Background trasparency

Categories

HOME
elasticsearch
class
angular-ui-grid
systemd
kivy
iverilog
android-emulator
greasemonkey
flurry
video-streaming
stored-procedures
static-analysis
selection
amazon-emr
mahout-recommender
salt-cloud
social-tables
exchange-server-2010
quartz.net
pdf.js
vuforia
data-collection
xdebug
clipboard
macromedia
php-5.3
pyspark-sql
sfml
bitbake
locks
publishing
rspec-rails
xmlunit
formsauthenticationticket
code-rally
extbase
google-now
task-parallel-library
flume-twitter
spongycastle
comm
test-data
rcharts
kendo-treeview
front-camera
hmmlearn
fitbit
email-injection
ndk-build
tsqlt
mathml
xcode8-beta4
powerpoint-2013
fdt
teensy
webgrind
cortana
lowercase
ora-04091
dnx50
replicaset
mobilefirst-server
alwayson
artisan
ampersand
actionpack
mxe
python-c-extension
sunos
nesper
jquery-mobile-flipswitch
loginview
angular-ui-select
osascript
rpg
git-reset
stripe.net
commenting
thruway
cidr
cpu-time
sly-scroller
notin
oembed
handshake
gitx
websphere-6.1
system-information
server-name
struts2-s2hibernate
flymake
zend-server-ce
groovy-console
filelock
qt-mobility
tessellation
tabbarcontroller
rational-unified-process
database-cloning
isapi-redirect
chronic

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App