Hi. ı want to write a function which can load many icons on the web at once. ı can load one icons from the web but when ı tried to load many images ı cannot set the positions of icons in recursive function. ıs there anybody can help me? Please
did you try to create a list of items to be downloaded and a generic function to download an image, then spawn this function with each of the images.
Apart from that, you will have to explain a bit better on what exactly are you after, because if you are wanting to download all the images from a web page, then you need to parse the source of the page and work on it to create that list of images.
There are examples of the http load request functions floating around the forum. When I last looked you had to queue up your requests and have a single function that would issue the load and handle the onComplete callback so that the next item in the queue could be loaded.
WhiteTree Games - Home, home on the web, where the bits and bytes they do play! #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
ın my node converter i want to change the type of icon from loader to stage element so that ı can put the screen recursionly. because in this way ı cannot arrange the position of icons like x +50 and y+50 every recursion
As @techdojo said, you need to queue your elements and load sequentially. And Event.COMPLETE and Event.ERROR should fetch the next element on the queue.
Comments
Apart from that, you will have to explain a bit better on what exactly are you after, because if you are wanting to download all the images from a web page, then you need to parse the source of the page and work on it to create that list of images.
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
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
local out = io.open("|T|birdmy.png", "wb")
out:write(event.data)
out:close()
local b = Bitmap.new(Texture.new("|T|birdmy.png"))
self = b
stage:addChild(self)
end
function Node:iconConverter()
load = self.icon
load:addEventListener(Event.COMPLETE, onComplete,self)
end
local loader = UrlLoader.new("http://www.designdownloader.com/item/pngs/twitterBird01/twitterBird01-20110816085910-00024.png")
ın my node converter i want to change the type of icon from loader to stage element so that ı can put the screen recursionly. because in this way ı cannot arrange the position of icons like x +50 and y+50 every recursion
As @techdojo said, you need to queue your elements and load sequentially. And Event.COMPLETE and Event.ERROR should fetch the next element on the queue.
You can look at the attached simple example.
Likes: vitalitymobile