Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Image Complete/load event possible?
Started by juampi_fs Dec 13 2016 07:32 AM

1 reply to this topic
image events lua loading
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

juampi_fs

[GLOBAL: userInfoPane.html]
juampi_fs
  • Observer

  • 1 posts
  • Corona SDK

Hi, i was wonder to know if there is a way to know when an image is totally loaded.
I have this code in main.lua
local widget = require( "widget" )






local function onSystemEvent( event )
if event.type == "applicationStart" then
initial = os.clock()




local myImage = display.newImage( "image.jpg" ,500,500)


final = os.clock()
time = final - initial; 


native.showAlert( " tiempo " , time )
end


end


Runtime:addEventListener( "system", onSystemEvent )

I want to measure how much time takes to load an image... but the output of my code are like 0,003 seg so I guess what it isnt the really time.

 

 



[TOPIC: post.html]
#2

ponywolf

[GLOBAL: userInfoPane.html]
ponywolf
  • Contributor

  • 268 posts
  • Corona SDK

An image will load before the next line of code is executed, that's how you can load an image and instantly begin to manipulate it.




[topic_controls]
[/topic_controls]