Blog

  • Huge MC’s vs. Dynamically Built

    2 times in my life have I run into a conund…er, no that word sux. *ahem* …have I run into a challenge of whether to build a movie large movie clip or dynamically build it, showing only pieces at a time.

    The first time was dealing with a timeline at work displaying a 24 hour period which fit on a grid. It was scalable, and as such, if you “zoomed” in your view of an hour, it could easily be 4000px + wide. Since it was dynamically drawn, this was cake to build, but we were unsure of the best way to display. Flash still “deals” with things not being displayed or offscreen with the exception of _visible. If you make something _visible = false, it helps a little, but you still have a lot more overhead when something is “there” and you wish to make a change, either moving something or modifying data. On the other hand, constantly rebuilding pieces of a movie clip constantly via minimal user interaction is resource costly as well.

    It depends though; there’s a sweetspot as I’ve found in my tests throughout the last year from dynamic graphs to tile-based games. So, to prevent you from spending the time that I did, here are some results followed by some conclusions (hypothesis) on the best ways to get the most of out of your dynamic Flash movie clips’ performance.

    <b>Results</b>
    – dynamically drawing strokes vs a movie clip were significantly slower; even just one movie clip with a ton of stokes was significantly slower than one movie clip holding hundreds of instances. Additionally, building a “stroke” via a fill, helped a lot, but the optimal perceived performance by both my manager and I were a fill within a movie clip, which you then attach dyanically as needed.
    – with the above, you lose resolution, even if your fills are on a positive (integer) pixel (x = 5 vs x = 5.68). Strokes are just drawing better regardless of their position while fills, if not exactly on a pixel and not exactly a certain pixel width will anti-alias themselves to the next pixel to emulate half-a-pixel, which looks blurry and non-exact.
    – there’s always a number of movie clips on stage where things start to decline. By this, if your using many of the same components at once, things can potentially start to decline in performance at a certain number, and then quickly go downhill. This number – 1 is what I call the “sweetspot”. It’s where you get the best performance with the most instances. This is different for form type apps, or where you have many different types of movie clips/components on stage, and is more applicable to games and/or animation/transition intensive apps with non-stagnant interactivity.

    <b>Hypothesis'</b>
    – Fills are faster than strokes. Strokes display correctly more often than not while on a non-integer pixel coordinate while fills do not. If you have a choice of using fills or strokes, then use fills.
    – If you can consolidate an interface element into a movie clip, then put it in one, then attach many instances of it dynamically rather than dynamically draw it. This is even faster than just drawing fills.
    – If your doing simple benchmark testing on your own and experience a decline in performance, then mark the number of instances in which performance isn’t adversly unusable. If the maximum instances you’ll ever have is less or equal to that number, then your app can benefit from possibly having them already on the stage to prevent the needless attaching/removing of the movie clips.
    – However, if the maximum number of instances is equal to and beyond what you’ll actually have in your app, then a progressive building/destroying mechnism is better because you can display an infinite number of instances and still have the same processor usage. At this point, it’s all about optimizing that solution.

    A simple example of the former is the Accordion component in Flash Pro; it puts your contents on the pane, and keeps it there, regardless of how many panes you have.

    The List however, draws the same amount movie clips regardless of the amount of data inputted, and simply cycles through the data, moving just it as necessary.

    Both have pros and cons, but hopefully the loose guidelines above can help you save time in choosing an archetecture path.

  • 282 Spam Comments

    *whew* Just deleted 282 spam comments from my blog. Wasn’t easy, mind you, as you have to do each one after the other as there is no list view like Edit Entries in <a href=”http://www.moveabletype.org”>MoveableType’s</a> UI. They were posted from 4:57am to 5:20am this morning, all from some spoofed IP I’m sure.

    I tried using the <a href=”http://www.jayallen.org/projects/mt-blacklist/”>MT Blacklist plugin</a>, but it didn’t work, some CGI error that it couldn’t find a file on his site or whatever. I’ll try again Monday when his(her?) new version comes out.

    At any rate, anyone know how to:
    – disable all commenting ability from an MT site?
    – turn it back on later?

    TIA

  • Compile Whore: FLA on a Tab Corner

    Dude, for real, that’s all a FLA is now. Got deep into Flash last night redoing some of my tile-based game tests. If your designing strictly an app, or a seriously dynamic one, all I have been using the FLA for is compiling, or putting a single breakpoint to start the debugging trail. I pretty much toggle to my class files, and then just hit the FLA to run it. Granted, for the smaller stuff, you really don’t have much on _root, but for bigger projects you would probably use _root extensively; SOMEONE has to start it off, and for me, _root’s usually the controller, even if just attaching a master component.

    However, some things that need improvments:
    – because I’m coding in the IDE, I should be able to put a breakpoint in my AS file; doesn’t have to be saved, but the IDE should know this (worked with Director’s external ls files)
    – having to toggle back to the FLA to compile blows; anyone know a keyboard shortcut mod?
    – rebuilding classes over and over again blows; when is someone gonna make an XUL window using JSAPI that mirrors VB 6’s Class builder?

    I guess for that last one, it’s gonna be me if no one else does, but I got too much going on… come on… someone?

  • UI Hype

    <a href=”http://www.onclipevent.com/archives/enterframe/000408.html”>Navneet over at enterFrame</a> asks is all this focus on cool UI’s is really worth all the hype, in our case, in RIA’s and Flash usage. He references a <a href=”http://www.infoworld.com/article/03/10/17/41OPstrategic_1.html”>Jon Udell article </a>and a snippet which explains rather than bigger tree menus, we need evolution as this method of more data into an existing UI element is not effective.

    Notice I added effective. The more “programmer” I’ve become over the years, I’ve wished to become more effective. When trying to code PHP, I approached it totally different than I approached learning ActionScript, and a lot better I might add. I used resources I knew I had, both people and research wise, and was able to accomplish a lot more in a shorter time frame with better quality code resulting.

    This same attitude I have applied to interfaces more. I want to empower the user to have the ability to get something done. Usability just comes into play to ensure this happens easily. Really, it’s a given though; if they are effectively getting something done, it’s a usable interface.

    This doesn’t mean there isn’t room improvment, though. However, I think it comes down to 2 main concepts, which is maybe how a lot of us got into this industry. Rather than speak for you, for me:
    – I wanted to do interfaces and Flash apps because the things I’ve seen elsewhere were done wrong. I thought to myself, “They did that wrong, I know how to that right.”
    – I think it’d be cool to do an interface for this type of information like this, and this tool allows me to focus on that problem solely

    That last one is the key here: The ability to focus on the problem. I admire web people because they can focus on this ability despite all of the unrealistic technical challenges thrown their way. Rather than focusing strictly on solving the problem of how to display information to the user, they are trying to figure out if the menu they’ve chosen will “display” correctly.

    Uh… Navneet talks about innovation. I’ll admit that necessity is the mother of invention, and that sometimes great things come from strife, but for innovation to really flourish, we need to remove all obstacles and focus on purely our ideas without any outside stimuli complicating the process of research and discovery. That’s why I liked Flash: you can be very creative in your test, and your stuff actually works.

    Now, works technically… doesn’t mean it’s an effective interface, but you can truly judge it from that angle rather than, “Well, … it doesn’t work on Mozilla, so this menu paradigm will have to take a back seat until we figure out how to get it to work.”

    No frikin’ wonder new concepts don’t come to fruition faster. For me, Flash is a great testing ground for real world interface concepts; it’s RAD environment allows you quickly put together your idea and test it. I’ve seen a good deal of interface concepts that have great potential as stanard UI’s, but more so from the games I play. Since I don’t have proprietary 3D engines with C++ skillz to boot, Flash is the next best thing, but one I can easily share with others and get feedback.

    I don’t think things will accelerate enough until we focus more on what can be done and put research into it’s effectiveness instead of if something works under certain, technical conditions.