Update to Egg Timer

On one of my projects at work I ended up using two Egg Timers but in different states. Since it would be easier to know if the correct Egg Timer was in the correct state, I added a couple of new parameters to the Egg Timer.

<fx:Declarations>
	<fx:uint id="backgroundColor">0xFFFFFF</fx:uint>
	<fx:uint id="faceColor">0xFF0000</fx:uint>
	<fx:uint id="bezelColor">0xcccccc</fx:uint>
</fx:Declarations>

Then I replaced the static colors with these defined variables to make it work.

timerBackground = new Sprite();
timerBackground.graphics.lineStyle(3, bezelColor);
timerBackground.graphics.drawCircle(0,0,timerSize);
timerBackground.graphics.endFill();
timerBackground.filters = [bevelfilter, glowFilter];
				
backGroundCircle = new Sprite();
backGroundCircle.graphics.beginFill(faceColor);
backGroundCircle.graphics.drawCircle(0,0,timerSize);
backGroundCircle.graphics.endFill();
backGroundCircle.filters = [dropShadow];

After those simple changes, the Egg Timer parameters can easily be added when placing the component.

<components:EggTimer id="eggTimer5" backgroundColor="0xCCFFFF" bezelColor="0x6600FF" />

Fairly simple. Since the color parameters are already set as uint, there is no for any further conversion to make the color. I also added a style sheet to the example to help with the color coding for the site.

About DeanLogic
Dean has been playing around with programming ever since his family got an IBM PC back in the early 80's. Things have changed since BASICA and Dean has dabbled in HTML, JavaScript, Action Script, Flex, Flash, PHP, C#, C++, J2ME and SQL. On this site Dean likes to share his adventures in coding. And since programming isn't enough of a time killer, Dean has also picked up the hobby of short film creation.

About DeanLogic

Dean has been playing around with programming ever since his family got an IBM PC back in the early 80's. Things have changed since BASICA and Dean has dabbled in HTML, JavaScript, Action Script, Flex, Flash, PHP, C#, C++, J2ME and SQL. On this site Dean likes to share his adventures in coding. And since programming isn't enough of a time killer, Dean has also picked up the hobby of short film creation.

Leave a Reply

Your email address will not be published. Required fields are marked *

*