Yes, Virginia, There is Compression in Flash
Posted in "General" at 3:27 pm on June 30, 2009 by Alaric Cole | 1 commentI’m in the process of developing a new hybrid component–a component which utilizes the Flash Player but via a JavaScript API–for YUI. This new component will take advantage of Flash’s native SharedObject functionality to store local data in a larger amount than is typically allowed by a cookie. By default this storage is up to 100kb. However, I found a way to store nearly half a megabyte in this space.
No, I didn’t have to request the user to allow 512kb of storage on their machine. And there was no magic or hackery involved. That’s because the space I took up on the hard drive was less than 100kb. I just took advantage of a little known feature in the Flash Player, allowing compression of data.
This feature is quietly tucked away inside of the ByteArray class–ByteArray.compress() and ByteArray.decompress().
Taking what was a half meg of JSON data over-the-wire and putting it into a SharedObject (which stores in binary) resulted in a huge savings already, about 60%. But compressing that data before storage resulted in a total of 80% savings.
I’ve still got some performance testing to do, as for all compression one must sacrifice processor cycles for storage space. But I feel pretty confident this will remain in the release version. So, either take this idea and run with it, or wait a bit for the next YUI release.
By the way, I also recently posted an article on the YUI Blog entitled Flash SOL: Persistent Data with Local SharedObjects. Thought I’d share it with you all, if you didn’t see it.
Share: on Yahoo! My Web | on del.icio.us | digg it! | reddit!
Rocking it at SXSWi
Posted in "General" at 12:15 pm on March 17, 2009 by Alaric Cole | 1 commentThe Flash Platform team is representing at South by Southwest in Austin. No, we’re not playing in a band this year, though I do hear Tripp is a hell of a guitar player. We’re focused on SXSWi, where all the cool kids congregate to showcase cutting edge technology in the interactive realm. More Rock Band® than rock band.
I just finished speaking about accessibility in Flash and Flex applications. More accurately, I went over the steps to make components accessible, something the readers of this blog have heard me talk about at length. I demoed the usage of a screen reader, which, I was warned, was a dangerous endeavor. It went over pretty well, though, and I was able to show the difference between the the different bits of information you can send to a screen reader. Settling on the Astra Tree component, I added different properties to its accessibility implementation–such as Name, Value, State, and events–and discussed how each was important to make the component fully accessible.
Share: on Yahoo! My Web | on del.icio.us | digg it! | reddit!
Creating Accessible Components in Flash and Flex (Part 2)
Posted in "Articles, Flash, Flex, General, accessibility" at 5:54 am on January 12, 2009 by Alaric Cole | 5 commentsIn this article, I’ll go over the steps needed to enable accessibility for a custom component. While it takes a bit of getting used to, I think you’ll find that enabling accessibility for your components is not only beneficial to the many users who would like to interact with your component, but helps you to fine-tune and further enhance your components in general. To enable use with screen readers, follow these three (simple?) steps:
- Determine object role
- Create the Accessibility Implementation class for component
- Add accessibility tie-ins to component class
a) Create a placeholder for the staticcreateAccessibilityImplementation()method
b) OverrideinitializeAccessibility()method
c) (Flex only) Add AccessibilityClass metadata
Continue reading Creating Accessible Components in Flash and Flex (Part 2)…
Share: on Yahoo! My Web | on del.icio.us | digg it! | reddit!
Flash 10 Experiments: The Warholizer (Loading and Processing Local Images)
Posted in "Examples, Flash, Flex, General" at 10:21 am on December 22, 2008 by Allen Rabinovich | 2 commentsOne of the new features in Flash Player 10 is the ability to read local files. We’ve been looking at this feature for some of our upcoming components, and built a small example that demonstrates how to load, display, and process local images. This example, dubbed “The Warholizer”, allows you to open any image file on your machine, and without uploading it to the server, extract the image’s bitmap data, and run it through some color filters, achieving an effect not unlike the one in some of Andy Warhol’s work. Try it out by dropping in a photo of your own for those 15 minutes of fame (though make sure the image is not too large: Flash has an upper limit on the size of bitmaps):
The code for the example is below the fold.
Continue reading Flash 10 Experiments: The Warholizer (Loading and Processing Local Images)…
Share: on Yahoo! My Web | on del.icio.us | digg it! | reddit!
ASTRA Holiday Edition
Posted in "General" at 11:24 am on December 11, 2008 by Alaric Cole | 2 commentsIt’s that time of year again. A time when spirits are high, and an unmistakable sense of well-being enters your heart. A time when a peaceful stillness fills the air, and carols can be heard, sung merrily in the distance.
That’s right, it’s time for an ASTRA bug release! Oh, for joy!
The Flash Platform team worked overtime on this one. Heck, we could even be seen on Thanksgiving, hacking code in between bites of Grandma’s pumpkin pie. We did everything we could to fix things that needed fixing, and add things that needed adding. And so, without further ado, we present to you, ASTRA 1.3.1.
Fixes and feature enhancements:
AlertManager
o Added support for styling.
AudioPlayback:
o Bug fix: scrubber would not work properly while large file downloads.
AutoComplete:
o Bug fix: Fixed bug with ASTRA layout containers.
o Made itemToLabel function public.
Menu:
o Added support for styling.
o Added accessibility placeholders.
o Bug fix: Fixed bug with MenuEvent not sending out appropriate menu property.
MenuBar:
o Added support for styling.
o Bug fix: Fixed bug in which LivePreview was not showing properly in CS4 when component was dragged to stage.
Tree:
o Bug fix: Fixed index overrun bug.
o Bug fix: Fixed shifting selected item when opening and closing.
So grab a glass of eggnog and sit by the fire, and pick up the new ASTRA.
Share: on Yahoo! My Web | on del.icio.us | digg it! | reddit!
Creating Accessible Components in Flash and Flex
Posted in "Articles, Flash, Flex, General" at 6:00 am on December 5, 2008 by Alaric Cole | 1 commentIt’s been in the works for a while, but I finally had the chance to focus on making ASTRA components more accessible. Accessibility is not something many developers look at, but it’s slowly gaining ground. For many developers, even figuring out how to enable the built-in accessibility of Flash components is a job. But when you create custom components, implementing accessibility is another job entirely. Accessibility doesn’t come for free.
| This set of articles will be geared towards component developers who want to ensure compatibility with screen readers. However, any developer will find this information useful, especially those want to learn how accessibility works in Flash. |
To begin my assessment of ASTRA components, I first had to learn to use a screen reader. I installed a trial of JAWS for Windows, which is the de facto screen reader technology, especially in regards to Flash. It’s important to note that although I develop on a Mac, I have to use Windows for accessibility testing. This is because Flash accessibility is based on Microsoft’s Active Accessibility standards, and only work on Windows machines. It can be argued that real accessibility is quite limited on the Mac, so this is more of an OS X limitation than a limitation of Flash. I also installed the Flex scripts add-ons, which are touted to provide more fine-grained info for the screen reader when using accessible Flex components.
Using a screen reader, I quickly discovered, is a more involved process than it might seem. Your natural tendencies and habits have to be thrown out the window. For example, opening a browser window with an embedded swf, my first inclination was to use the mouse to navigate to a text input control and start typing. That didn’t work as planned. For one, a typical user of a screen reader is not going to be grabbing the mouse first thing, but using keyboard navigation to interact with an application, so I’d already cheated. Along with this, because of the way JAWS works, navigating to an input field won’t necessarily allow you to begin editing text–you must enter into “forms mode” in order to even start typing.
Once I got the basics of using JAWS down, I started to test our components. My original assumption was that the components would “mostly work” because many of them are based on lower-level components which have accessibility implementations built.
I was “mostly wrong.” A component is not the sum of its parts, in regards to a screen reader. For a component to be successfully understood by the user, it needs its own accessibility implementation built from scratch.
In the next article I’ll discuss what steps I took to create those implementations.
Share: on Yahoo! My Web | on del.icio.us | digg it! | reddit!
Where in the World Is Yahoo! Flash Platform? (Answer: Adobe Max 2008)
Posted in "General" at 12:13 pm on November 14, 2008 by Allen Rabinovich | No commentsWell, we sneak around the world, from Kiev to Carolina, but next week, the big Adobe Max Developer Conference is coming to San Francisco, and we wanted to let you know that that’s where we’ll be! Yahoo! is a gold sponsor of the conference, and we’ll have a booth where someone will always be on hand to valiantly answer your questions and distribute schwag. We will also have two sessions in the “Develop” track. Here are the session blurbs:
Hybrid Applications: Where JavaScript and Flash Play Together
Monday, November 17th, 5—6 PM, Moscone West 2012
Although JavaScript is frequently the first choice for building RIAs, it is limited by browser capabilities. For that reason, JavaScript is missing some of the most essential features: vector drawing, improved file uploading, local storage, video playback, and so on. In this session, we’ll present a solution to this problem in the form of hybrid components. Hybrid components are applications built with Flash whose functionality is exposed to JavaScript and allows them to be used just like regular JavaScript components. We’ll go over the architecture of hybrids and showcase those developed for Yahoo!’s popular open source YUI library.
Yahoo! ASTRA and YUI: Open Source Front-End Components for Every Occasion
Wednesday, November 19th, 2—3 PM, Moscone West 2012Yahoo! front-end platform teams have a unique approach to developing software: Although they work for a commercial enterprise, everything they do is free and open source. In this session, Yahoo! representatives will cover the work they’ve been doing for three years, from the award-winning YUI Library (preview YUI 3.0) to the Flash and Flex components in the ASTRA Library to the ActionScript 3 Maps API. The components they build solve real problems and can be leveraged by other companies. We’ll look at the source of a few components to see how they were built and provide insight into component development.
We’ll record screencasts of both of these sessions and post them on this blog, so noone will miss out.
And if you are registered for Adobe Max, then see you soon!
Share: on Yahoo! My Web | on del.icio.us | digg it! | reddit!
3D with Flash 10 (part 2)
Posted in "Flash, General" at 8:41 am on November 12, 2008 by Michael Hoch | 5 commentsOverview
When I came across Flash 10 two things caught my attention: 3D Effects and PixelBender Filters. This post will explore the former: Flash 10 adds a set of utility functions to do 3D Effects that were previously difficult or costly. I wanted to explore the possibility to export 3D Models from 3D animation packages to Flash 10 directly. Now, there are existing 3D engines like Papervision, Away3D, and Sandy that provide the functionality for rendering 3D objects and scenes. There are also functions for reading in data from 3D formats like 3DMax. However, the purpose of this blog post is an exploration of the new functionality offered in Flash 10 and describe a minimalist approach to how to render a 3D object using some of these new functions.
Note: The proper version of Flash Player is not installed or JavaScript is not enabled. Unable to display SWF content.
New functions
Vector
Flash 10 introduces the notion of typed arrays – arrays that can only contain values of a certain type – which improves performance and makes your code also more transparent. We can use it to store the vertex data of our 3D object (as well as a similar vector for our indices that define the face set). You can simply create an empty Vector and then push the vertices:
var vertices3D:Vector.<Number> = new Vector.<Number>();
vertices3D.push(x, y, z);
You can also pre-specify the size:
var vertices3D:Vector.<Number> = new Vector.<Number>(30);
vertices3D[0] = x;
vertices3D[1] = y;
vertices3D[2] = z;
or just pass in an array:
var vertices3D:Vector.<Number> = Vector.<Number>([ 0.3, 0.7, 0.1 ]);
Watch out for not using “new” when initializing a Vector with an array.
Perspective Projection
Once we have our vertex data we can set up our rendering pipeline with a perspective projection. Flash 10 offers the class PerspectiveProjection that allows us to set the projection center and the field of view through properties.
var pp:PerspectiveProjection = new PerspectiveProjection();
pp.projectionCenter = new Point(0, 0);
pp.fieldOfView = 45;
Project Vectors
Next, we use the projection matrix and one of the new 3D utility functions to project our vertex data into 2D space. Below we use the typed array vertices2D to hold the resulting data (note that this function also calculates the t-value of the uvtData which can be used for texture mapping).
m:Matrix3D = pp.toMatrix();
Utils3D.projectVectors(m, myMesh.vertices3D, myMesh.vertices2D, myMesh.uvtData);
Draw Triangles
Finally, we can draw our resulting 2D mesh on the screen using the new drawTriangles() function. This function takes our calculated 2D vertex data array, the original index data, and specifies which sides should be rendered through the culling parameter. A parameter of TriangleCulling.POSITIVE results in only positively wound triangles to be drawn.
container.graphics.clear();
container.graphics.beginFill(0xbbbbbb, 1);
container.graphics.lineStyle(0, 0×666666, 1);
container.graphics.drawTriangles(myMesh.vertices2D, myMesh.indices, null, TriangleCulling.POSITIVE);
Adding interactivity
In order to add interactivity – say rotate our object via mouse movements – we can introduce one additional step before we call projectVectors(): We can use the new Matrix3D functions to add translation and rotation parameters.
m2:Matrix3D = new Matrix3D();
m2.identity();
m2.prependTranslation(1, 0, 5);
m2.prependRotation(rotY, Vector3D.Y_AXIS);
m2.prependRotation(rotX, Vector3D.X_AXIS);
m2.transformVectors(myMesh.vertices3D, myMesh.vertices3D2);
Utils3D.projectVectors(m, myMesh.vertices3D2, myMesh.vertices2D, myMesh.uvtData);
Export from 3D Package
Now that we can render 3D objects we like to use polygonal models from a 3D package. There are a set of ASCII formats that can easily be converted to ActionScript arrays (e.g. VRML or obj). In case of the open source animation system Blender there are also scripts that directly export to Actionscript compatible with Sandy, Papervision and Away3D. It is easy to create a similar script to export to a simple AS3 mesh class that holds the data for our vertices3D, our indices of the face set, as well as provides the arrays for vertices2D and uvtData.
See some results of simple 3D objects:
Note: The proper version of Flash Player is not installed or JavaScript is not enabled. Unable to display SWF content.
Note: The proper version of Flash Player is not installed or JavaScript is not enabled. Unable to display SWF content.
Attached is the source for the 3d Cube.
… to be continued
Share: on Yahoo! My Web | on del.icio.us | digg it! | reddit!
3D with Flash 10: Simple Way First
Posted in "Flash, Flex, General" at 6:00 am on November 10, 2008 by Allen Rabinovich | 8 commentsAs you are probably well-aware, Flash Player 10 was recently released. In this milestone release, Adobe once again introduced a number of great new features, making the player ever so powerful and useful in a wide range of projects. As we are actively exploring the new player for the many upcoming components and libraries in the ASTRA toolkit, we thought it would help to dedicate a few blog posts to the features we found most interesting.
To start off, we’ll take a look at the feature we like to call “the new dimension.” For the first 9 versions, the native rendering in Flash was limited to the Cartesian coordinates. During that time, many ways to “fake” 3-dimensionality were invented and publicized, from the simple “skewing” methods to entire bitmap-based 3D rendering libraries, like Papervision and Alternativa. Now, in the 10th version of Flash, a fair amount of 3D rendering capabilities have finally become native.
To check out this new feature, take a look at a simple application (Note that you need to install Flash Player 10 to see it):
Note: The proper version of Flash Player is not installed or JavaScript is not enabled. Unable to display SWF content.
Notice that instead of the old-time z-plane rotation (DisplayObject.rotation), we can now rotate a display object in all three planes (DisplayObject.rotationX, DisplayObject.rotationY, and DisplayObject.rotationZ), with perspective distortion thrown in for free. Also, in addition to the x and y coordinates, we can modify the z coordinate, which is visually equivalent to “scaling” the display object, but doesn’t actually change the scale values.
The beauty of this new feature is that it preserves the relation among coordinate systems of nested display objects. What does that mean? Well, let’s say you had a few display objects that you wanted to place in a stack, and then observe that stack as a 3D object — well, long story short, you can do just that. Any changes to the 3D coordinates of the parent display object propagate down to the child, and so we can take the example above, and kick it up a notch:
Note: The proper version of Flash Player is not installed or JavaScript is not enabled. Unable to display SWF content.
Now we’re cooking with gas! With just a few lines of code (included below the cut), we put together a simple and elegant way to look at a stack of images.
These newly added features for creating 3D interfaces will greatly facilitate building rich interactive applications, but they are not quite perfect. As Justin Everett-Church once explained, using these properties is akin to creating “postcards in space” — it’s still a far cry from creating true 3D objects and environments, because modifying the three dimensions of rotation and position of planar objects doesn’t deal with more complex issues like back-face and occlusion culling, drawing primitive elements in 3D, etc. We’ll look at new features that go further in enabling more complex 3D work in the next post.
The MXML code for the examples above is below the cut.
Continue reading 3D with Flash 10: Simple Way First…
Share: on Yahoo! My Web | on del.icio.us | digg it! | reddit!
With a Little App from my Friends
Posted in "Articles, Flash, Flex, General, Web APIs" at 5:59 am on September 23, 2008 by Alaric Cole | 3 comments
No doubt you’ve heard a little something about Yahoo!’s new open strategy. If you attended Open Hack Day, you would’ve even been able to use the new Social APIs, which allow you to build powerful social applications on our Yahoo! Applications Platform (YAP).
Not to let down the Flash folks, we’ve created some nice AS3 APIs that let you easily integrate social data and create a Flash or Flex application easily in YAP. There’s even a great Yahoo! theme for Flex applications, to give you a standard look and feel right from the start.
If you’re itching to see what this is all about, it’s currently available as a preview release at http://developer.yahoo.com/flash/yos. While you won’t be able to actually use the services (sorry, coming soon), you can get a head start on learning the system and even begin developing your apps, as the code and documentation are all there for the taking. There’s even lots of source code for example applications, so you can be one step ahead of your friends.[Edit: it's now released!]
Share: on Yahoo! My Web | on del.icio.us | digg it! | reddit!

Copyright © 2007 Yahoo! Inc. All rights reserved. Privacy Policy - Terms of Service
Powered by WordPress on Yahoo! Web Hosting.