Category: Flash

  • Faster Compile Time / Test Movie via SWC

    Werkin’ on a project this weekend where separating the audio to a level wasn’t an option because I needed the code to be simple. It was a simple slideshow with synced (streamed) audio, and the deadline was tight. The problem, though, was each test movie took a long time. Eventually, I’d change the audio compression to RAW just so the compile times were better, but a 4 meg mp3 even at RAW compression still took about 10-20 seconds on my 800 p2.

    I managed to get the main interface and all it’s parts to be consolidated into one SWC. This was really nice as I could reuse it in other movies simply for it’s interface, since unless you setup event listeners, it didn’t do anything.

    Frustrated post project on how to make things more efficient, I tried to do some SWC tests this morning with audio. First thing I forgot was that SWC’s, are in essence, SWF’s. Flash will merge them with the SWF your compiling too. Since an MP3/Audio file that is merged with the timeline, and only the timeline won’t export into your final movie. Thus, it gets compressed twice. So, I set its linkageID, and tried that. Even though the same 1 meg SWF went from 3 minutes (mp3 64 bit Best) to 3 seconds, the audio kept getting recompressed. Not really sure why, since I set the audio via the mp3 itself in the source FLA, and didn’t have override audio compression settings checked in the Publish settings.

    At any rate, what I did conclude is that for anything I can consolidate into an SWC greatly expedites my development time, whether for programming projects or others. Besides, most non-programming projects have a plethora of library media of graphics, bitmaps, text, ect, and it’s nice to have just one symbol to deal with. The time savings in compiling from using SWC’s for non-programmatic content is definitely worth investing time in to learn and test them out. Multiply 3 minutes by how many times I typically do a test movie in a typical development session, and then change that number to 3 seconds… you can see how much more efficient you can get if you implement this solution across the board.

  • JSFL: List Frame Labels

    Finishing up a project which consists of a series of Flash presentation SWF’s. The controller that plays them uses an XML file to determine what SWF’s to play as well as what their frame labels are. Since I have to document this manually, and some of the SWF’s have timelines between 7 to 10 thousand frames long, scrolling to find them is tough. Thus, I made this script to list them for me. Assumes you have a layer named “labels”.

    show frame labels – JSFL

    function init()
    {
            var doc = fl.getDocumentDOM();
            var tim = doc.getTimeline();
            var l_array = tim.layers;
            var i = l_array.length;
            while(i--){
                    var lay = l_array[i];
                    if(lay.name.toLowerCase() == "labels"){
                            var f_array = lay.frames;
                            var s = "";
                            var last = "";
                            for(var f=0; fif(f_array[f].labelType == "name"){
                                            if(f_array[f].name != last){
                                                    s += "frame: " + f_array[f].name + ", number: " + (f + 1) + "\n";
                                                    last = f_array[f].name;
                                            }
                                    }
                            }
                            fl.trace("*** Frame Labels ***");
                            fl.trace(s);
                            return;
                    }
            }
    }
    
    init();
    
    
  • Can’t Export AS2 Classes in Frame that Doesn’t Exist

    They thought of everything… your probably like, “Duh, Jesse…”. Hey man, that’s neat. Your so smart. d00d, it’s late, and these things are fascinating this time of the night.

    If you have your AS2 classes export in frame 2, but have a 1 frame only movie, you get this error:

    “WARNING: The Export Frame for Classes specified in the Publish or Export settings, frame 2, does not exist. No bytecode for ActionScript 2.0 classes or interfaces was exported.”

    Thank you Flash!

  • Save as MX AS2 Gotcha

    If you have a Flash MX 2004 file your saving as MX, and it detects your using AS2 in the FLA, it’ll comment out the ActionScript, even if some of it is valid. Just something to watch out for. Just so we’re clear, I would have assumed it would of either removed the offending code, refused to compile like MX did for Flash 5 stuff, or brought you to the offending area to manually fix before compiling.