In alert event function, does have "event.target"?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  --main.lua
  local things = {}
  local object = require("object");
  thing[1]  = object.new("detail1");
  thing[2]  = object.new("detail2");
  thing[3]  = object.new("detail3");
  ....
  
   --object.lua  
  function new(detail)
 
  local object = display.newImage(...);
  object.detail = detail;
  
  function onAlert( event)
    if "clicked" == event.action then
      local i = event.index
      if 1 == i then
          Save(object.detail); <---this is where problem is (object.detail is always be "detail3")
      end
    end
  end
 
  local function touchHandler(e)
    if(e.phase == "ended")then
      alert = native.showAlert( "Set new detail","Are you sure?",{"Yes","Cancel"},onAlert);
    end
    return true;
  end
  return object;
  end

Can you please post some plug and play code so someone might be able to run and test this, then provide assistance? :)

Peach

views:1279 update:2011/11/17 9:28:17
corona forums © 2003-2011