How to easily switch between options in code
Sometimes you need two variants of your code (i.e. different constant values), one of them is commented and another is active.
Here i show how you can easily switch between them by deleting/restoring only ONE slash character
♥0 |
Line 16 |
Modified 2011-01-29 22:28:33 |
MIT License
archived:2017-03-20 05:34:42
ActionScript3 source code
/**
* Copyright DaniilTutubalin ( http://wonderfl.net/user/DaniilTutubalin )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/mznv
*/
package {
import flash.display.Sprite;
public class CommentsMagic extends Sprite {
//* <----- delete slash to switch options
// Option 1: Red vertical bar. Enabled by default
private static const COLOR:int = 0xFF0000;
private static const WIDTH:Number = 100;
private static const HEIGHT:Number = 200; /*/
// Option 2: Blue horizontal bar. Disabled by default
private static const COLOR:int = 0x0000FF;
private static const WIDTH:Number = 200;
private static const HEIGHT:Number = 100; /**/
public function CommentsMagic() {
with(graphics) {
beginFill(COLOR);
drawRect(10,10,WIDTH, HEIGHT);
endFill();
}
}
}
}