Results 1 to 5 of 5

Thread: implementing ColorTransform class

  1. #1
    Join Date
    Jan 2008
    Location
    Near Chicago
    Posts
    247
    Thanks
    105
    Thanked 2 Times in 2 Posts

    Default implementing ColorTransform class

    I have been looking at a example here

    about using color transform class.


    I had two ideas in how I could "change the color of this movieclip instance.

    1) create an array and target frames in the movieclip that would change it's color.

    2) I commented that out(for now) and tried to use the colortransform class
    any suggestions?
    Last edited by evan; 06-13-2008 at 04:38 PM. Reason: figured some things out.

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    This would really depend on your end goal. Regardless of the method, I would still use colorTransform. Changing frames etc, can get really messy and it's going to get really complicated for you if you do it that way. Changing the color dynamically and on-the-fly is far more error proof.

    With that said, you could use the colorPicker component if you want to give users a more complete color pallete. Or, if you just want them to pick from a set color pallete (a la MS Paint), you can assign the hex value as a property to that object and then call it that way.

  3. The Following User Says Thank You to Medyman For This Useful Post:

    evan (06-13-2008)

  4. #3
    Join Date
    Jan 2008
    Location
    Near Chicago
    Posts
    247
    Thanks
    105
    Thanked 2 Times in 2 Posts

    Default

    While it's the best way to get the job done....
    (I opted for the colorpicker option-myself being as that you can limit the color swatches -and you can enlarge the colorpicker to make it apear easier to use.)-but ignoring that:

    -I will still need to design an interface that adds properties to the mc being dragged and redrawn -such as color and size asigned to buttons, that would change the color to a "brush" texture or shape, which is more complicated, concidering the number of variants -tools/sizes/colors gets to be at least 80 possibilities -I will have a text box and arrows to control size which makes it easier.


    I also thought that since, there will be a number of mc's with different shapes, I should set up a list of properties and store them in an array, and on slecting a tool, then it's color -the array will assign the property to that object.



    -this would avoid doing about 40 or so functions to assign colors.

    I though I could assign some properties I can use "globally" such as this for the API pencil
    lineSyle(1, 0x000000);

    And this to change colors of the movieclip "brush" shapes.

    var circle: MovieClip = new Circle();
    addChild(circle);
    var ct:ColorTransform = new ColorTransform();

    //invert
    ct.redOffset = 255;
    ct.greenOffset = 255;
    ct.blueOffset = 255;
    ct.redMultiplier = -1;
    ct.greenMultiplier = -1;
    ct.blueMultiplier = -1;
    circle.transform.colorTransform = ct;
    Last edited by evan; 06-13-2008 at 04:37 PM. Reason: update.

  5. #4
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    You should really start doing things a lot more dynamically. For example, create functions that take certain parameters and can handle varied situations for you. It seems like your hardcoding a lot here.

    The general rule of this is that if you're creating similar functions with varied colors/sizes/positions, then you can probably combine them and use variables in some way to minimize your code.

  6. The Following User Says Thank You to Medyman For This Useful Post:

    evan (06-16-2008)

  7. #5
    Join Date
    Jan 2008
    Location
    Near Chicago
    Posts
    247
    Thanks
    105
    Thanked 2 Times in 2 Posts

    Default

    I had a feeling there was a new "zen". Yes, I am learning at this phase what I can and cannot do with flash and how to deal with it -on a very basic level.

    I understand what you are saying, -thus far I have been using sample code, spliced and customized it and made some discoveries.

    Any recommended reading on working more dynamically?-tutorials -etc.

    In the mean time I could set a number of booleans RED, BLUE GREEN YELLOW etc
    and with each function I could set the MC to change color or default back to black.
    Then globally make a way to resize the MC.
    Last edited by evan; 06-16-2008 at 02:33 PM. Reason: update

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •