Reinventing the wheel, using the wheel



  • Below is a real story of me at work

    Reinventing the wheel, using the wheel

    The company I work for does multimedia, especially websites. We got a project to redo a website for a big-shot photographer which he uses to promote his work. His old site, which was done completely in Flash, was handed to us.

    Normally I wouldn't be involved, as I really don't know a lot of Action Script, but our artist who was assigned the project was having a hard time reading the file. So I come in. Upon reading the file I realize that the entire website, content and all, is contained in 4 frames all on the initial scene.

    Turns out the whole website is created programmatically in Action Script. At first I thought this was impossible. I searched high and low for some sign of any common Flash objects like Tweens, movie clips, etc. None were to be found. How was this possible? I thought. Following the code exaction, which consisted of mostly obscure things like background color initialization (maybe they missed the Flash menu option) and hard coded URLs to websites that don't exists, I came upon this gem. The following is the comment header for the function tween():


    /*
    ===============================================================================
    = <movieclip>.tween()
    =
    = METHOD. Makes a given movieclip property(ies) tween from a given value(s) to
    = other one(s).
    =
    = How to use:
    = <movieclip>.tween(property, pEnd, seconds, animType, delay, callback, extra1, extra2)
    =
    = Parameters:
    = property = property(ies) to be tweened (string) (*)
    = pEnd = end property value(s) (number) (*)
    = seconds = seconds to reach the end value (number) (**) defaults to 2
    = animType = animation equation type (string) (**) defaults to "easeOutExpo"
    = delay = delay (sec) to start animation (number) (**) defaults to 0
    = callback = function to be called when finished (object) (**)
    = extra1 = optional animation parameter. (**)
    = means AMPLITUDE (a) when animType = *elastic
    = means OVERSHOOT AMMOUNT (s) when animType = *back
    = extra2 = optional animation parameter. (**)
    = means PERIOD (p) when animType = *elastic
    =
    = (*) = property can be an array
    = (**) = property is optional
    =
    = Examples:
    = ball.tween ("_alpha", 0);
    = box.tween (["_x", "_y"], [100, 100], 4, "linear";
    = menuItem.tween ("_yscale", 200, 3, undefined, undefined, doPlay);
    ..snip..
    = Shortcut methods:
    = These methods do the same as tween(), but in a shorter way. They're
    = pretty much self-explanatory. ALL ARGUMENTS are optional (in a xy
    = function, for example, you only need to pass the x or y argument).
    =
    = <movieclip>.alphaTo(alpha, seconds, animtype, delay, callback, extra1, extra2)
    =
    = <movieclip>.rotateTo(rotation, seconds, animtype, delay, callback, extra1, extra2)
    = rotation is the same as _rotation values, that is, angle in degrees
    =
    = <movieclip>.slideTo(x, y, seconds, animtype, delay, callback, extra1, extra2)
    = x or y are optional (use "undefined" without quotes).
    =
    = <movieclip>.scaleTo(size, seconds, animtype, delay, callback, extra1, extra2)
    = size is the same as _yscale/_xscale values, that is, percentage.
    =
    = <movieclip>.colorTo(color, seconds, animtype, delay, callback, extra1, extra2)
    = use like Flash MX's color.setRGB.
    =
    = <movieclip>.colorTransformTo(ra, rb, ga, gb, ba, bb, aa, ab, seconds, animtype, delay, callback, extra1, extra2)
    = use like Flash MX's color.setTransform. all values are optional.
    ===============================================================================
    */


    If you're wondering what a tween is. It is a Flash object which transforms in some way, including color. The ridiculous part of this whole website is that Flash has a nice interface for creating and manipulating tweens. It shows you real time what is going on, and allows you to edit tweens in real time. It's easy to pickup from someone else's starting point because everything is nicely laid out in the GUI.

    For some unknown reason the previous developers of this website decided to reinvent the tween object, within the very environment that defines tweens. Now instead of controlling tweens in the nice WYSIWYG Flash environment, they are controlled using code in Action Script. It's no wonder why the artist couldn't read the master file.

    Looking through the code more, I was desperately trying to find a reason why the original developers did this (especially before submitting it to tdWTF). Below are the 'features' (their words) of using a programmatically controlled flash movie (caps are theirs too):


    = * IT'S BASED ON TIME, NOT ON FRAMES.
    Flash lets you set the fames per second. By their logic, programmatically controlled tweens saves you a divide calculation if you want to do things based on time.


    = * YOU CAN TWEEN SINGLE PROPERTIES AS WELL AS AN ARRAY OF PROPERTIES.
    Their explanation was that you could do multiple things at the same time, for instance scale, move and rotate at the same time. Apparently they missed the fact that Flash's GUI already does this.


    = * IT HAS SEVERAL SHORTCUT METHODS TO AVOID UNNECESSARY RECODING.
    Apparently they were trying to skim down on their unnecessary recoding.


    = * IT SAVES THE WORLD (TM).
    Yes this was in the comments.



  • The explanation is simple:  "job security".  There wasn't enough work to do, so someone took the initiative to create more work to do.



  • This is like a Moebius belt of wheels.



  • @kiriran said:

    there is no wrong or right in flash. it just depends on your "flashing style"


    My flashing style usually involves an easily unbuttoned trenchcoat.



    What?



  • It's like building your own "Ok/Cancel" dialog in assembler.



  • perl -e "foreach $ch (split(/,/,qq(97,119,97,105,116,105,110,103,32,105,110,115,116,114,117,99,116,105,111,110,115))) { print chr($ch); } # TheWaitMachine "
    


  • That's really getting tiresome.


Log in to reply