"Using SWF Assets" tutorial (feedback wanted)

I just wrote a “Using SWF Assets” tutorial, I’d appreciate your feedback!

I think it reads too much like documentation than a tutorial, not sure if we should write both, or just reclassify this, or jazz this up into more of a tutorial (with more images?)

Anyway, please let me know :smile:

http://www.openfl.org/learn/tutorials/using-swf-assets/

Thanks!

1 Like

I’m saying this from a beginner point of view, so I don’t know how much reliable this is. :sweat_smile:

The article reads a bit like documentation, but is easy to follow and understand. I don’t think it needs to be rewritten or needs images.

I know there are code examples, but maybe some kind of downloadable example would be nice (well, at least for that var clip = Assets.getMovieClip ("swf-library:"); part)? :stuck_out_tongue_winking_eye:

Cheers! :smile:

I think this is great! All it needs is a cherry on top – a ready-to-compile project including a SWF animation asset all packaged up as a zip.

Wow, I had no idea that using SWF library can be of loaded swf assets as well.

The tutorial is pretty good, but as @yuigoto said, it is written like a documentation. A nice tutorial will take an example project, and show step by step what to do next, until you get the desired result.
But as a documentation it’s pretty good. Only two questions I couldn’t find the answer to:
Are timeline animations supported?
Can this be used with any Tartary loaded swf (I know it’s implied that I should use the library tag, but it’s worth mentioning explicitly)?

Other than this, it’s my first opportunity in this forum to say thank you so much for reviving flash in OpenFl, and thanks so much for your efforts!!

Timeline animation is currently supported in the “swf” format but not “swflite”, more attention could be paid to the performance and accuracy of animation. “swflite” can have animation, if the code is ported from the “swf” code.

Do you mean, will it work with your own SWF files, or do you mean at runtime? SWFLite only works at compile-time (so you can’t load an arbitrary file later) but my knowledge, the library is compatible with just about any SWF :slight_smile:

What I mean about Loading swf files, regards to this:
Loading a SWF Library

Unless you have used preload=“true” in your tag, before you are able to use content from a SWF library, you must load the library first:

  Assets.loadLibrary ("swf-library", function (_) {

    trace ("SWF library loaded");

  }

I must put the loaded file in the asset directory and compile with the library tag? Is there a way to load a swf from somewhere else, not determined in compile time? I mean to html target, of course.

Also, I didn’t understand this sentence :

“swflite” can have animation, if the code is ported from the “swf” code.

Thanks :smile:

Right now, SWFLite supports HTML5, and SWF does not. It’s a blessing though – SWFLite performs a lot better, SWF just wouldn’t ever work well. It’s converted from the original SWF file to the SWFLite format at compile-time, so currently, you do need to have your SWF asset available when building. Making things available to load at runtime could be done later, but right now is not supported.

The “swf” and “swflite” format code share similarities, since the “swf” format code includes support for timeline animation, this could be copied and adapted to the “swflite” format code.

1 Like

I think this is pretty good. Having first tried out the feature just last week, I managed to find my way to get it working with a couple of StackOverflow articles. This is right on the money - thanks Joshua.

Tried using this tutorial to load swf assets (absolutely vital since my sponsor requires integration of their assets and API, can’t get it to work at all, have spent over 2 hours trying to figure it out so far. :frowning:

So far, this is what I have, the library loads successfully, but the “Assets.getMovieClip (“library:intro_mc”);” part fails completely, no matter what tags I add to in my project.xml, tried preload and generate, no luck.

function sponsorSplash():Void
{
Assets.loadLibrary (“library”, function (_) {

		trace("library loaded successfully!");
                var clip = Assets.getMovieClip ("library:intro_mc");
        

    });
}

The .swf I am using does definitely contain a movieclip class containing a properly exported for actionscript movieclip. For some reason it simply doesn’t work, and I get the following error:

Assets.hx:227: [openfl.Assets] There is no MovieClip asset with an ID of “library:intro_mc”

Here is the content of my .swf in flashdevelop:

Any help would be greatly appreciated, I am on a tight deadline to get this work done.

Is it a MovieClip? a SimpleButton? a Bitmap?

Also, does a different Flash SWF work, like the one included in the SimpleSWFLayout sample. Can you get that to work for you?

Got it working, turns out the .fla I was compiling from had some as2 code buried in the movieclip so it never compiled with the class name I gave it. Stripped out all the as2 code, converted the .fla to as3 format and now it works great. :slight_smile:

Awesome! Glad to hear :slight_smile:

:success:

So there is a missing word:

The “swflite” format is faster and generally than “swf”

Generally what?

Secondly, I’d recommend being more upfront about the limitations of the swflite format, specifically about how MovieClips are limited to 1 frame for the HTML5 (swflite) target. I understand that it’s still a work in progress but I think that’s all the more reason to be clear about the limitations.

hello openflists

i try compile sample swf by using swf assets tutorial BUT my apk show NOthing

plz help me . i realy need this feature of openfl .

i also see this tutorial

and this

but apk file show nothing

sorry for my bad English

Hi!

Have you tried other targets yet? Does it work on desktop, Flash, HTML5?

Hey singmajesty, just wanted to say the tutorial helped me alot. With more tutorials like this, that also make clearer how openfl works inside it would be much easier for newcomers to start.

1 Like

Hi singmajesty,

Sorry, I hadn’t realized this thread was here when I posted a new one: Using SWF assets made in Vectorian Giotto

Pretty much just trying to use your excellent tutorial, but instead of with pay-for Adobe tools, the free stuff. :slightly_smiling: Help?

Thanks,
GA

What about ‘type’ and ‘embed’ attributes for the tag? Were they documented?