Tuesday, December 6, 2011

Color Picker Script Error

Hi I have another Problem in the color Picker.



Please see the attached Script that I am using for Selecting
the Color and and also for changing the icon color to selected
color



This Code works fine and gives me the Hex code and RGB Code
corresponding to the color Selected in the color Picker Bitmap.



But I have been noticing it that as I move towards the
periferi of the Color Picker it gives me an error Saying



''Script Error: Object Expected

member(''HexCode'').text = cveta.hexString() %26amp; ''''



I am not getting this error when i do the same well within
the periferi of the Color picker



Any help regarding the same or any tip to fix this error will
be highly appreciated



Thanks and Regards

Atul SaxenaColor Picker Script Error
Hi,



''Script Error: Object Expected'' probably means that 'cveta'
is not a color object. this will happen if the following line
fails:



cveta = member (''colorgama'').image.getPixel (hto, mto)



So, what you could do is test that cveta is a color before
calling hexString() method of a colour object:



strHexCode = ''''

if cveta.ilk= #color then

strHexCode = cveta.hexString() %26amp; ''''

end



Incidentally, you probably should not write lingo code like
''repeat while the stilldown'' (since absolutely nothing else will
happen while the mouse is down -- eventually, sounds will stop and
director will grind to a halt). A better strategy is an
'asynchronous' approach like this :



property mouseTracking

on enterframe (me)

if (the mouseDown) then

mouseTracking = true

-- track the mouse etc

else if mouseTracking then

-- finish tracking

mouseTracking = false

end if

end





-- Luke



No comments:

Post a Comment