>It is simple to ensure a particular cursor in that case. Just change 
>the cursor to something else and then back to the cursor type you 
>want. I'm not saying that cursor handling in Director is flawless, 
>but we've had well documented discussions about how changing the 
>cursor thousands of times is not advisable. Therefore, I minimize my 
>cursor-switching code whenever possible, rather than, say setting it 
>repeatedly in exitFrame, prepareFrame, or even mouseEnter handlers.

Couple of things here, you say just change the cursor to something 
else and back again, but then that leaves you with the problem of 
working out when the cursor has been changed by something outside of 
your control, and you would probably get it wrong like Director does 
(incidentally, even if a problem only happens in authoring, it's 
still an annoyance. Imagine I said don't wrong about that poor 
performance, it'll be ok in a full screen projector, you would still 
complain that the performance was bad in authoring).

The other thing is that I wasn't talking about changing the cursor, I 
was talking about setting it, even if it's already set to the one you 
want. I can prove that that isn't a performance drain at all. Put 
this script into a frame, and stretch it over a few hundred frames (I 
did 300). Set the tempo to 999 fps:

global thecursor

on exitFrame me
   repeat with a = 1 to 1000
     thecursor = 279 - thecursor
     cursor thecursor
   end repeat
end

on beginsprite
   thecursor = -1
   starttimer
end

on endsprite
   put the timer
end

I put a small break in the script channel at the end, so that the 
endsprite would work.

The results of this test were that it took 4063 ticks to change the 
cursor 300,000 times, with the overhead of a repeat loop and going 
through frames of the movie. Even including the overhead as if it was 
setting the cursor that caused it, that would mean the cursor 
changing costs about 1/4 of a millisecond, not very long.

But that's the very worst case, and not what is happening with the 
cursor technique I'm using. Next I commented out the first line in 
the repeat, both lines in the repeat, and then just the second line 
in the repeat. The times were then 45, 19, and 37 ticks respectively.

Let's take the 45 ticks, which has the overhead of a repeat loop, and 
the navigation, and the cursor calculation. Even so, we're only 
talking about 2.5 microseconds (2 and 1/2 millionths of a second).

Still not down to what I'm talking about. The 45 and 19 ticks times 
show that the 300,000 cursor thecursor's that I'm doing take 26 
ticks, or about 1.4 microseconds each.


So, I'm sticking to my current approach for controlling the cursor, 
because I really believe that a microsecond and a half per frame is a 
reasonable expense for the peace of mind of knowing that the cursor 
looks how I want it to.





[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to