alpha boosting on children
♥0 |
Line 28 |
Modified 2010-05-04 01:27:28 |
MIT License
archived:2017-03-20 12:02:30
ActionScript3 source code
/**
* Copyright grapefrukt ( http://wonderfl.net/user/grapefrukt )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/W0xN
*/
package {
import flash.display.Sprite;
import flash.display.Shape;
import flash.events.Event;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var b:Shape = new Shape;
b.graphics.beginFill(0x333333);
b.graphics.drawRect(-50, -50, 100, 100);
addChild(b);
var s:Sprite = new Sprite;
s.graphics.beginFill(0xff00ff);
s.graphics.drawRect(-75, -75, 100, 100);
addChild(s);
var c:Shape = new Shape;
c.graphics.beginFill(0x00ff00);
c.graphics.drawRect(-25, -25, 100, 100);
s.addChild(c);
addEventListener(Event.ENTER_FRAME, function():void{
s.rotation += 1;
});
x = 250;
y = 250;
// INTERESTING PART -----------------------
// c is a child of s!
s.alpha = .5;
c.alpha = 1 / s.alpha;
// END OF INTERESTING PART ----------------
}
}
}