Moho 5 and Flash

(This forum has been closed. Please use the General Moho Discussion forum.)

Moderators: Víctor Paredes, slowtiger

User avatar
Lost Marble
Site Admin
Posts: 2347
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Moho 5 and Flash

Post by Lost Marble »

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?
User avatar
DetoNaToR
Posts: 50
Joined: Tue Aug 03, 2004 11:38 pm
Location: Lithuania
Contact:

Post by DetoNaToR »

Flash 5 still not inports Moho 5 expoted .swf.. :(
User avatar
cribble
Posts: 899
Joined: Wed Aug 04, 2004 12:42 pm
Location: London, UK
Contact:

Post by cribble »

Well i've just given it a spin and what a difference it has made. I imported some files into MX and it was all good really.

Though i see what you mean about the shape thing, this could become quite annoying for some people. I have a character, if i were to import this into flash (MX) it loses colour to its behind arm.

Example:

Moho Export

Import into FlashMX and exported again

I think it does this compound business. Though, come to think about it, it should do the colourless thing with the other arm (because they're copies of each other). I haven't used any 3D layers.

But still, i have to say, this has been a great update to the SWF engine, thanks Lost marble.
--Scott
cribble.net
User avatar
Lost Marble
Site Admin
Posts: 2347
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Post by Lost Marble »

DetoNaToR wrote:Flash 5 still not inports Moho 5 expoted .swf.. :(
I'm using Flash MX 2004 here, and it works fine. What's happening in Flash 5? It it importing incorrectly, or is it refusing to import at all or what?

If it's importing incorrectly, what problems are you seeing?
User avatar
spasmodic_cheese
Posts: 330
Joined: Wed Aug 04, 2004 2:02 am

Post by spasmodic_cheese »

Oh thats awsome lost marble, imports into flash mx perfectly :D
User avatar
DetoNaToR
Posts: 50
Joined: Tue Aug 03, 2004 11:38 pm
Location: Lithuania
Contact:

Post by DetoNaToR »

It's writes "reading error" something like that.. I tried Flash MX too, it's working fine, but it should work in Flash 5 too, I think..
User avatar
spasmodic_cheese
Posts: 330
Joined: Wed Aug 04, 2004 2:02 am

Post by spasmodic_cheese »

Im guessing moho exports to flash 6 then...???
User avatar
cribble
Posts: 899
Joined: Wed Aug 04, 2004 12:42 pm
Location: London, UK
Contact:

Post by cribble »

well if you compress a SWF, it will only play in flash players 6 onwards and imports into flash (6)MX and above.
--Scott
cribble.net
User avatar
Squeakydave
Posts: 328
Joined: Tue Aug 03, 2004 9:44 pm
Location: UK - London-ish
Contact:

Post by Squeakydave »

I guess so too. I get no joy at all with Flash 5 but the 30 day demo of MX2004 works fine.
Drat! I had hoped not to have to shell out £200 for a Flash upgrade packed with stuff I don't need and tools that are basically the same as the ones I already have.

There is no stopping 'progress' I suppose.

:?
aeric
Posts: 5
Joined: Thu Aug 05, 2004 1:14 am
Contact:

is this the issue about width lines?

Post by aeric »

my outlines in moho5b2 are 1, but when imported to FlaMX2004 they are imported with a width of 2

i had to break apart all group shapes and manually change them to 1

is this the issue?
User avatar
spasmodic_cheese
Posts: 330
Joined: Wed Aug 04, 2004 2:02 am

Re: is this the issue about width lines?

Post by spasmodic_cheese »

aeric wrote:my outlines in moho5b2 are 1, but when imported to FlaMX2004 they are imported with a width of 2

i had to break apart all group shapes and manually change them to 1

is this the issue?
I just tried a normal circle with outline of 1, and brought it into flash MX (not 2k4) and the outline was 1 in flash.
aeric
Posts: 5
Joined: Thu Aug 05, 2004 1:14 am
Contact:

Post by aeric »

mm, i just did the same and it behaves right

maybe i have a mess with my work in moho and outlines

thanks for the tip to verify
my mistake :lol:
Barliesque
Posts: 45
Joined: Sun Aug 08, 2004 10:58 am
Location: Los Angeles

Handling variable-thickness lines in .swf files

Post by Barliesque »

I've got an idea about how Moho might better construct the Flash file, when dealing with variable width lines.

I'm examining the example file "test_flash_mx.swf" from the "Moho and Flash 5" thread. I've imported it into Flash MX 2004. I see that it breaks the character down into its very very basic shapes. And there are *lots* of them, which obviously accounts for the limits you're talking about, but even more importantly the large size (even the compressed file is quite large considering how simple the animation is).

I notice that many of the Symbols created are really quite similar. ...Suppose Moho were to recognise triangles, for instance. Look at Symbols 6,9,12,13,15,23 and 24 in Flash MX. Now suppose Moho regogises all of these as black triangles. One symbol could be created, a basic triangle, which could be scaled, rotated and skewed to closely match those shapes. There would, of course, be a margin of error, maybe a setting in Moho for how likely it is to simplify shapes. Also, if there's a blue triangle and a green triangle, etc. the "tint" effect could still allow Moho to rely on just one symbol. If Moho recognises triangles, rectangles and circles then the total number of symbols could be massively reduced. Symbol 14, let's call it a "capsule" shape, could be recognised and constructed with a rectangle and two circles.
User avatar
spasmodic_cheese
Posts: 330
Joined: Wed Aug 04, 2004 2:02 am

Post by spasmodic_cheese »

I love moho's export just how it is, and I think I was the one that pushed lostmarble the most to get moho to support flash.

That idea would work barliesque, recognizing the same symbol and using multiple instances of it.. but say with bones, every frame is different because all the curves are changed, so... yeh, what would happen there?

I would really hate my animation not being exactly like i intended it, just to optimize...

You could use optimaze to do this as well(and probably much better).
Barliesque
Posts: 45
Joined: Sun Aug 08, 2004 10:58 am
Location: Los Angeles

Post by Barliesque »

I love moho's export just how it is...
It's certainly a great advance--but this issue needs to be addressed for it to live up to its potential. Judging by the filesizes with a simple export, I think that something really must change in order for a real project of any complexity to export at a useable size. ...But remember, this issue only regards the use of variable-thickness lines.
but say with bones, every frame is different because all the curves are changed, so... yeh, what would happen there?
That's already taken into account. Remember, I'm examining an exported animation that used bones.
You could use optimaze to do this as well(and probably much better).
Optimising vectors will certainly help this technique to work effectively.
I would really hate my animation not being exactly like i intended it, just to optimize...
Oh of course, but if you examine the specific symbols I've mentioned, I think you'll see that simplifying these would produce an imperceptible change to the final look. Also, I've suggested that Moho would have a setting so you can choose how strongly this technique is applied.
Locked