A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: Rolling over movies

  1. #1
    Member
    Join Date
    Jan 2006
    Posts
    79

    Rolling over movies

    Is there an actionscript to change the color of a mc on the stage? it is going to play on release, but I want to button to look actionable when you roll over it.

    thanks!

  2. #2
    Member
    Join Date
    Aug 2004
    Posts
    33
    import flash.geom.Transform;
    import flash.geom.ColorTransform;
    //to get the color settings, apply the desired tint to the mc via
    //the properties/color/tint settings
    //then go to properties/color/advanced and click on the setting tabs
    //the numbers you see are what you put in the Color Transform object
    //50% = .5 etc.
    var yellow_tint = new ColorTransform(.5, .5, .5, 1, 128, 128, 0, 0);
    var reset_color = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
    //mc_name is the name of your mc
    trans=new Transform(mc_name);
    mc_name.onRollOver=function(){
    trans.colorTransform=yellow_tint;
    }
    mc_name.onRollOut=function(){
    trans.colorTransform=reset_color;

    }

  3. #3
    Member
    Join Date
    Jan 2006
    Posts
    79
    Thank you sooooo much!

  4. #4
    Member
    Join Date
    Jan 2006
    Posts
    79
    so yours worked- is there a reason it doesn't work when I change the values to
    (0, 0, 0, 1, 156, 180, 192, 0) ?

    I want a bluish grey hue.

  5. #5
    Member
    Join Date
    Aug 2004
    Posts
    33
    Your first three numbers are the percent of the tint, by having them set to 0, the tint is set to 0.
    heres's an example:

    var bluegray_tint = new ColorTransform(.5, .5, .5, 1, 39, 50, 68, 0);

  6. #6
    Member
    Join Date
    Jan 2006
    Posts
    79
    Thanks- I have one more problem- I have a list of movie clips that I want to do the same thing. When I add the script to the keyframe of the second mc, it disables them. Why?

    How can I apply this effect to a number of mcs on the same page?

    Thanks so much!

  7. #7
    Member
    Join Date
    Aug 2004
    Posts
    33
    import flash.geom.Transform;
    import flash.geom.ColorTransform;
    //to get the color settings, apply the desired tint to the mc via
    //the properties/color/tint settings
    //then go to properties/color/advanced and click on the setting tabs
    //the numbers you see are what you put in the Color Transform object
    //50% = .5 etc.
    var yellow_tint = new ColorTransform(.5, .5, .5, 1, 128, 128, 0, 0);
    var reset_color = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
    //mc_name is the name of your mc
    mc1.onRollOver = function() {
    trans = new Transform(this);
    trans.colorTransform = yellow_tint;
    };
    mc1.onRollOut = function() {
    trans.colorTransform = reset_color;
    };

    mc2.onRollOver = function() {
    trans = new Transform(this);
    trans.colorTransform = yellow_tint;
    };
    mc2.onRollOut = function() {
    trans.colorTransform = reset_color;
    };

  8. #8
    Member
    Join Date
    Jan 2006
    Posts
    79
    where do I put that code? In the keyframe with the first mc? In each of the mcs' keyframes? In a frame on the main timeline? Sorry! I just can't get it to work!!

  9. #9
    Member
    Join Date
    Aug 2004
    Posts
    33
    on the first frame of the main timeline. Give each of the mcs on the stage an instance name. In my exampl I used mc1 and mc2 as the instance names.

  10. #10
    Member
    Join Date
    Jan 2006
    Posts
    79
    I have no idea why I cannot make this work. :-(

    When I just do the code for the 1st mc it works fine. Then when I add more, none of it works. Does it matter that they are all on different layers and show up in the movie at different times?

    Oh well. Thanks!

  11. #11
    Member
    Join Date
    Aug 2004
    Posts
    33
    The mcs need to be on the stage when the onRelease events are declared. So if the code is on frame 1, the mcs need to also be present on frame 1.

  12. #12
    Member
    Join Date
    Jan 2006
    Posts
    79
    Rock and Roll! You rule. Thank you!

  13. #13
    Member
    Join Date
    Jan 2006
    Posts
    79
    is there something to disable this on release? Otherwise the movies are showing with that color tint.

    Thanks!!!
    -Lyn

  14. #14
    Member
    Join Date
    Aug 2004
    Posts
    33
    mc2.onRelease = function() {
    trans.colorTransform = reset_color;
    };
    mc2.onReleaseOutside = function() {
    trans.colorTransform = reset_color;
    };

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