Images not being found in touch event

Hello everyone this is my first post.

I am trying to add an image in a touch event. When the even fires it says that the image cannot be found.

The image loads fine when it is added outside of the event.

Here is the code:
[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]

Any help here would be greatly appreciated! [import]uid: 37867 topic_id: 7244 reply_id: 307244[/import]

I turns out that this on only happening inside of CPM. When I run it in the simulator it works fine. [import]uid: 37867 topic_id: 7244 reply_id: 25462[/import]

Issue was resolved here http://developer.anscamobile.com/forum/2011/02/10/strange-problem-when-compiling-cpm#comment-25472 [import]uid: 37867 topic_id: 7244 reply_id: 25473[/import]