dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Movieclip Color Change - on Click

  1. #1
    Member
    Join Date
    Feb 2005
    Posts
    43

    Movieclip Color Change - on Click

    Hi,

    I'm trying to get a movieclip fill color to change once clicked. I'm able to get the mouseover and mouseout working. But the click state isn't working properly.

    Here's my code:

    Code:
    my_mc.addEventListener(MouseEvent.MOUSE_OVER, onFolderOver, false, 0, true);
    my_mc.addEventListener(MouseEvent.MOUSE_OUT, onFolderOut, false, 0, true);
    my_mc.addEventListener(MouseEvent.CLICK, showMovieclip, false, 0, true);
    
    function onFolderOver(evt:MouseEvent):void {
        var trans = evt.target.transform.colorTransform;
        trans.redOffset = -100;
        trans.blueOffset = -100;
        trans.greenOffset = -100;
        evt.target.transform.colorTransform = trans;
    }
    
    function onFolderOut(evt:MouseEvent):void {
        var trans = evt.target.transform.colorTransform;
        trans.redOffset = 0;
        trans.blueOffset = 0;
        trans.greenOffset = 0;
        evt.target.transform.colorTransform = trans;
    } 
    
    function showMovieclip(evt:MouseEvent):void {
        var transClick = evt.target.transform.colorTransform;
        transClick.redOffset = -100;
        transClick.blueOffset = -100;
        transClick.greenOffset = -100;
    //	transClick.color = 0xFFFFFF;
        evt.target.transform.colorTransform = transClick;
    
    }
    When I use the above code, nothing happens once clicked. I tried using the color property, but, although that made a color change (black), it wasn't the color I had indicated (white).

    What I have is a movieclip ("my_mc"). Inside the movieclip are other movieclips. When one is clicked, only that movieclip ("my_mc.movieclip01"), is highlighted.

    Assistance please.

    Thanks.

    Stephen
    Last edited by CappMarvell; 08-08-2010 at 07:57 AM. Reason: typos

  2. #2
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    Remove last line. See if that works.

    Code:
    function showMovieclip(evt:MouseEvent):void {
        var transClick = evt.target.transform.colorTransform;
        transClick.redOffset = -100;
        transClick.blueOffset = -100;
        transClick.greenOffset = -100;
        transClick.color = 0xFFFFFF;
    
    }

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center