I made an update to my Flex Egg Timer example. The Egg Timer uses Degrafa libraries to create the images. They released beta version 3.1 back in December, which was after I started working on a project that used the Egg Timer. Well, when I created an updated version of the project using the new version of Degrafa, I was getting some very odd looking pie pieces. I was using an EllipticalArc to draw both the white timer and the red background. It gave the effect that the red background was the timer and the white part was the background. The initial arc position was set to 90 (90 degrees) or 12 o’clock on the timer. Then I had to draw the rest of the arc, which would be 360 degrees from that point. Well, the new version of Degrafa didn’t like the 360 degrees from 90, so I figured out that I need to just draw it 359 degrees from 90. It makes the clock start with one tick, but that’s not a big deal, the timer still works since it goes off of a millisecond timer.
The call to the timer still uses 360 degrees divided by the time amount. Apparently it is only the starting angle and arc that causes the issue.
EggTimerOne.setArc(360 - (event.target.currentCount * (360 / oneMinute)));
As the title of the post suggest, I also changed the example to use scaling. Flex and Flash use [w:Vector Graphics] for images. This allows the applications to easily scale due to user screen size. Since I have just started using Flex, I haven’t been working with the scaling like I should be. During the update for the application at work, I changed how things were sized by scaling based on a default size. By grabbing the screen size, I figured out the scale times value for the width and height and then scale the application parts accordingly.
In the Egg Timer example, I am scaling the different timers by a certain number to change the size, instead of altering the height and width. With this method, I can create the component at a certain size and then scale it for it’s needs. The one minute Egg Timer is put into the Application Tool bar and scaled according to the ration used in another application.
scaleX="1.65" scaleY="1.62"
As I continue to make new components, examples and applications, I will make sure I use this scaling option more often.
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.