Movieclip color transform

Hello,
I am building a Smile Face application.
Where you choose a menu item and an object or "movieclip" is
placed on the stage. You can drag and drop the object, take it to
the trash and change the color on any of the objects on the stage
at any time.
I have 2 problems that I am looking for guidance on.
1. The code I use to change the color of the object is bulky.
As it is, depending upon the amount of objects you have in
the menu,
the code could grow to a painful amount making it difficult
to manage.
I am looking for a way to better my existing code, by
upgrading it to a more advanced method.
I have attached my code here.
If anyone could help steer me in the right direction, I would
appreciate it.
Thanks,
Matthew

Thanks for the answer Rob.
It works perfect.
I apologize for my last tread not making much sense.
I have one question, that I would like to find the answer to.
Is there anyway to create this function.
for (j in partsList) {
partsList[j].onPress = choosePart;
Without it being an onPress, onRelease, onRollOver or
onRollOut function?
I ask, because I am incorporating
the "GreenSock transform manager"
which is already using the onPress and onRelease function for
the partsList.
http://blog.greensock.com/transformmanageras2/)
Hope that makes sense,
Thanks.

Similar Messages

  • Color transform reloads movieclip

    I have a movie clip with 4 frames. I programatically create 3
    instances of it, and send each one to a different frame. If I later
    apply a color transform to one of the clips, it plays through all
    the frames and goes back to it's correct frame. Why does it do
    that, and can I stop it from doing that?
    Thanks

    After more inspection, I've figured out it's not the
    colorTransform causing the problem, it's turning a drop shadow
    filter on or off...
    Not sure how much code I would need to attach, but that's
    where the problem is.
    Thanks.

  • Error in Dreamweaver: Unknown Adobe color transform code 2

    I am getting an error in Dreamweaver: Unknown Adobe color transform code 2. Can anyone tell me what is causing this and what to do?

    Not encountered that problem before, but unusual messages after performing a particular action in Dreamweaver are normally the sign that you have a corrupt cache file. Instructions on how to remove the corrupt file are here: http://forums.adobe.com/thread/494811.

  • Aperture 3 bug:Failed to create bitmap context color transform

    *Aperture 3 error*: Aperture[2000] <Error> Failed to create bitmap context color transform
    Aperture[2000] <Error> CGBitmapContextCreateWithData: failed to create delegate
    Using Aperture 3.03 and Mac OS 10.6.4, all updates included.
    This is the Console Message indicating the bug where Aperture 3.x cannot display in its viewer an image with an *embedded color profile*. These images (regardless whether tiff or jpegs) were displayed without problems in Aperture 2.x and do not pose any problems with Preview, Photoshop or Graphic Converter. If one converts the color profile to lets say ProPhoto or sRGB, Aperture works -
    but this is no solution as colors are different then.
    Is there any clue - based on the console message above - where the problem might be? The bug can be reproduced on different Mac Models with Aperture 3.x and vanishes with Aperture 2.x
    is not dependen

    Dear DLScreative,
    please let us not fight over words - fact is, that with at least 2 totally different users and 4 different Mac computers Aperture 3.x behaves totally different (i.e. cannot display these images) than Aperture 2.x. The special color profile is embedded because 15.000 images were scanned with a Nikon LS5000
    scanner. I don't know how to upload this color profile (which has been tested to be correct) to this
    forum. Would you care if I sent you an E-Mail with the special profile attached so you could yourself
    try and see?
    Regards,

  • How do I maintain color transformations

    I have movie clips with only text in them, whose color
    changes depending on user actions. As the swf plays the changes
    work fine, but if the user goes to a previous frame all the color
    changes are lost.
    I am using transform and colorTransform. I get the impression
    that the color transform actions are stored in an array and I need
    to access that array to set the new color permanently (meaning, the
    color only changes if the user specifically makes choices in that
    frame that will change it.
    I've attached the code I am using.
    Thanks for any help, inluding suggesting a better way to do
    this.

    For the most part, it will take care of itself. No defrag needed.   
    17" 2.2GHz i7 Quad-Core MacBook Pro  8G RAM  750G HD + OCZ Vertex 3 SSD Boot HD 
    Got problems with your Apple iDevice-like iPhone, iPad or iPod touch? Try Troubleshooting 101

  • Movieclip's children disappear on color transform

    I have a movieclip where I create a child display object
    (another MovieClip) in the constructor and show it with
    addChild();. However, later on in the code I modify the tint of the
    parent MovieClip using colorTransform. The child object then
    vanishes. Even if I do a removeChild/addChild after the tinting, it
    does not show. I don't understand why this is happening.. tint
    should just modify the color of everything, not hide children,
    right? See attached code for the way I am showing the child and
    changing the tint.

    Thanks for the tip. Now I remember... applying a color to a
    movie clip doesn't apply it to the final composition of all the
    children but to each child individually. I fixed it by creating the
    objects I wanted to display outside of the movieclip and just
    displaying them on top of it so they were technically separate but
    appear visually together.

  • MovieClip.Color

    I can't change  property Color of the component Movie Clip in my program? Compiler didn't found the error but when my program run color Movie Clip doesn't change. Help me, please

    if you have a movieclip with instance name or reference name mc, use:
    var ct:ColorTransform = mc.transform.colorTransform;
    ct.color = 0x9999cc;
    mc.transform.colorTransform = ct

  • Please help with color transform issue!

    Hi,
    How can I change the tint of my movieclip "mc_clip" from
    #000000 to #990000 in 15 frames by scripting it?...in the same time
    change the alpha value of the clip from 85% to 0%.
    thank you in advance,
    Attila

    the code below the dotted line will add a new method to the
    movieclip class. that method allows you to fade any movieclip from
    color rgb1 and alpha a1 to color rgb2 and alpha a2 in speed seconds
    using the number of steps specified in the last parameter:

  • Change movieClip color or size based on player score

    Hello Everyone,
    My students and I worked throught a nice tutorial on a basic pong game that keeps score (http://as3gametuts.com/2011/03/19/pong-1/). But now we are trying to figure out how to modify a movieclip's color and/or size based on the score. This idea was suggested by one of my students, the tutorial does not provide instructions for the color and/or size change so I figured I'd ask for help here.
    The symbol we want to change is named "paddle" with the instance name of "playerPaddle" and we want to change it based on the value of a var named "playerScore".
    Thanks for your help and have a great day,
    Todd

    Ned,
    Thanks for the reply.
    I want to reduce the playerPaddle by 20% when the playerScore reaches 5.
    also
    I want to change the playerPaddle color to red when the playerScore reaches 2.
    Thanks again for your help,
    Todd
    var ballSpeedX:int = -3;
    var ballSpeedY:int = -2;
    var cpuPaddleSpeed:int = 3;
    var playerScore:int = 0;
    var cpuScore:int = 0;
    init();
    function init():void
              stage.addEventListener(Event.ENTER_FRAME, loop);
    function calculateBallAngle(paddleY:Number, ballY:Number):Number
              var ySpeed:Number = 5 * ( (ballY-paddleY) / 25 );
              trace(ySpeed);
              return ySpeed;
    function updateTextFields():void
              playerScoreText.text = ("Player Score: " + playerScore);
              cpuScoreText.text = ("CPU Score: " + cpuScore);
    function loop(e:Event):void
              if( playerPaddle.hitTestObject(ball) == true ){
                        if(ballSpeedX < 0){
                                  ballSpeedX *= -1;
                                  ballSpeedY = calculateBallAngle(playerPaddle.y, ball.y);
              } else if(cpuPaddle.hitTestObject(ball) == true ){
                        if(ballSpeedX > 0){
                                  ballSpeedX *= -1;
                                  ballSpeedY = calculateBallAngle(cpuPaddle.y, ball.y);
              if(cpuPaddle.y < ball.y - 10){
                        cpuPaddle.y += cpuPaddleSpeed;
              } else if(cpuPaddle.y > ball.y + 10){
                        cpuPaddle.y -= cpuPaddleSpeed;
              playerPaddle.y = mouseY;
              //check if top of paddle is above top of screen
              if(playerPaddle.y - playerPaddle.height/2 < 0){
                        playerPaddle.y = playerPaddle.height/2;
              //check if bottom of paddle is below bottom of screen
              } else if(playerPaddle.y + playerPaddle.height/2 > stage.stageHeight){
                        playerPaddle.y = stage.stageHeight - playerPaddle.height/2;
              ball.x += ballSpeedX;
              ball.y += ballSpeedY;
              //because the ball's position is measured by where its CENTER is...
              //...we need add or subtract half of its width or height to see if that SIDE is hitting a wall
              //first check the left and right boundaries
              if(ball.x <= ball.width/2){ //check if the x position of the left side of the ball is less than or equal to the left side of the screen, which would be 0
                        ball.x = ball.width/2; //then set the ball's x position to that point, in case it already moved off the screen
                        ballSpeedX *= -1; //and multiply the ball's x speed by -1, which will make it move right instead of left
                        cpuScore++; //increase cpuScore by 1
                        updateTextFields();
              } else if(ball.x >= stage.stageWidth-ball.width/2){ //check to see if the x position of it's right side is greater than or equal to the right side of the screen, which would be 550
                        ball.x = stage.stageWidth-ball.width/2; //and set the x position to that, in case it already moved too far of the right side of the screen
                        ballSpeedX *= -1; //multiply the x speed by -1 so that the ball is now moving left
                        playerScore++; //increase playerScore by 1
                        updateTextFields();
              //now we do the same with the top and bottom of the screen
              if(ball.y <= ball.height/2){ //if the y position of the top of the ball is less than or equal to the top of the screen
                        ball.y = ball.height/2; //like we did before, set it to that y position...
                        ballSpeedY *= -1; //...and reverse its y speed so that it is now going down instead of up
              } else if(ball.y >= stage.stageHeight-ball.height/2){ //if the bottom of the ball is lower than the bottom of the screen
                        ball.y = stage.stageHeight-ball.height/2; //reposition it
                        ballSpeedY *= -1; //and reverse its y speec so that it is moving up now

  • Human lips color transform

    Hello everybody!
    I’m trying to make photorealistic human lips color change.  I do following steps:
    1.       Create photo bitmap copy and transform it to grayscale.
    2.       Create sprite, fill it with necessary color and set BlenMode.OVERLAY to colorize the grayscale photo.
    3.       After that I draw mask of lips form and apply it to container with grayscale photo and overlay sprite.
    That’s how I make lips to have other color. But! I have two problems:
    1.       Transformed lips color is not similar to applied color. Light colors especially...
    2.       Lips mask has sharp edges so the lips doesn’t look realistic.
    I will appreciate any advises and information of how to improve the quality of my work.

    After more inspection, I've figured out it's not the
    colorTransform causing the problem, it's turning a drop shadow
    filter on or off...
    Not sure how much code I would need to attach, but that's
    where the problem is.
    Thanks.

  • Changing MovieClip Colors

    I have a simple mc of a rectangle in a library with linkage
    that I bring to the stage with an attachMovieClip. I want to change
    the fill color of the rectangle. All the examples I have seen look
    like you have to draw an object line by line with a beginfill
    before the first line and an endfill when your done. Isn't there an
    easier way?

    I did the setRbg and it worked, but it killed the bevel on
    it. No problem, I just broke the mc into two separate mcs and used
    a knockout on the bevel, so I didn't have to mess with the bevel
    filter programatically. thanks kglad.

  • Dreamweaver CS5 error: Unknown Adobe color transform code 1

    This error comes up repeatedly after I edit a library (.lbi) file using the Assets pane. I have to stop Dreamweaver to make it stop coming up.
    Thanks,
    Houyhnhnm

    Not encountered that problem before, but unusual messages after performing a particular action in Dreamweaver are normally the sign that you have a corrupt cache file. Instructions on how to remove the corrupt file are here: http://forums.adobe.com/thread/494811.

  • How Do I change color randomly of a MovieClip in a Timer event?

    I have created a MovieClip named "Target" and called it from actionscript. Inside this movie clip I have created an 'action' layer and written the code in it:
    import fl.motion.Animator;
    import fl.motion.MotionEvent;
    var this_xml:XML = <Motion duration="30" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">
        <source>
            <Source frameRate="12" x="202" y="169.15" scaleX="1" scaleY="1" rotation="0" elementType="movie clip" symbolName="Target">
                <dimensions>
                    <geom:Rectangle left="-32.05" top="-30.85" width="64.05" height="61.7"/>
                </dimensions>
                <transformationPoint>
                    <geom:Point x="0.5003903200624512" y="0.5"/>
                </transformationPoint>
            </Source>
        </source>
        <Keyframe index="0" tweenSnap="true" tweenSync="true">
            <tweens>
                <SimpleEase ease="0"/>
            </tweens>
        </Keyframe>
        <Keyframe index="29" scaleX="2.096" scaleY="2.096"/>
    </Motion>;
    var this_animator:Animator = new Animator(this_xml, this);
    this_animator.play();
    this_animator.addEventListener(MotionEvent.MOTION_END, removeTarget);
    function removeTarget(event:MotionEvent):void
        this.parent.removeChild(this);
    In the main timeline I also have created another 'action' layer and written the code like this:
    var timer:Timer;
    var targetCount:uint;
    var container:MovieClip;
    function initGame():void
        container = new MovieClip();
        addChild(container);
        targetCount = 10;
        timer = new Timer(1000, targetCount);
        timer.addEventListener(TimerEvent.TIMER, generateTarget);
        timer.start();
    function generateTarget(event:TimerEvent):void
        var target:MovieClip = new Target();
         target.x = Math.random() * stage.stageWidth;
        target.y = Math.random() * stage.stageHeight;
        container.addChild(target);
    initGame();
    Now I can get 10 animating circles in different places of the stage after every second. And every circles will leave the stage after completing the animation. Though I have given 'pink' color in that circle, that's why its generating with 'pink' color always. How do I change the color of each circle while it will generate?
    Regards
    Dipesh Pal.

    I have tried in this way......
    function generateTarget(event:TimerEvent):void
        var target:MovieClip = new Target();
        var colorT:ColorTransform = new ColorTransform();
        colorT.redOffset = Math.round(Math.random() * 510) - 255;
        colorT.greenOffset = Math.round(Math.random() * 510) - 255;
        target.transform.colorTransform = colorT;
        target.x = Math.random() * stage.stageWidth;
        target.y = Math.random() * stage.stageHeight;
        container.addChild(target);
    but its not working......
    infact i have used function 'circleColor' which holds this random color transform.... and call that function from 'generateTarget' function also....but it doesnt work too...
    then how do I change the color of every circle which is randomly generating in the stage....?

  • Dynamic color changing

    Hi,
    I am working for an ad-agency project. They have an item in the website to sell. The item should be customized by different colors in the palatte..
    how can i do this in flex?

    Hi,
    Once u have selected the color from the colorPicker then u will be able to get the hexvalue for that selected color.......... then using this hex value of the selected color u can change the color of the movieclip or sprite by using the
    ColorTransform property of the movieclip;
    mc.transform.colorTransform = hexvalue of the selected color
    This will solve ur problem and still if not......do let me know?

  • Accessing Dynamic Movieclip Children

    There is a lot of code that I have but here is snippet to get to the point.  I have created a Movicelip called via actionscript called "McButton".  Then I created 10 MovieClips within that MovieClip ("McDot0", "mcDot1", etc).  I need to know how to access mcButton.mcDot3 to change its color when button3 (mc already on stage) is clicked but can not figure it out.
    I have tried both of these below but it does not work:
    mcButton.mcDot3.transform.colorTransform = cityColor;
    getChildByName("mcButton").getChildByName("mcDot3").transform.colorTransform = cityColor;
    This is the code below that I have used to create the Dynamic Movieclips:
    var button:Container = new Container();
    button.name = "mcButton";
    this.addChild(button);
    for (var a:int = 0; a < 10; a++) {
         var dot:Dot = new Dot();
          dot.name = "mcDot" + a;
        MovieClip(getChildByName("mcButton")).addChild(dot);
    Can someone please help me see the light.
    Thanks

    In order to change a color using color transform, first you must create a new ColorTransform object and than assign it to transform.colorTransform property.
    i,e,
    var cityColor: ColorTransform = new ColorTransform();
    getChildByName("mcButton").getChildByName("mcDot3").transform.colorTransform = cityColor

Maybe you are looking for

  • How to get javabean data in Servlets.( JavaBean -- Servlet(Controller)

    how to get javabean data in Servlets. 1) I am using name ,password in Jsp(View ) 2) when I submit this Bean will be called and Setter methods will be called . 3) In ServletController (controller) I want to get data of javabean. In this I have to do v

  • HT201177 My web browser is opening too small.  How do I adjust this?

    After connecting my TV to my computer and adjusting resolution, my web browser is now opening too small.  I can't seem to find the setting that adjusts this.  Any thoughts?

  • Optimizing the query - which takes more time

    Hi, Am having a query which was returning the results pretty fast one week back but now the same query takes more time to respond, nothing much changed in the table data, what could be the problem. Am using IN in the where clause, whether that could

  • TDS calulcation on partial amount

    Hello, Through MIRO, one accounting document has been generated like: Expenses      Dr.  10000 Brokerage      Dr.   1000 Vendor          Cr.  11000 Again at the time of vendor payment discharge, I need to deduct TDS on Brokerage automatically (not ma

  • Code only working second time round

    Hi all, got a weird one here and hoping someone can help me. Scenario is this...got some dynamically created textareas on the screen and details of each are stored in a datagrid. The user can select one from the datagrid (dg_elements) and then change