Hi I want create mouseOver function on my pictures and make my Color pictures to grayscale effect, How i can do it, please help me step by step about this issue, thanks in advance,
what you do basically to convert or scale an image is to copyPixels() the image object into another imageobject of the desired colordepth or dimension. look up the copyPixels command in the manual for further explanation.
here's an example behavior which should do what you want:
-------------------------- on mouseEnter me
-- first check if we were already here and created the grayscale image already: gray = me.getaprop(#pGrayscaleImage)
-- if not, we create it now and save it as property for further use if ilk(gray) <> #image then
-- first save the original image in a property, if not already done:
savedImg = me.getaprop(#pSavedImage)
if ilk(savedImg) <> #image then
savedImg = sprite(me.spritenum).member.image.duplicate()
me.setaprop(#pSavedImage, savedImg)
end if-- now create a new empty image object of the correct depth and palette -> 8-bit #grayscale
gray = image(savedImg.width, savedImg.height, 8, 0, #grayscale)
-- and copy the original image into the grayscale one
gray.copyPixels(savedImg, savedImg.rect, savedImg.rect, [#dither:1215])-- save it as property for later use
me.setaprop(#pGrayscaleImage, gray)end if
-- switch the member image sprite(me.spritenum).member.image = gray
end
on mouseLeave me
-- restore the original, if we already have one
savedImg = me.getaprop(#pSavedImage)
if ilk(savedImg) = #image then
sprite(me.spritenum).member.image = savedImg
end if
endon endsprite me
-- restore the original, if we already have one
savedImg = me.getaprop(#pSavedImage)
if ilk(savedImg) = #image then
sprite(me.spritenum).member.image = savedImg
end if
end---------------------
HTH --
||| a�ex --
[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!]
