Spark Path Sound Visualizer

Flex 4 SDK final is out. It’s time to update and post some early Flex 4 prototypes I’ve built with Beta 1 and 2 last year.

Here is a simple Spark Path Sound Visualizer I put together to check out new Spark Path primitive:

Spark Path Sound Visualizer

spark.primitives.Path graphic element was introduced in Flex 4 as part of new FXG and MXML graphics components for displaying vector-based graphics.

Spark Path is a handy view primitive for drawing shapes, maps, charts, or sound visualizations as in this example. Although, I do wish it exposed its PathSegmentsCollection and PathSegment types for manipulating path data dynamically via ActionScript. More on this after the fold:

The only workaround I found for updating Path segments without assigning data string property and string parsing on every frame was by updating mx_internal graphicsPath variable directly. GraphicsPath performs all the drawing operations for this new Spark Path component, and this approach seems to work, but I am not a big fan or supporter of the custom little known mx_internal namespace interface.

Besides, I am still scratching my head why the whole spark.primitives.pathSegments package with all the path segment types was scraped after Flex SDK Beta 1 and folded into spark.primitives.Path component with private access to the segments collection and now inner PathSegment type classes. Since Flex SDK is open source, you can view current spark.primitives.Path code here.

I think it would be very useful to have direct access to the Path segments collection via ActionScript and be able to create Path segments on the fly for dynamic drawing applications. If you feel the same way, please vote for this feature in the next Flex 4 SDK patch/update release here:

You can view and download updated Spark Path Sound Visualizer demo code with the mx_internal graphicsPath solution here.

The original version built with Flex 4 SDK Beta 1 can be found here. It’s messy, but you should be able to grasp the difference.

Leave a Reply