Moho 5 and Flash
Posted: Tue Aug 10, 2004 10:35 pm
Now that Moho 5 beta 2 has been released, I want to fill you in a little bit about working with Moho and Flash together.
The SWF export function is much more compatible with the Flash authoring tool now. In beta 1, SWF files would play back fine in the Flash player, but when imported into the Flash authoring tool, shapes would sometimes disappear and re-appear during the animation. As of beta 2, we believe this problem has been fixed - definitely let us know if you still see it happening.
There are two types of shapes that you need to avoid creating if you plan to use Moho and Flash together. The Flash player can handle these shapes fine, but if you try to import the SWF file into the Flash authoring tool, these shapes will likely have unexpected behavior. First, don't create figure-8 type shapes, where the outline of the shape intersects itself. Second, don't create compound shapes, such as two eyes that are both filled with a single fill. (You can create two side-by-side eyes, just fill them separately.)
The other thing I wanted to fill you in on is optimized layers. In Moho's Layers window, you'll notice that some layers have a little red dot next to their icons. This dot indicates that the layer is currently optimized for Flash output. An optimized layer will take up way less disk space than a non-optimized layer, making for a quicker-to-download SWF file.
How do you create an optimized Layer in Moho? All vector layers start out optimized. Using any of the following features on a vector layer will un-optimize that layer, leading to a larger SWf file: point animation, bone animation (unless the entire layer is attached to the bone), 3D layer movement, 3D camera movement.
Optimized and non-optimized vector layers will all export correctly to SWF, it's just a matter of file size. Image layers, on the other hand, must be optimized in order to export to SWF. So, any bone warping on an image layer will make it non-SWF-compatible.
Finally, I want to talk about variable-width lines and Flash. Moho can now export variable-width lines to Flash, but there's a problem. With a bunch of freehand strokes and some bone animation, you can easily create an SWF file that is too complex for Flash to handle. Macromedia has some information about Flash's limitations here:
http://www.macromedia.com/support/flash ... gflash.htm
Normally, you don't hit Flash's limits, but variable-width lines can cause a lot of data to go into a SWF file, and then you might hit the limit. What seems to happen is that sometimes the SWF file will play back correctly once, but when it loops, the Flash player will either start to draw garbage on the screen, or it will crash, taking down the browser.
There are a couple options for how Moho can deal with this. There's no way to fix it completely, since Flash has these inherent limitations, but here's what Moho could do:
1. Only allow variable-width lines in optimized vector layers. This would keep Moho from creating overly-complex SWF files that would crash Flash. The downside is that any layers that use bone animation wouldn't be able to export variable-width lines to Flash.
2. Try to keep track of how complex the SWF file has become, and let the user know at the end of export. Unfortunately, Flash's limits don't seem to be exact, so there's no way to know exactly when a file has become "too complex".
3. Do nothing - leave it up to the user. In this case, Moho would let you create as many variable-width lines as you want and export them to Flash We could make a note of the limitation in the manual, but ultimately it's up to you, the user. If your exported SWF file crashes Flash, then it would be up to you to reduce the amount of variable-width lines that your project uses.
What do you think? How would you like Moho to deal with variable-width lines and Flash?
The SWF export function is much more compatible with the Flash authoring tool now. In beta 1, SWF files would play back fine in the Flash player, but when imported into the Flash authoring tool, shapes would sometimes disappear and re-appear during the animation. As of beta 2, we believe this problem has been fixed - definitely let us know if you still see it happening.
There are two types of shapes that you need to avoid creating if you plan to use Moho and Flash together. The Flash player can handle these shapes fine, but if you try to import the SWF file into the Flash authoring tool, these shapes will likely have unexpected behavior. First, don't create figure-8 type shapes, where the outline of the shape intersects itself. Second, don't create compound shapes, such as two eyes that are both filled with a single fill. (You can create two side-by-side eyes, just fill them separately.)
The other thing I wanted to fill you in on is optimized layers. In Moho's Layers window, you'll notice that some layers have a little red dot next to their icons. This dot indicates that the layer is currently optimized for Flash output. An optimized layer will take up way less disk space than a non-optimized layer, making for a quicker-to-download SWF file.
How do you create an optimized Layer in Moho? All vector layers start out optimized. Using any of the following features on a vector layer will un-optimize that layer, leading to a larger SWf file: point animation, bone animation (unless the entire layer is attached to the bone), 3D layer movement, 3D camera movement.
Optimized and non-optimized vector layers will all export correctly to SWF, it's just a matter of file size. Image layers, on the other hand, must be optimized in order to export to SWF. So, any bone warping on an image layer will make it non-SWF-compatible.
Finally, I want to talk about variable-width lines and Flash. Moho can now export variable-width lines to Flash, but there's a problem. With a bunch of freehand strokes and some bone animation, you can easily create an SWF file that is too complex for Flash to handle. Macromedia has some information about Flash's limitations here:
http://www.macromedia.com/support/flash ... gflash.htm
Normally, you don't hit Flash's limits, but variable-width lines can cause a lot of data to go into a SWF file, and then you might hit the limit. What seems to happen is that sometimes the SWF file will play back correctly once, but when it loops, the Flash player will either start to draw garbage on the screen, or it will crash, taking down the browser.
There are a couple options for how Moho can deal with this. There's no way to fix it completely, since Flash has these inherent limitations, but here's what Moho could do:
1. Only allow variable-width lines in optimized vector layers. This would keep Moho from creating overly-complex SWF files that would crash Flash. The downside is that any layers that use bone animation wouldn't be able to export variable-width lines to Flash.
2. Try to keep track of how complex the SWF file has become, and let the user know at the end of export. Unfortunately, Flash's limits don't seem to be exact, so there's no way to know exactly when a file has become "too complex".
3. Do nothing - leave it up to the user. In this case, Moho would let you create as many variable-width lines as you want and export them to Flash We could make a note of the limitation in the manual, but ultimately it's up to you, the user. If your exported SWF file crashes Flash, then it would be up to you to reduce the amount of variable-width lines that your project uses.
What do you think? How would you like Moho to deal with variable-width lines and Flash?