script interruption (suite)

Ian McKnight iangmcknight at gmail.com
Wed Nov 17 13:45:23 EST 2010


How about sending another send in time message to change the global after 5
seconds?
I haven't tried itand there may be a more efficient way to code this but I
think it should work.

The only thing is you will have quite a number of unneeded calls of the
secondTimer. To overcome this you need to record the send ID in a variable
and then clear these IDs from the pending messages

For more info look up send and cancel in the dictionary

local myPendingMessages

on toggleexercice tDerniereDate
  global gEndFlag
   if gEndFlag is false then
     if tDerniereDate <> empty then
        set the blendLevel of  fld "showExercice" to 100
        show fld "showExercice"
        repeat with x = 100 down to 35
           set the blendLevel of  fld "showExercice" to x
           wait 1 ticks
        end repeat
     end if

send secondTimer to me in 5 Sec
-- record the message ID
put the result&cr after myPendingMessages

     send toggleexercice to me in 1

  else
     repeat with x = 35 to 100
        set the blendLevel of  fld "showExercice" to x
        wait 1 tick
     end repeat
     hide fld "showExercice"
clearMyPendingMessages
     exit to top
  end if
end toggleexercice



command secondTimer
if gFlagEnd is false then put True into gFlagEnd
end secondTimer

command clearMyPendingMessages
repeat for each line tMsg in myPendingMessages
cancel tMsg
end repeat
put empty into myPendingMessages
end clearMyPendingMessages



On 17 November 2010 17:53, Yves COPPE <yvescoppe at skynet.be> wrote:

> Hi list
>
>
> i've made a fld appearing on the screen
> this fld show a text (coming from a variable)
> this fld  is locktext
> his fld contains the script
>
> on mouseUp
> global gFlagEnd
> put true into gFlagEnd
> end mouseUp
>
>
> the fld does appear
> when I click inside the fld, the fld disappears
> it's OK
>
> BUT
> i'd like that the fld will disapear spontaneously after 5 seconds
>
> how can I add this command to the script below ?
>
>
> my script
>
> on toggleexercice tDerniereDate
>   global gEndFlag
>    if gEndFlag is false then
>      if tDerniereDate <> empty then
>         set the blendLevel of  fld "showExercice" to 100
>         show fld "showExercice"
>         repeat with x = 100 down to 35
>            set the blendLevel of  fld "showExercice" to x
>            wait 1 ticks
>         end repeat
>      end if
>      send toggleexercice to me in 1
>   else
>      repeat with x = 35 to 100
>         set the blendLevel of  fld "showExercice" to x
>         wait 1 tick
>      end repeat
>      hide fld "showExercice"
>      exit to top
>   end if
> end toggleexercice
>
>
> thank you very much
>
> Greetings.
>
> Yves COPPE
> yvescoppe at skynet.be
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



-- 
Regards


Ian McKnight

iangmcknight at gmail.com
=======================



More information about the use-livecode mailing list