PDA

View Full Version : Getting info from a Global


Bruce
06-10-2005, 09:01 PM
Attempting to load an image from a file that a global function finds:


function GetCityInfo(cityname)
--Remove the Button text from the end of the button name
local strCityName = String.Replace(cityname, " Button", "", false);
-- Check to see if a text file exists within that folder
local bCityFound = File.Find("AutoPlay\\citys\\"..strCityName, strCityName..".txt", false, false, nil);
-- If it exists then jump to the citys page and return the string with the City Name
if bCityFound then
--Page.Jump("citys");
return strCityName, "citys";
else
return strCityName, "false";
end
end


Now, I need to pull up a pic called citypic.png that’s in the folder that the global function had already found. Here’s what I attempted to use:


Image.Load("city_Image", "AutoPlay\\citys\\".. strCityName .."citypic.png");

I’m sure I jacked this up!

Bruce
06-10-2005, 11:42 PM
So does this:

Image.Load("city_Image", "AutoPlay\\citys\\".. strCityName .."citypic.png");

look correct? [sheepish grin]

Corey
06-11-2005, 12:46 AM
Well offhand if strCityName is a folder then maybe it should be

Image.Load("city_Image", "AutoPlay\\citys\\".. strCityName .."\\citypic.png");

Bruce
06-12-2005, 09:49 AM
Yep that was it! (\\) Thanks for your help Corey. Thanks Tigg.