0

我想知道是否可以从第二层获取对象的自定义属性。下面提供一个例子,比用文字解释更清楚。

objectA = display.newImage(...)
objectA.dmg = 100
objectA.firstBtn = display.newImage(...)
objectA.firstBtn.id = "firstBtn"
objectA.firstBtn:addEventListener("touch",touchHandler)

function touchHandler(event)
   -- I want to get the dmg of objectA
   -- I know that by calling event.target.id I can get "firstBtn" 
   -- but how do I get the dmg value like event.target.parent.dmg?
end

谢谢你。

4

1 回答 1

0

you cannot get the objectA.dmg in event.target even if you use event.target.parent you cannot get or access it. you can refer to this link you have similar question on why you can't access it

于 2013-08-05T13:42:10.890 回答