« Adobe and HTML5"The World is Moving to HTML 5" and Other Flights of Fancy »

16 comments

  1. § Iain Email said on :
    All great points, which is why I stick with fla compiling where possible. Fla compile is slow - slower than it needs to be as it always recompresses assets for no good reason - it could easily cache them somewhere. The biggest problem though is when the designer and developer both want to make fla changes on the same day. XFL should go some way to address that. Still works for me better than flex sdk and there's great coding support in flashdevelop. I do mostly games.

    As for the swc method, I think the idea is to leave auto declare stage instances on, set a non-existant class in the library and let flash pro generate classes with this hierarchy tree generated for you. Then you use composition to access this different parts.

    Overall it's a mess caused by the flash/flex schism. I don't think any other technology handles this better, but they don't have to deal with the awesome richness of the flash animation tool.
  2. § MakerOfGames Email said on :
    Hi Richard,

    There's one more work flow that I've used that I really love. I picked it up from the workflow docs over at flashdevelop.org.

    You can export your FLA as a SWC as in step 1. This allows all the keeping of nested timeline actions. I usually don't like to tolerate much more than stop actions, but the artists I work with have their own opinions on things and I try to meet them half way.

    Unlike workflow 1 you do NOT link the symbol to a custom class. Instead you keep the default base class and have Flash autogenerate a class for the symbol, e.g. (I'm not describing it well, but I think you know what I mean.)

    Then, create a custom class in FlashDevelop that extends (or composes) the autogenerated class. I.e. MovieClip FooClip in Flash library has a linkage name of FooView. In FlashDevelop You create your.package.Foo which extends FooView.

    your.package.Foo is a first class member of your MXML compiled application, but the artist doesn't need to know anything about it, cannot screw up the class path publish settings, etc.

    There are a couple of downsides, but this comment is getting long in the tooth. Maybe I'll do a write up over at my site makerofgames.com.

    Overall, I'm quite pleased with this workflow and I encourgage you to try it out. If I can find the link to flashdevelop's docs I'll let you know.
  3. § Aaron Smith said on :
    In my experience, you'll never run into a flash project that doesn't have at least one fla. So why avoid them?

    When you diverge into experimental ways of building projects you'll actually waste more time for anyone who is receiving the project. And chances are the person who's receiving the project will open up the fla's and start publishing.

    And now that you've handed over a project that isn't documented, the person who opens up the fla won't be able to build it.

    In my experience it's easier to stick with fla's. When you hand over a project to someone else it's almost guaranteed that their machine won't be able to build the project without you showing them how.

    My favorite process is to stick with run-time loading. It's easier to partition the site, application, or whatever into modules.

    When you try some of these experimental ways of building, a lot of times code for non-related modules will get included in every swf.

    In the end I'd say stick with runtime. It's easier down the road to change when swfs are loaded, or when classes become available through swf libraries.

    The other solution that is missed: runtime loading plus the Flash 8 exclude classes. But Adobe can't seem to figure out that this workflow was useful. Come on ADOBE! Get exclude classes in Flash!
  4. § Richard Leggett® Email said on :
    Thanks for these excellent comments.

    @Iain - I think you hit the nail on the head in your last sentence. After spending a year in Flex and recently working with the Android SDK, I was left feeling like this whole process is broken with Flash, but it's more the case that it's only with Flash that you have this unique code/timeline combination that's awesomely flexible, but at the same time incredibly hard to integrate into a more traditional, strict code environment.

    The closest parallels are probably Unity 3D, which doesn't suffer half as much because in general, 3D assets are more self-contained, and Microsoft's Expression Suite for Silverlight/WPF. The coding tool is Visual Studio, the "Flash Pro"-like application is Expression Blend, which has a timeline for animations, behaviours, actions etc. The timeline however is not frame-based, it's more like After Effects (or the newer animation methods in CS4).

    The key thing with Expression is both tools open the same project files, and that the project files are all XML/code. This both fixes the one problem and introduces a new one; the capabilities of the animation tool simply does not allow for the kind of per-frame-based hand cranked animation you see in Flash without producing reams of XML, and it doesn't do shape tweens.

    As you say I'm hoping uncompressed XFL will provide a better way of working between the tools in the same way as XML/XAML/CS does for Silverlight, even if there have to binary blobs in the XML or referenced by it.

    @MakerOfGames - I like your suggestion. The only thing is I think we'd still be losing the ability to nest items in a symbol (e.g. "MyForm" contains an instance of another library symbol, a "MyButton", which needs a class of its own to control its state). Perhaps you know if this is possible.

    @Aaron - Absolutely, in the first part of the post I mentioned handovers and maintenance exactly for this reason. I believe that if you can't checkout a project from SVN (or just copy it from disk), open it in 1 tool and hit compile, you've overcomplicated things; file paths should all be relative for example.. in my Flex projects I end up manually editing the "hidden" files to change any absolute paths because although I work on a Mac, many people I work with are on PCs, or are using a different application/SDK path. SWCs should also always be included with the project and not referenced on c:\libs or something crazy like that.

    A small readme.txt which says they need to publish an FLA when graphics are changed is kind of acceptable, but clearly if you're using FLA and AS3 projects, things are still going to require some explanation given how many techniques we have here.

    Runtime loading works OK for me for some things (fonts for example) but it still suffers from most of the problems outlined and you lose many of the nice features of Flash/Flex Builder like jumping to the definition of a class, particularly if you're using loose typing to access the stuff within the SWF.

    I've always avoided using methods that involve excluding classes, sometimes just taking the hit on file size to avoid having to write a tool with ANT/ruby etc to do the job, you're right, it's a little bit of a problem. Thanks for your comments.
  5. § Jerome Email said on :
    Great read!

    I most often use option 1 for production. I do embed assets in classes in Flash Builder for demos or exploration.

    Since I am a one man operation, I make sure my designer side doesn't code in Flash CS4 and let my developer side do it all in Flash builder :)

    I also like having all my compile time assets in one FLA file.
  6. § Kyle Rodgers Email said on :
    We make games/apps with FDT and what we usually do is pretty much what MakerOfGames suggested, except that we always instantiate the symbols within custom classes rather than extend them.

    E.g. var timeline : TimelineAnimation = new TimelineAnimation()

    If TimelineAnimation has a button or something in it that needs managing by a class, I'll create another custom class in FDT and just pass it a reference to that button within the animation.

    E.g:
    var timeline : TimelineAnimation = new TimelineAnimation()

    var button_manager : ButtonManager = new ButtonManager( timeline.button );

    Then the ButtonManager class can handle anything to do with the button.

    This workflow works really well for us, letting us nest whatever we want within our Flash IDE MovieClips and it all works fine.
  7. § Richard Leggett® Email said on :
    Thanks for sharing your workflows, all very good points.
  8. § zwetan Email said on :
    I use a lot the "Publish SWC from FLA"
    with what @MakerOfGames describe

    in short, name your exported symbols and use only builtin classes
    (MovieClip, Sprite, etc.)

    for ex: com.test.MailUI

    then in your pure AS3 code you just reuse the gfx assets
    class Mail extends MailUI

    and there your code editor will have code completion on all the different elements defined in the UI

    some people may consider it "bad" that they will have to do
    the wiring (events, interaction etc.) of the UI in pure code
    but to me it's better ;)
  9. § Scott Enders Email said on :
    Excellent article Rich.....lately I've been experimenting with different ways of getting assets into my projects. I try to do is stay away from using Flash to generate my assets as much as possible. At work, we have an automated build process set up that auto-magically builds the entire project and its dependencies. This way anyone is able to build and run the project once downloaded from subversion. Unfortunately there isn't a nice easy way to automate the compiling of a *.fla file.

    I am mainly working on Flash games and many of the graphical assets are bitmaps and sequences of bitmaps. If I can, I like to use something along these lines for the bitmap sequences:

    http://blog.hexagonstar.com/animatedbitmapclass/
  10. § Felix Email said on :
    #1 FTW. It's not perfect but it's more robust than the other options.

    A pro you missed for #1 is that FlashBuilder will do code completion on all the nested MCs in your FLA symbols and throw errors for missing MCs.

    If you keep your FLA code to an absolute minimum (typically just a few stop()s) then some of your cons go away.

    I give a little more detail on this method here: http://www.airtightinteractive.com/news/?p=327
  11. § Richard Leggett® Email said on :
    I'm going to edit the post to include these extra links, fantastic.
  12. § vitaLee Email said on :
    i've been hitting this wall lately and eventually i've stuck with Kyle Rodgers offered.
    once the visual representation of the assets is ready and compiled in the swf i have to work only on the model side of the concrete component.
    lately i've been sticking to the "separate model from view" practice, which is great as it kind of forces you to eventually write more reusable code, and on the other hand freeing you from the chore to recompile your library fla, everytime the code concering the assets changes.

    http://www.bit-101.com/blog/?p=2173
  13. § Toby Ashley Email said on :
    ello,

    Interesting post.

    Just wondered if you'd found a workaround for the 'nested instances' issue when using SWF or SWC linking?

    I often use the composition method described by Kyle for nested items, but sometimes a quick and dirty way to preserve class associations would be preferable. Any suggestions?
  14. § Richard Leggett® Email said on :
    Hi Toby,

    Yeah the whole nested thing quickly gets complicated so I ended up just publishing in Flash (via ANT->JSFL so I can pretend I'm still in the same IDE!).
  15. § JLM Email said on :
    Runtime composition allows.

    1) Isolated compiling.
    2) Simple visual layout placement.
    3) Code/Graphics isolation making it easier for more people to work on the code and graphics.
    4) Code is often small enough to be used as preloader
    5) Code can be a AS3 or haXe structure, I have similar structures for both, and could swap out all the AS3 for a haXe code swf without any change to the graphics swf.
    6) Easy typedef or -remap when using haXe, so you start to code with an eye to targeting other platforms.
    7) decoupling of visual structures from logic, allows you to order your depths and masks differently from how you wire up button state logic.
    8) View granularity can be how you want, ie you don't have to have a class for each MovieClip button. You can sometimes create a view to handle a set of buttons.
    9) If you place all you main linkage MovieClips in a layout MovieClip, and loop through the layout's children then you can easily check assets exist. If you use a Static class to access them off you can treat it the same as the library, I tend to wrap the xml into an abstraction of getters and access them off a Static too... I know its like using root, but saves passing application wide aspects around classes, although this part is new approach.
    10) It seems to work well for me :) I am a fan of KISS that is also why I don't use flex or normal components, although I would like a an alternative.
  16. § Jacob Bullock Email said on :
    you have actually missed one of the amazing things about workflow number 4. I have been using this workflow for a very long time and what's neat about it is that you don't have to do:
    var myClass:Class = loader.contentLoaderInfo.applicationDomain.getDefinition("com.package.MyClass");

    You can if you want to, but the way this is loaded in, and assuming you aren't messing with the applicationDomain when it's loaded... if you have a library symbol that has a class linkage or a base path to a class that is in your flash builder project, when you do new MyClass() it will actually use the assets from the loaded swf without using getDefintion(). Now if you have a class that is exported in the library that isn't related to a class in flash builder you will have to use getDefinition.

    The biggest down fall i have seen with this workflow is that timeline animations in objects that are exported for AS seem to lose their timeline scripts. 99% of the time this isn't an issue for me. The way around it is to make the timeline animation a child of the exported movieclip. The other thing to keep in mind is that you should always have "auto declare stage instances" disabled in the fla.

    One other really cool thing about this is that if you aren't using base classes for any exported objects your fla doesn't even have to have a class path pointed to the code. When the swf is loaded all matching class paths just work together.

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
Contact. ©2010 by Richard Leggett. blogging software / hosts UK.
Design & icons by N.Design Studio. Skin by Tender Feelings / Skin Faktory.