How to use swflite


#2

it should work on all targets, without legacy (or with if you want)


#3

when I use: type="swflite" the compiler get stuck, when use: type="swf" all works fine, but I want to use “swflite” because the “swf” is too heavy,

Dont know what is the problem, the swf lib is generate in flash css6


#4

Are you sure the compiler gets stuck? I have experienced that it takes VERY long time to process a swf file for SwfLite. In my case it took about 40 minutes on Windows and even longer on my Mac Mini - but it actually finishes if you are patient.

However this is not very pleasant to work with so I investigated it a little today and reported the issue (https://github.com/openfl/swf/issues/77) and I also created a pull request that I think solves the problem (https://github.com/mikkelmr/swf/commit/e12348cfb64fb0ae8c5df0353c49a931f3270e7e).

In my case it now only takes around 30 second to process my swf library with that change. I would be nice though to hear from some of the regular contributors if this is a valid change. I cannot really guarantee that it doesn’t have any implications or unwanted side effects.


#5

When I use Neko with Swflite:

DefaultAssetLibrary.hx:708: Warning: Could not load asset manifest (Invalid call) Assets.hx:413: [Assets] There is no String asset with an ID of "libraries/FrogAssets.json"

When I use Neko -Dlegacy with Swflite:

Yes you was right, it takes a really long time to start process


#6

I wait and the swflite neko -Dlegacy get copile, but now got new issue:

Inside my MovieClip i got 3 frames (MovieClips in every frame):

1 Idle
2 Walk
3 Attack

But now when I use:

Player.gotoAndStop(2);

it just show the first frame of this Walk MoviClip, and the same to idle and attack…


#7

Are you using swflite for animation?

I don’t think it’s recommended to use it for animation, it’s more useful as a template system.

If your movieclip is not animated (you are using it just for states), there are some bugs with swflite (swf is ok on flash target and I think you can even animate). Sometimes you have to try a different way to embed your states (my own feedback, part MovieClip).

For animation, it’s more easy and more performant to use a Spritesheet/Tilesheet or Spriter.


#8

@loudo could you elaborate a bit more on “there are some bugs with swflite”?


#9

The bug I’m talking about is the same as described by Vicente. I have described a workaround in the previous link.

There are also problem with negative scale or rotation that appear wrong (especially when using nested clip).


#10

@loudo nice to know. Have these issues been reported in the repository?


#11

Not everything yet.

Here is one (problem of gotoAndStop not creating object) : https://github.com/openfl/swf/issues/81


#12

Hi @Vicente_Fleitas can you test my git repo, it should fix your issue.


#13

I need to copy the run.n of the swf 2.2.0? to make your git work?


#14

Yes. Then you need to compile tools/build.hxml once before compiling your own project. (Sorry I had forgotten that :slight_smile: )


#15

still show just the first frame of the nested Movieclip;

how I compile the tools/build.hxml ?


#16

In FlashDevelop, I make a right click on it and choose “execute”.
I think you can also compile easily by double clicking on it !
Alternative method on command line : haxe build.hxml

It’s a neko compilation, so you need neko installed. You need some haxelib libraries as you can see on the file (openfl, lime, swf, format).


#17

This is only if you’ve set up the file association. If not, first you’ll have to tell your computer to open it with haxe.exe. (Recommended because it’ll make your life easier in the future.)

The command line option works either way.


#18

after install haxelib install format
the dobleClick in build.hxml works :slight_smile:
well i did a fresh compile of my project and still show just the first frame of the nest MovieClip


#19

Is it possible to send me a sample of a movieclip that doesn’t work for you? Because my fix works for me -at least- but it will be great to see how we can improve swf library.


#20

can I send my swf file?


#21

Yes send me a swf. I’ll try it.