Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Hi,
in the background of my application the image change every 4 seconds .
If I stay in the same card, works well (Aren't exactly 4 seconds, but work.) If I go to another card and then return now start the problems, the pictures are running so syncopation and the image change every 1 or 2 seconds
Any hints?
global gImmagine
on preOpenCard
put 1113 into gImmagine
end preOpenCard
on openCard
send "aggiornaSfondo2"
end openCard
on aggiornaSfondo2
put gImmagine + 1 into gImmagine
if gImmagine > 1118 then put 1113 into gImmagine
set the backgroundPattern of card "cHome" to gImmagine
send "aggiornaSfondo2" to me in 4 seconds
end aggiornaSfondo2
on closeCard
lock messages
repeat for each line 1 in the pendingMessages
answer the pendingMessages
cancel (item 1 of 1)
end repeat
unlock messages
end closeCard
Paolo Borzini | paolo@borzini.it
The WhiteFly Software | www.thewhitefly.it
Service on line for printers | www.4pellicole.it
on closeCard
repeat for each line aMessage in the pendingMessages
if aMessage contains "aggiornaSfondo2" then
cancel (item 1 of aMessage)
end if
end repeat
end closeCard
global gImmagine
LOCAL il_aggiornaSfondo2_messagio_id
## See below, what data this will hold
## I really like MEANINGFUL variable names ;-)
on preOpenCard
put 1113 into gImmagine
end preOpenCard
on openCard
## No need to SEND anything, since the handler is "know" in the card script, so just call it
aggiornaSfondo2
end openCard
on aggiornaSfondo2
put gImmagine + 1 into gImmagine
if gImmagine > 1118 then put 1113 into gImmagine
set the backgroundPattern of card "cHome" to gImmagine
## Every SEND will get an ID under which it is managed in Livecode
## So we store this ID in a local variable and can then later simply CANCEL that ID
## See the closecard handler
send "aggiornaSfondo2" to me in 4 seconds
put the RESULT into il_aggiornaSfondo2_messagio_id
end aggiornaSfondo2
## Please look up SEND in the dictionary!
on closeCard
cancel il_aggiornaSfondo2_messagio_id
## Done :-)
end closeCard