It looks like you're new here. If you want to get involved, click one of these buttons!
results = Core.class(Sprite) function results:init(params) local screen = Bitmap.new(Texture.new("resources/images/opt_back.png")) self:addChild(screen) screen:setPosition(0,0) local txtY = 100 the = {} p = 2 local a = 1 mySize = table.getn(params) k=1 q = "" function onComplete2(event) q = event.data the[p] = TextField.new(nil, "hello") the[p]:setPosition(100,50 +a*50) the[p]:setTextColor(0x007B25) the[p]:setScaleX(3)the[p]:setScaleY(3) --the[p]:setText(params[k+1]) doesn't work - Because k+1 is out of index - params[k+1] is nil. print("k : " .. k) print(params[k+1]) --nil is printed. But params[k+1] should be name of the shopping mall. print ("q = " .. q ) --It is the loaded data of the mall which is obtained from its url stage:addChild(the[p]) a = a + 1 end while(k < mySize+1) do if (params[k] ==true) -- params[k] holds whether the related row is checked or not in checkboxes pages then p=k -- assign k to global variable p. p is used in function onComplete2. local loader2 = UrlLoader.new(params[k+2]) --params[k+2] holds the Url of each row which will be loaded loader2:addEventListener(Event.COMPLETE, onComplete2) end k = k+3 end print ("q3 = " .. q) ---... |
Comments
loader2:addEventListener(Event.COMPLETE, onComplete2,p)
Likes: rodri