Hi

Generally I don't have problems if the flashObject that I create is created
by the Flash Sprite in which I want to use it in. But sometimes it doesnt'
make complete sense to externalize everything within Director. One method
that is a slight change from what you are doing would be to create a
"utility object class" that you reuse in all your flash movies. Then have a
function setup in it to take an object and a target as a string and do the
work inside of flash. Let me see what I can dig up from my utility object
files...

Here is a class (I don't know how bad it will come out in email form, that
deals with just color functions. You could use these base functions and
another function that would take either an object reference or target path
as string and a hex color as a string and convert the hex color to rgb
components and apply the color all inside of flash..

Sincerely
Mark R. Jonkman

PS Class file is as follows.. this is what I have so far:

/*
        MRJColorUtilityClass

        Description:

                This class definition is a container for utility functions that can be
used to
                manipulate color objects, strings.

        Class Functions:

                MRJColorUtilityClass:           Class Constructor

                fHexStringToHexNumber:          Function that accepts a hex color 
string in
either "0xFFFFFF"
                                                                        of "#FFFFFF" 
formats. Returns an base10 decimal value that
                                                                        representing 
the hex number defined by the string. Failure
                                                                        to supply a 
string that can be parsed to hex will return
                                                                        the boolean 
false.

                fHexStringToRGBComponents:      Function that accepts a hex color 
string and
returns an array
                                                                        containing the 
3 rgb components

                fHexNumToRGBComponents:         Function that takes the base10 
representation of
a hexidecimal
                                                                        color num and 
breaks it into its rgb components and returns it
                                                                        as an array of 
the 3 components.

                fRGBComponentsToHexNum:         Function that takes 3 integers 
representing the
red, green and blue
                                                                        RGB components 
and converts them back to a single hexidecimal color
                                                                        value 
represented as a base10 integer.
*/

_global.MRJColorUtilityClass = function(){
        trace("hi MRJColorUtilityClass");
};

MRJColorUtilityClass.prototype.fHexStringToHexNumber = function(sHexNum)
{
        if (sHexNum.substr(0,2).toLowerCase() == "0x"){
                return(parseInt(sHexNum));
        } else {
                if (sHexNum.indexOf("#") == 0){sHexNum = sHexNum.subString(1)}
                return(parseInt(sHexNum,16));
        }
};

MRJColorUtilityClass.prototype.fHexStringToRGBComponents = function(sHexNum)
{
        if (sHexNum == "" || sHexNum == null || sHexNum.length < 6){
                return([0,0,0]);
        }
        return(this.fHexNumToRGBComponents(this.fHexStringToHexNumber(sHexNum)));
};

MRJColorUtilityClass.prototype.fHexNumToRGBComponents = function(iHexNum)
{
        return([(iHexNum & 0xFF0000) >> 16,(iHexNum & 0x00FF00) >> 8,iHexNum &
0x0000FF]);
};

MRJColorUtilityClass.prototype.fRGBComponentsToHexNum =
function(iRed,iGreen,iBlue)
{
        return(iRed << 16 | iGreen << 8 | iBlue);
};

[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