Here's the sample code that I tried.
-- Sample code to test this issue
local function onMouseUp(event)
for i,j in pairs(event) do
print(i,j)
end
end
stage:addEventListener(Event.MOUSE_UP, onMouseUp) |
Now it tells me that one of the members of the event is "type" and has the value of "mouseUp"
I tried to dispatch a mouseUp event as
local evt = Event.new("mouseUp") -- Even tried it as Event.new(Event.MOUSE_UP)
for i,j in pairs(evt) do
print(i,j)
end
-- There is no "type", instead there is a "_type"
-- so, tried to manually fix that too
evt.type = "mouseUp"
stage:dispatchEvent(evt)
-- This does not work. Any ideas why? |
Comments
In your case something like this would work:
For some reason the code
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps