Changing Alpha or Brightness of movie clip with actionscript

  • glen@bluegill.ca
  • Born
  • Born
  • User avatar
  • Posts: 2
  • Loc: Calgary

Post 3+ Months Ago

Is there a way to do something like this:

MC_proj1.alpha=100;
or
MC_proj2.brightness(100);
etc

I want to hilite my movie clips when you rollover them with code, but I can seem to find any documentation on it. Go any idea?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • roarmeow
  • Professor
  • Professor
  • User avatar
  • Posts: 861
  • Loc: BKNY

Post 3+ Months Ago

try
Code: [ Select ]
setProperty("MC_proj1",alpha,100);
  • glen@bluegill.ca
  • Born
  • Born
  • User avatar
  • Posts: 2
  • Loc: Calgary

Post 3+ Months Ago

Cool. I also found:

MC_vclip._alpha = 50;

but I couldn't figure out brightness or any of the others. Does your same syntax work with brightness?
  • roarmeow
  • Professor
  • Professor
  • User avatar
  • Posts: 861
  • Loc: BKNY

Post 3+ Months Ago

first off, the code you're using is better than what i suggested... better syntax... more modern... yeah yeah...

unfortunately, though, there's no brightness property... as far as flash is concerned "brightness" is just an adjustment of RGB values... so...

check out this thread on gradually changing the RGB values of a movieclip...

if you want to make it just a quick switch, then it's much easier... just use the setRGB function... as defined in the ActionScript dictionary here:
http://www.macromedia.com/support/flash ... ry145.html

peace out.
  • 4ColorZ
  • Newbie
  • Newbie
  • 4ColorZ
  • Posts: 14

Post 3+ Months Ago

thats not too hard, listen to them theyre right... you can also check out the samples included when you install flash.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

Example :D (grab slider, move it)

[flash width=200 height=200 loop=false]http://www.joebertvision.net/examples/flash/setBrightness/index.swf[/flash]

Here's the scripting used in this example,
http://www.joebertvision.net/examples/f ... /index.fla (mx 6)
Code: [ Select ]
MovieClip.prototype.setBrightness = function(level, wide){
    this.brightness = this.brightness ? this.brightness : new Color(this);
    var lb = Math.round(level * (wide ? 1 : 2.55));
    this.levels = {ra:100,rb:lb,ga:100,gb:lb,ba:100,bb:lb,aa:100,ab:lb};
    this.brightness.setTransform(this.levels);
}

slider.thumb.onPress = function(){
    this.onMouseMove = function(){
        this._x = (this._parent._xmouse < -100 ? -100 : (this._parent._xmouse > 100 ? 100 : this._parent._xmouse));
        _root.photo.setBrightness(this._x);
    }
}
slider.thumb.onRelease=slider.thumb.onReleaseOutside = function(){
    delete this.onMouseMove;
}
  1. MovieClip.prototype.setBrightness = function(level, wide){
  2.     this.brightness = this.brightness ? this.brightness : new Color(this);
  3.     var lb = Math.round(level * (wide ? 1 : 2.55));
  4.     this.levels = {ra:100,rb:lb,ga:100,gb:lb,ba:100,bb:lb,aa:100,ab:lb};
  5.     this.brightness.setTransform(this.levels);
  6. }
  7. slider.thumb.onPress = function(){
  8.     this.onMouseMove = function(){
  9.         this._x = (this._parent._xmouse < -100 ? -100 : (this._parent._xmouse > 100 ? 100 : this._parent._xmouse));
  10.         _root.photo.setBrightness(this._x);
  11.     }
  12. }
  13. slider.thumb.onRelease=slider.thumb.onReleaseOutside = function(){
  14.     delete this.onMouseMove;
  15. }


Basically gives you -100 to 100 for brightness levels, if true is set for the second param that range expands to -255 to 255

If you wanted to get fancy you could separate the rgb values instead of using one like I did, this would give you a sort of photoshop-levels type of controll over an MC.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

If you know anything about Object.watch() you could set it up to watch a .brightness property of an mc ;)

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 15 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.