Archive for the ‘Flash’ Category
Eagle Eye Free Fall
Monday, October 27th, 2008…was a pretty cool example of integrating flash, video, and the real world. It still didn’t make me want to see the movie though.
Flash Player 10 - 3D Example
Tuesday, October 21st, 2008I’ve tinkered a bit with Flash Player 10. One thing that seems almost funny about the 3D effects of Flash thus far is that very few examples show off actually 3D objects. Most examples I’ve examined show 2D planes transformed in 3D space. So, I’ve created a sample 3D cube primitive in AS3 as a convenient example for people who want to get started with their own parsers or drawing tools (etc).
Flash player 10
Wednesday, October 8th, 2008Its that time again. Time to get into the latest and greatest tech from one of those giant software engineering companies. This time, the tech is Adobe’s Flash player 10.
Step 1: download the Flex 4 SDK and the Flash player 10 (debug version).
Step 2: Create a fresh config file that will target Flash player 10.
Step 3: Use MXMLC to compile your Actionscript or MXML file.
Step 4: Explore AS3 with Flash 10!
I’ve only tinkered around a bit at this point. But as soon as I get a chance to build a crazy app, I’ll have a more thorough write-up. So far, I’m quite excited at the new features. Be sure to read up on the following:
CS4 Launches on my birthday
Saturday, September 20th, 2008Happy birthday to me. Adobe CS4 is scheduled to launch on my birthday, next Tuesday. To catch the unveiling, register here.
Discussion: How best to benchmark Flash?
Saturday, September 13th, 2008While checking out Grant Skinner’s new tweening engine, gTween, I was bothered by one small phrase…
gTween is a small (4.5kb), fast (1500 instances, 0.5s duration, ~25fps), instance based tweening class, with a huge number of options and capabilities.
The definition of ‘fast’ in terms of Flash Player performance is somewhat of a mystery. We’re looking for high frame rate i guess? Lots of things on stage? Total time of operations? But frame rate and number of instances don’t really tell the whole story. There are a number of factors that make the Flash Player performance a very difficult thing to measure.
- Flash Player performance varies based on the speed of the viewer’s computer.
That’s nothing new. All apps deal with this. However, Flash Player has these added complications.
- Flash Player performance varies based on what version of the player is being used.
- Flash Player performance varies based on the browser in which it is embedded.
- The browsers’ Flash Player runs at a different speed as desktop versions (browsers seem to have a speed cap around 50 or 60 fps while stand alone versions do not)
- Loading times for external assets must sometimes be taken into account.
- Framerates can vary based on the set framerate of the Flash app. Rumored ‘magic framerates’ may affect this as well.
- Flash Player can sometimes hang, crash, or self-destruct if too many processes are going on at once.
- Flash Player 10’s support for video hardware should complicate things further (although it will probably make our lives easier in the long run).
Accessing named MovieClips placed on the stage in Flash CS3 while staying true to OOP best-practices
Thursday, September 11th, 2008Each developer has a favourite IDE that he or she swears by. I’m an Eclipse man myself. However, during a project I worked on recently, I had the misfortune of diving back into development using Flash CS3, a tool that, despite it’s widespread use, I have managed to mostly stay away from since it’s release. Why? Flash CS3 is a BAD tool for ActionScript development*. Needless to say I was a bit rusty with the Flash authoring tool, but I was nonetheless determined to create a nice, clean, object-oriented, design-patterny product.
*Perhaps I shall elaborate on this statement in a later post
The first thing I did was create some MovieClip symbols. I created, for example, a custom button containing a background (to which i gave the instance name “bg”) and a text field (called “label”). I then opened the properties for this button and included a path to a class (com.foo.MyButton) that would be associated with the symbol. In the class, I declared the two child MovieClips as variables like so.
package com.foo { import flash.display.*; import flash.text.*; class MyButton extends MovieClip { public var bg:Sprite; public var label:TextField; } }
However, when I ran this code it seemed to choke on the two variable declarations.
I was stumped. Was Flash CS3 actually unable to deal with this situation? Many people I asked seemed to think so. Eventually, I talked to someone who knew the solution.
Sarah Plowright of ActionScriptGirl.com had this advice:
Remember how if you place a MovieClip on the stage or in another MovieClip in an AS2 project you had to also declare a variable of the same name if you’re using a custom class? Well, in Flash CS3 / AS3, Adobe has decided to give us developers some options. The only problem is, they didn’t exactly make these options obvious to the user. If you didn’t know about this change, you be getting all sorts of nasty errors and wondering why you ever decided to build that project using Flash instead of Flex.
If you’re getting errors along the lines of
"1151: A conflict exists with definition myMC in namespace internal."and you’re working custom classes attached to library objects with instances, the error is probably caused by the fact that you have “Automatically declare stage instances” checked. This checkbox is located under Publish Settings > Flash > ActionScript 3.0 Settings. If it’s checked, Flash will automatically add variables to your class at compile time. If you already have tried to declare a variable in your class for this instance, the compiler will throw error 1151, as you will now have two declarations of the same variable. If it’s unchecked, you will have to declare a public variable for every onstage instance that you want access to in ActionScript. Remember, you must make your instance declarations public, or they won’t work!The fix is easy, simply decide whether or not you want Flash to create your variable names for you. I personally prefer to declare my own stage instances as I believe it’s a better practice to have all your variables listed at the top of a class, but annoyingly, this means I will have to uncheck the “Automatically declare stage instances” checkbox for every new FLA file. Unfortunately, this option only seems to be available under publish settings, and not available under the global application preferences.
Here are some sample files that show’s how this all works.
I happen to agree with Sarah that the best way to work is to uncheck the checkbox and declare all of your variables yourself. This is the only way that really enforces good practices when you are using classes behind your MovieClips in the library.
Thanks for the help, Sarah!
Freeware AS3 Screensaver Generator
Monday, August 25th, 2008While poking around the internets I came across a freeware, Flash Player 9 compatible screensaver utility called InstantStorm. It was used to make Simon Heys’ Word Clock which is a great looking, cross-platform typographic clock. InstantStorm, unfortunately, is Windows-Only, however, Simon himself created a cocoa-based version that he plans to release as an open source project. Let’s hope he stays on the ball!
Double Dissapointment
Friday, August 22nd, 2008ECMA script 4 (or 3.1) and OpenGL 3.
I may be in the (rare?) position of being highly interested in two disparate technologies. The first being an online scripting language standard governed by ECMA (used in Javascript & Actionscript). The second, an open standard for real-time rendering governed by the Khronos Group (OpenGL). In recent days these two languages have faced most unfortunate developments. First the ECMA script 4…
Papervision3D Part 3: Features continued
Sunday, August 17th, 2008
This posting is part 3 of a series. If you find that you’d rather start from the beginning, check out Part 1 and Part 2 first. In this post, I’ll cover Papervision animation, the ASCollada project, render statistics, performance optimization.
Animation
Animation in Papervision3D can be performed the exact same way animation would be performed in 2D. Simply apply any tween or algorithm to an object property (like x, y, rotationX, scaleY, etc) and re-render the scene. But, for imported animations its not quite that simple. Lately Moses’s GoASAP package is being adopted in testing for the Papervision engine. It could soon become adopted by the system.
The Collada DAE Parser
Imported animations come in plenty of flavors but must conform to the same system. That’s the reason the animations package exists. Papervision has long supported externally created 3D assets. You’ll find those file parsers in pv3d.objects.parsers. Although, these importers are nice to have, a big part of Great White was the introduction of the open source project ASCollada. ASCollada is an amazing parser for the standard 3D asset interchange format known as Collada. Collada files are basically very dense XML files that use a .dae file extension. Collada files can be exported from Maya, 3D Studio Max, Blender, Google Sketchup, and XSI. However, level of support for those programs probably follows this order: 3D Studio Max, Maya, Blender, Google Sketchup, XSI. Also, if you’re importing MD2 models, the MD2 file parser will import most animations as well.




