Strange problem when compiling in CPM

I just grabbed a copy of CPM and I love it a lot, but one strange thing though.
When I build in Corona Simulator alone my project build and works just fine but when I added it to CPM and build it I get this error and it wont work?

Any ideas what it could be?
/David
Copyright © 2009-2010 A n s c a , I n c .
Version: 2.0.0
Build: 2011.268
The file sandbox for this project is located at the following folder:
(/Users/david/Library
/Application Support/Corona Simulator/3-6B7537CAF27E2FCFC94C4D8C0CB41D2E)

WARNING: Failed to find image(images/background.png)
Runtime error
…1HGkKXNH+WWf6ydHU3uW++++TI/TemporaryItems/3/main.lua:41: attempt to index local ‘b
ackgroundImg’ (a nil value)
stack traceback:
[C]: ?
…1HGkKXNH+WWf6ydHU3uW++++TI/TemporaryItems/3/main.lua:41: in main chunk

Runtime error: …1HGkKXNH+WWf6ydHU3uW++++TI/TemporaryItems/3/main.lua:41: attempt to index local ‘backgroundImg’ (
a nil value)
stack traceback:
[C]: ?
…1HGkKXNH+WWf6ydHU3uW++++TI/TemporaryItems/3/main.lua:41: in main chunk [import]uid: 34126 topic_id: 6335 reply_id: 306335[/import]

I got it to work now, don’t mind this post. [import]uid: 34126 topic_id: 6335 reply_id: 21890[/import]

Great, I love tech support that goes like that. :wink:

Jay [import]uid: 9440 topic_id: 6335 reply_id: 21894[/import]

I am having the exact same problem, how did you get it to work? [import]uid: 37867 topic_id: 6335 reply_id: 25461[/import]

Here is the code that doesn’t work when launched from CPM, works fine in simulator:
[lua]local physics = require (“physics”)
physics.start()

local floor = display.newImage(“ground.png”, 0, 800)
physics.addBody(floor, “static”)

local red_button = display.newImage(“red_button.png”, 324, 685)

– image loads and displays fine here
local ball = display.newImage(“ball.png”)
ball.x = math.ceil(red_button.x)
ball.y = math.ceil(red_button.y)

physics.addBody(ball)

function onButtonClick(event)
– error happens here
– WARNING: Failed to find image(ball.png)
local ball = display.newImage(“ball.png”, red_button.x, red_button.y)
end

red_button:addEventListener(“touch”, onButtonClick)[/lua] [import]uid: 37867 topic_id: 6335 reply_id: 25463[/import]

Send me a screenshot of your assets list (include the ball.png line) and I’ll tell you how to fix it.

(Can you the hear the confidence dripping from my voice?!)

Jay
[import]uid: 9440 topic_id: 6335 reply_id: 25465[/import]

Photobucket

If that doesn’t work it/s located here:
http://i128.photobucket.com/albums/p170/money8806/coronasn.png [import]uid: 37867 topic_id: 6335 reply_id: 25466[/import]

*gulp* Glad I didn’t bet money on it or anything. :wink:

Are you absolutely positive ball.png (spelled that way INCLUDING case) is at that location?

I haven’t done much testing with projects being on D: and CPM on C:, so not sure if that could be a problem or not. I’ll go poke at that and see what happens.

However…

If you confirm that the file is there, try this – hit the Launch button in CPM and wait to get the error from Corona Simulator. Then go to the Simulator and choose File > Relaunch and let me know if anything different happens (as in, it runs).

Jay [import]uid: 9440 topic_id: 6335 reply_id: 25467[/import]

The error occurs on touching the red_button. I know that the ball.png is correct because it loads the image outside of the event function. It only fails when red_button is touched and onButtonClick is fired.

When I relaunch the project in the simulator it works fine, oddly enough.

CPM is actually installed on D:, but Corona Simulator is on C: if that helps at all.

Thanks for your help. [import]uid: 37867 topic_id: 6335 reply_id: 25469[/import]

When I relaunch the project in the simulator it works fine, oddly enough.

Bummer, because it means I can’t help you – yet.

It appears to be a bug in the Windows version of Corona Simulator. When launched via the command line it doesn’t “see” at least some of the files until you relaunch the Simulator itself.

Right now the only way I can launch the Simulator with a project from CPM is via the command line, but that should be changing in the next release of Corona SDK. Ansca is putting in a way to tell the Simulator to load a give project, which means I won’t have to launch the Simulator each time, just tell it to (re)load the project.

