At 15:03 -0400 04/10/2002, Carol Mahaffy wrote:

>hey list --
>i have a problem. i am trying to limit the number of graphic cast members
>that i have for navigation. I was attempting to create 1 text cast member
>with return delimited lines. Then using mouseWithin i get the line loc and
>swap my colors ect. I have tried this before but had to abandon because it
>seemed as if when you are using mouseWithin it slow the rest of the
>animations down at the same time.

You might be able to improve performance a little by not using as 
much testing. For instance the default color for the member is 
rgb(186,188,181), so you can actually get away with setting the 
member's color to that on a prepareFrame. Then you're not testing 
anything at all with the mouseWithin; you're simply hiliting the 
*one* line the user's pointing to.

As a general rule watch out for case statements. They tend to run a 
little slower than if...then, as I recall.

Hope this he'ps!

--

property spriteNum
property initCrumb
property itemNum
property origDelimeter
property line1
property line2
property line3
property line4
property crumbLines
property currentDown

on getPropertyDescriptionList
   description = []
   addProp description, #line1,[#default "template2", #format#string,
#comment"line1"]
   addProp description, #line2,[#default "template2", #format#string,
#comment"line2"]
   addProp description, #line3,[#default "template2", #format#string,
#comment"line3"]
   addProp description, #line4,[#default "template2", #format#string,
#comment"line4"]
   return description
end getPropertyDescriptionList

on isOKToAttach (me, aSpriteType, aSpriteNum)
   case aSpriteType of
     #graphic
       return TRUE
     #script
       return FALSE
   end case
end isOKToAttach

on beginSprite me
   initCrumb = sprite(spriteNum).member
   member(initCrumb).color = rgb(186,188,181)
   crumbLines = member(initCrumb).line.count
   currentDown = 0
end

on prepareFrame me
   member(initCrumb).color = rgb(186,188,181)
   if currentDown > 0 then
     member(initCrumb).line[currentDown].color = rgb(255,255,255)
   end if
END prepareFrame

on mouseWithin me
   itemNum = sprite(spriteNum).pointToLine(the mouseLoc)
   if itemNum > 0 and itemNum < 5 then
     member(initCrumb).line[itemNum].color = rgb(255,255,255)
   end if
end

on mouseDown me
   put itemNum
   currentDown = itemNum
end

-- 

              Warren Ockrassa | http://www.nightwares.com/
  Director help | Free files | Sample chapters | Freelance | Consulting
        Author | Director 8.5 Shockwave Studio: A Beginner's Guide
                    Published by Osborne/McGraw-Hill
          http://www.osborne.com/indexes/beginners_guides.shtml
[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/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