I came across a forum post of someone attempting to add graphics within, and only within a uniquely shaped boundary. There are numerous ways to achieve this visual effect in flash. One, you could add items to a shape and use a blending mode to allow only those shapes that appear over the parent object to be visible within the parent object’s shape, or two, you could devise a way to duplicate your original shape and use it as a mask on the added children. But, those options don’t really solve the problem of purely adding graphics at x,y coords that are within the actual shape that is to contain them. This led me to play around a bit with BitmapData.hitTest(); This method is a tried and solid practice of collision detection when you have just a few items that need to test for a collision. It does take some processing power, especially when you’re shapes contain soft edges. The soft edges, however, are key to allowing you to place items strictly within solid boundries… more on this below the example.
Categories
- AS3 (8)
- Flash (9)
- Industry (3)
- Uncategorized (2)
-
Recent Posts
-
RSS
A Positive Spin On Sparse Web Traffic
To tackle this, I started playing around with the Google Analytics export data API. I found an open source php interface for retrieving the analytics data and with a few modifications I used this as a proxy to deliver my analytics XML content to Flash. The result: I’m visually displaying my site traffic since January 1st, 2009. Along with visitors-per-day and total-time-per-day – I’m multiplying time by the stated 20 milligrams per second. To compare that to something a bit more tangible, I’m showing the equivalent CO2 emitted per mile from a vehicle averaging 30mpg. There are numerous variations out there on how much CO2 is emitted per mile, but I’m going with ~300g per mile from what I found.
I believe I have the math correct, disregarding the variation in averages of how much CO2 a car produces per mile or an individual emits while online. One other interesting note: If I use the same 20mg of CO2 per second, and multiply that by the time I’ve spent creating and implementing this chart – the CO2 emitted equates to 3.36 miles driven. Granted, this will be more as much of the computer work probably used more energy than browsing the Web. I can’t say this is scientifically accurate, but it is a fun experiment.
2010 View the interactive chart here.
2009 View the interactive chart here.