Attempt to perform arithmetic on field 'xReference' (a nil value)

Hi,

I tried my level best to fix this issue, please let me know if some one can help to fix this issue.

Below is the function where I am getting error:

return function(parent, x, y, kind)

local self = display.newSprite(parent, spriteSheet, batInfo[kind])

self.tap = touchResponse

self:addEventListener(‘tap’, self)

self.Death = mobDied

self:addEventListener(‘Death’, self)

self:setReferencePoint(display.CenterRightReferencePoint)

self.xReference = self.xReference * 0.75

self.xScale, self.yScale = 2, 2

self.x, self.y = x, y

self.Flight = transition.to(self, {time=1500, onStart = flap, onComplete = clean, delta = true; x = display.contentWidth, y = - display.contentHeight})

return self

end

Regards,

Suru

Are you using Graphics v1 compatibility mode?

Yes. I have added

graphicsCompatibility = 1 

in config.lua

Without this I was getting error.

Regards,

Suru

Hi Suru,

Some properties (including .xReference) were removed in Graphics 2.0. You can see more details here:

http://docs.coronalabs.com/guide/graphics/migration_g20.html

Best regards,

Brent

Hi Brent,

Thanks for reply but I am not using Graphics 2.0. I am using 

graphicsCompatibility = 1 

Regards,

Suru

Hi Suru,

There may be some scoping issue. What happens if you use a simple case like this?

[lua]

local test = display.newRect( 0,0,20,20 )

test.xReference = 0

[/lua]

Are you using Graphics v1 compatibility mode?

Yes. I have added

graphicsCompatibility = 1 

in config.lua

Without this I was getting error.

Regards,

Suru

Hi Suru,

Some properties (including .xReference) were removed in Graphics 2.0. You can see more details here:

http://docs.coronalabs.com/guide/graphics/migration_g20.html

Best regards,

Brent

Hi Brent,

Thanks for reply but I am not using Graphics 2.0. I am using 

graphicsCompatibility = 1 

Regards,

Suru

Hi Suru,

There may be some scoping issue. What happens if you use a simple case like this?

[lua]

local test = display.newRect( 0,0,20,20 )

test.xReference = 0

[/lua]