Category: Flash

  • Failed Component Preview Command

    Another one of my cast offs from the lab. This one started from a change in development. I’ve started creating more SWC’s within SWC’s rather than a bunch of Shared Libraries; this allows me to compile faster in the later stages of a project. The issue is, unit testing is severly impeeded early in the game, because I’ll usually have one file with all the classes in it vs. a FLA for each class. Therefore, my compile times get worse and worse as time goes on. What I’ve been doing to solve it is make a new FLA, and create a movie clip, fill in the class info, and test that. However, this gets tedious to do over time. Saving a FLA is an option… but I don’t like various versions of my MC’s hanging around since I massage my package (gross) structure early in the game.

    So, I figured, why not just creat a quick jsfl script to make a new FLA, create a movie clip, and test it?

    …well, it worked in theory…

    I quickly found that this solution was only good for classes that didn’t require sub-classes. I always start small, but these things get so big (gross). So, I started adding in logic for defining sub-classes if applicable. However, even though I found some good XUL documetation on the web + using examples from a few extensions I have installed, none of them used code… and the ones that did were not XUL, but instead Flash Panels (a SWF running in a window inside of Flash). I found that a lot of XUL can be scripted with JavaScript, in our case, JSFL. …however, I quickly found the scope is in it’s own memory space. It’s weird; it has references to the app (app/App/fl/flash), and even has references to it’s own XULMI return object, plus any others created, as well as theTool (??? gross???). There was no way I could hack to get a reference back to the original jsfl calling script (the one that called the XUL dialogue). The bottom line was, I could put JSFL code in the button’s oncommand attribute, but it wouldn’t populate the listbox I made, even though it traced out as a valid property.

    <button label="Add" oncommand="fl.trace(‘sup’);" />

    “Fuggit”, I said as I made a Flash Panel instead. I then ran into another problem; base components. You cannot simply include their classes; you need the base SWF, or in this case, the base SWC file. So, I proceeded to make an interface that allowed you to add those too. A lot of my components use the drawing API, so AS alone is good for the above.

    However, my final brick, and fatal wall was fl.componentsPanel.addItemToDocument. That damn function only attaches components to the FLA where the JSFL script was called from, even if you set the new document to focus. I tried everything I could think of (focusing more than once, doing weird things to the document object, saving it, closing it, focusing it 5 times), all to no avail. This test scripts shows an example. Create a FLA, run it twice… it’s always one doc behind…

    var doc = fl.createDocument("timeline");
    fl.setActiveWindow(doc);
    fl.componentsPanel.addItemToDocument({x: 0, y: 0}, "UI Components", "Button");

    I tried my damndest to figure out a hack, and then just surrendered in defeat. Did I mention I hate losing? Just so we’re clear.

    Hopefully, some of you can learn some JSFL/XUL/Flash from this failed attempt at becoming more productive.

    File structure is explained in the zip.

    Failed Preview Component – ZIP

  • Dimensionalize Your Arrays w/ DataProvider

    Ok, I had no idea you were supposed to do this. Or maybe I came through the backdoor and read the instructions in the wrong order. At any rate, it seems that DataProvider (mx.controls.listclasses.DataProvider) has a method called addItemAt. If you try to add an item to an index that is greater than the array’s length, it won’t add the value. Now, Flash will do this just fine for you. If you have an array that is empty:

    cow = [];

    And you decide to add something to position 10, you can:

    cow[10] = "moo";

    What’s jacked, is DataProvider won’t. So… I guess the trend now is to dimensionalize your array’s length so that method will work properly?

    mx.controls.listclasses.DataProvider.Initialize(Array);
    
    cow = [];
    cow.addItemAt(9, "moo");
    // Cannot add an item past the end of the DataProvider
    trace(cow[9]); // undefined
    cow.length = 10;
    cow.addItemAt(9, "moo");
    trace(cow[9]); // moo
    

    It works when I do some tests here… it just seems so… VB’ish.

  • Choosing a Flash Event Engine That?s Right For You

    What event engine is right for you? Read on to find out! Careful, she’s a long one…

  • How to Disable Floating Flash Ads

    *** Update, it appears Macromedia already had a mechinism in place for you to set this… but left it out for some reason!? See the comments in this entry (exactly 1 year later… whack yo!). I guess advertisers would get pissed if you could easily turn this off.

    The property to see if Flash Player has windowless mode off (meaning, you are blocking floating Flash ads) is:

    System.capabilities.windowlessDisable

    Naturally, it’s false by default. If you save the mms.cfg file with the steps below, it’ll trace out true… even in the IDE.

    ***

    Via ASVGuy & Gregg Wygonik

    Gregg found some documentation in the Flex LiveDocs on how to disable the Flash Player’s auto update feature. This is helpful for IT Admins.

    Burak KALAYCI(ASVGuy) dug a little deeper, and explained a little bit about the mms.cfg file and how it works for those admins. He ended on the property responsible for allowing the playback of Flash movies that have their wmode (window mode) properties set to transparent or opaque. The former is what allows the Flash adds to appear over web pages.

    As a Flash developer, I’d prefer you not installing Flash blocking software, so below is how you do it. This may cause other problems with existing, legitmate Flash applications, so make a shortcut to this file so you can easily turn it off again. Opaque Flash movies, as Gregg said, will appear as a black square. I do not know, currently, if this works only for the Flash 7 player in Internet Explorer, but it’s a start.

    1. Find your required folder:

    Windows NT, 2K C:/WINNT/System32

    Windows XP C:/WINDOWS/System32

    Windows 95, 98, or ME C:/Windows/System

    Macintosh /Application Support/Macromedia

    2. Make a text file in the folder called “mms.cfg”

    3. Put this text in it, and save it

    WindowlessDisable=1

    Tested here, and it appears to work for both opaque and transparent Flash movies. Just to help Google out, here are some other keywords as they are also called “floating flash ads”, “flying flash ads”, and my favorite “those damn Flash ads!”.