"img" appears, moves back and fourth, disappears

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!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: "img" appears, moves back and fourth, disappears

Post by Klaus » Wed Oct 30, 2013 9:28 pm

Come on guys, if I do something only ONCE, I will surely NOT use a "repeat for 1 times" 8)

That's not forbidden however! :D

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: "img" appears, moves back and fourth, disappears

Post by bn » Wed Oct 30, 2013 9:37 pm

Hi Klaus,
Come on guys, if I do something only ONCE, I will surely NOT use a "repeat for 1 times"
I left it in since I thought Chris wanted to do it repeatedly in the final version = more than once.

But what he says about changing coordinates and then the script not running/working correctly, I don't understand.

Kind regards
Bernd

chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: "img" appears, moves back and fourth, disappears

Post by chris25 » Wed Oct 30, 2013 10:36 pm

ORIGINAL SCRIPT

global gSize, gPixels
on closefield
--  put me MESSAGE BOX SHOWS
      if me < 500 or me > 5000 then
        put empty into me
        answer error "Please enter a value between 500 and 5000" with "OK then"
show img "popUp"
      repeat for 1 times
         move img "popup" from 211,114 to 211,90 in 60 ticks
         move img "popup" from 211,90 to 211,114 in 60 ticks
         move img "popup" from 211,114 to 211,90 in 60 ticks
      end repeat
      hide image "popUp"
end if
end closefield


Ok, Firstly I should have said (and I have just repeated this third time) that I make the image visible, move the image by dragging a few pixels left and a few pixels up. I then plug in the new co-ordinates for the "start loc" in a preOpenCard handler on the card script that the image sits on. I then go to the 'field" script (with which the appearance of the image is synchronized) and plug in the new "Move" co-ordinates there. The co-ordinates are taken from the image's property inspector.

Now when i run, the image appears, hangs and then disappears and I have to close the stack, remove from memory, then re-open stack and Voila- everything works as it is supposed to work.

The debug shows everything works normally (before closing the stack in order to re-load)


Addendum. I have just taken out the repeat and end repeat. I then re-did the co-ordinates and ran everything just as before, it seems that the repeat and end repeat was causing a problem. No need for it - as I see it -(hey guys was this a test)? Everything works fine even after changing the co-ordinates. On further reflection Hey Klaus! your "cmon guys comment" I acted on that. thanks

Post Reply