Okay, so this might seem like a weird question but let's suppose you've got a display group containing a load of display image objects but you don't know what the images are and so you want to iterate through them and pull out the image file names - is that possible? I have no problem looping through them but can't see any way of extracting the image file name from any given display image objects.
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
Get image file name for a display image object
I doubt you will be able to do that currently, however you could do something like this:
1 2 3 4 5 6 7 8 9 10 11 | local cachedNewImage = display.newImage display.newImage = function( filename, baseDir ) local image = cachedNewImage( filename, baseDir ) image.filename = filename return image end |
This worked for me:
_filename = "myFile.png" local foo = display.newImageRect(_filename, 120, 120) foo.myFileName = _filename print(foo.myFileName)
views:1459 update:2011/9/30 9:15:39
热门文章
GameCenter LeaderBoards and Achievements Enabled Through OpenFeint
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
相关文章
Unable to set headers with Async http network.request
Opinions on best way to handle resolutions
Find a key-word in a string, and replacing it with a button [SOLVED-ISH]
VersaTimer - timer/stopwatch utility (uses Widget API) - promo codes available
Butterfly Adventures
Anybody here a formal gamesalad user able to help me pass my gs title to lua?
New game Paper Golf now available in the App Store - promo codes inside
Where to store images?
Quick Question
Lua table expert out here?
Opinions on best way to handle resolutions
Find a key-word in a string, and replacing it with a button [SOLVED-ISH]
VersaTimer - timer/stopwatch utility (uses Widget API) - promo codes available
Butterfly Adventures
Anybody here a formal gamesalad user able to help me pass my gs title to lua?
New game Paper Golf now available in the App Store - promo codes inside
Where to store images?
Quick Question
Lua table expert out here?
corona forums © 2003-2011