What’s frustrating is that some projects work fine via the command line and some don’t. In fact, I never found any that didn’t work until after the Windows version of CPM was released (ain’t that always the way).

I’m hoping the new version of Corona SDK is released soon – I figure it can’t be too much longer. :slight_smile:

Thanks.

Jay
[import]uid: 9440 topic_id: 6335 reply_id: 25471[/import]

Yea I am looking into purchasing a new iMac as we speak.

Thanks for the help though at least now I can continue development. [import]uid: 37867 topic_id: 6335 reply_id: 25472[/import]

Love my iMac. It’s the way to go. :wink: [import]uid: 13859 topic_id: 6335 reply_id: 25642[/import]

Any news about this.
I have the same problem on mbp. :frowning:
basic file just try to put background in mainlua
files are all in place and named properly


Copyright © 2009-2011 A n s c a , I n c .
Version: 2.0.0
Build: 2011.591
The file sandbox for this project is located at the following folder:
(/Users/anakopric/Library/Application Support/Corona Simulator/3-9A05B5F1EECD5A5514A4C4CF699C0200)
WARNING: Failed to find image(a.jpg)


Please Help [import]uid: 73847 topic_id: 6335 reply_id: 48999[/import]

If this is on a Mac then I’m almost 100% positive it’s user error. *Almost* 100% positive, so it could still be my fault. :wink:

Can you see the image file a.jpg in the asset list of the project?

If yes, is it spelled exactly that way? (Upper/lowercase make a difference.)

If it’s shown in the asset list and spelled correctly, do you have an “alias” set for that file? (An alias changes the name when it’s launched.)

Jay
[import]uid: 9440 topic_id: 6335 reply_id: 49069[/import]

Complete Noob here, so probably it is user error.
Here is what I have done.

I have started completely new project
so all files are fresh
i have added 1 image to the subfolder images
image is retina wallpaper file form internet, jpeg ext.
and only line of code is to show that image as background

main.lua :

local background1=display.newImage(“images/background1.jpg”)

i have added image to the assets window by hand, no auto show there.

directory structure is like this:
Desktop \ CORONA X \ X2 \ images \ background1.jpg

[edit]
i have just tried to change d.s. to:
Desktop \ CORONA_X \ X2 \ images \ background1.jpg
no change
Also no aliases.

Same project is working fine when opened from Corona directly.

Please Help [import]uid: 73847 topic_id: 6335 reply_id: 49175[/import]

If you have a subfolder called images in your projects, and then go add an image to the folder on your hard drive, it does not exist in the project.

The subfolder you create in your project is not tied to the folder of the same name on your hard drive – well, it is if you drag and drop the folder into your project, but only the files that exist in the subfolder at that time are added as assets.

That is by design, although it will probably change in an upcoming version.

In CPM, double-click the images folder in the asset list – if background1.jpg doesn’t show up, drag it from the hard drive into the asset list (into the images folder). Now try launching CPM again.

If you *do* see background1.jpg inside that subfolder, take a screenshot of CPM (so I can see the project and the asset list) and send it to j at jawhye [com] and I’ll figure out what’s happening.

Jay
[import]uid: 9440 topic_id: 6335 reply_id: 49239[/import]

Sorry for no reply till now.
I was on biz trip.

Yes, all files are in their respective folders.
I can see files in asset list when I add them by hand.

I will make screen shots later tonight and post here.

here:

Image and video hosting by TinyPic

or like this:
http://i53.tinypic.com/ws1q36.png

Hope this helps [import]uid: 73847 topic_id: 6335 reply_id: 49911[/import]

Ah-ha! Screenshots are so handy. :slight_smile:

According to CPM you have your background1.jpg image at the same level as main.lua, but inside the code you say it’s down in a folder.

While the image *does* live on your hard drive down in a folder, CPM doesn’t care about that – it’s a feature. It allows you to use assets from any folder in any other project.

Two ways to fix this – change your code to take out the images/ part, or drag your images folder into the asset list. If you do that, all contents of the images folder AT THAT TIME will become assets of the project.

I hope that helps.

Jay
[import]uid: 9440 topic_id: 6335 reply_id: 50062[/import]

Dear Jay,

As usual You Always find a way to solve the problem, even if it is noob user generated.
Thank You for Your great understanding and support.
Best Regards [import]uid: 73847 topic_id: 6335 reply_id: 50414[/import]

Glad it’s figured out, but hopefully I can tweak CPM enough in future updates that nobody runs into that kind of problem.

Jay
[import]uid: 9440 topic_id: 6335 reply_id: 50539[/import]