load_image_asynch - asynchronously load an image from a resource
VID, fail:BADID
load_image_asynch( resource, callback )
Sets up a new video object container and attempts to load and decode an image
from the specified resource.
- 1
- The new VID has its opacity set to 0, meaning that it will start
out hidden.
- 2
- The operation can be forced asynchronous by either doing an operation
which requires a stable state for the current context (e.g.
push/pop_video_context) or by explicitly calling image_pushasynch.
function load_image_asynch0()
vid = load_image_asynch("test.png", function(source, tbl)
if (tbl.kind == "loaded") then
resize_image(source, tbl.width, tbl.height);
warning("image loaded0);
elseif (tbl.kind == "load_failed") then
warning("couldn't load:" .. tbl.resource .. "0);
end);
show_image(vid);
end
function load_image_asynch0()
vid = load_image_asynch("test.png", load_image_asynch);
end
function load_image_asynch1()
vid = load_image_asynch("test.png", -1);
end
image_pushasynchload_image(3)