print parameters

Hello all, 

Are there special parameters to print to the simulator console?  I have this example: 

local bgSky = display.newImageRect(“bgSky.png”, 1750, 1000)

bgSky.x = display.contentCenterX

bgSky.y = display.contentCenterY

local redRect = display.newRect( 650, 350, 250, 250)

redRect:setFillColor( 255, 0, 0)

print( “red rect touched” )

Nothing happens prints in the console when I touch the square, only when I relaunch then red rect touched appears in the console.  

I thought you just had to type print(“something”) and it would print, like when you do Hello World.

Appreciate any help, 

Thanks

You haven’t added a listener that is called when redRect is touched. You would put a print statement in there.

How would Corona know you want to do something when redRect is touched but not the sky? It doesn’t read your print statement and try and make sense of it - it just prints to log whenever asked. You asked it once, so it did it once.

Time to go back to basics and read the API documents.

Hi,

Specifically, you’ll need to get familiar with the Events and Listeners topics:

https://docs.coronalabs.com/guide/index.html#events-and-listeners

-dev

Great, 

Thanks for all the help, I really appreciate the link.

Have a good holiday weekend.

You haven’t added a listener that is called when redRect is touched. You would put a print statement in there.

How would Corona know you want to do something when redRect is touched but not the sky? It doesn’t read your print statement and try and make sense of it - it just prints to log whenever asked. You asked it once, so it did it once.

Time to go back to basics and read the API documents.

Hi,

Specifically, you’ll need to get familiar with the Events and Listeners topics:

https://docs.coronalabs.com/guide/index.html#events-and-listeners

-dev

Great, 

Thanks for all the help, I really appreciate the link.

Have a good holiday weekend.