Picker Wheel Values for displaying image

Got stuck trying to use the pickerwheel to load a specific image I want o display. 

Pickerwheel choice values = “X”,“Y”,“Z”   button event…display image “XYZ.jpg”

Everything prints out ok in the console, but i am unable to transform the values in to a filename.

…the noob is strong with this one!

Thanks!

Have you viewed the Corona Documentation, its a great resource:

https://docs.coronalabs.com/api/library/widget/newPickerWheel.html

Yeps, of course.

I don’t have any problems with the picker itself. I am not able to display an image who’s filename is composed of the picker wheel’s output… 

function button:tap (event)

local values = pickerWheel:getValues()

local AAA = values[1].value

local BBB = values[2].value

local CCC = values[3].value

print( AAA,BBB,CCC) <— works up to here

image:removeSelf()

image = nil

image = display.newImage ( button(AAA,BBB,CCC,".ipg" ))  <-- probably where i am fumbling…

image = display.newImage ( button(AAA,BBB,CCC,".ipg" ))  <-- probably where i am fumbling…

What does button() function do? Do you mean “.jpg” instead of “.ipg”?

You could pass file name to display.newImage like that

image = display.newImage ( file_name )  

Solved!

problem was syntax… i was trying to concatenate the values using " ," instead of " … "

Example:

filename = (AAA…BBB…CCC…".jpg")

image = display.newImage (filename) 

Thanks :slight_smile:

Have you viewed the Corona Documentation, its a great resource:

https://docs.coronalabs.com/api/library/widget/newPickerWheel.html

Yeps, of course.

I don’t have any problems with the picker itself. I am not able to display an image who’s filename is composed of the picker wheel’s output… 

function button:tap (event)

local values = pickerWheel:getValues()

local AAA = values[1].value

local BBB = values[2].value

local CCC = values[3].value

print( AAA,BBB,CCC) <— works up to here

image:removeSelf()

image = nil

image = display.newImage ( button(AAA,BBB,CCC,".ipg" ))  <-- probably where i am fumbling…

image = display.newImage ( button(AAA,BBB,CCC,".ipg" ))  <-- probably where i am fumbling…

What does button() function do? Do you mean “.jpg” instead of “.ipg”?

You could pass file name to display.newImage like that

image = display.newImage ( file_name )  

Solved!

problem was syntax… i was trying to concatenate the values using " ," instead of " … "

Example:

filename = (AAA…BBB…CCC…".jpg")

image = display.newImage (filename) 

Thanks :slight_smile: