Category: Flash

  • Putting the Com Dot in “com.business”

    As my journey continues in learning about working with other developers, I ran into the com. prefix question. A lot of Java people I had asked about why do they do that prefixing of com to their class paths replied, “Because it’s industry common practice.” Hogwash… OOP is industry practice, right? Bleh.

    People who say things like that to me quickly turn me off to doing the “common practice”. It’s the same reason my math teacher disliked me in her class in school; I’d always ask “I know we’re solving a problem, but what problem is this equation solving?” I always wanted to know why algebra and geometry was important; where would you use it, and if her answer didn’t suffice, then screw it, why waste time on it?

    I’ve grown a tad more mature since then; instead of asking 1 person, I ask many. I know someone’s got the answer, it’s just a matter of finding someone who does, or who does AND is willing to part with it.

    I figured since Macromedia doesn’t do it, and I see no point of com, why should I?

    One of the developers I work with who is helping me replied:
    – in java, if you deploy code bases server-side, you’ll have different packages for different projects and/or server configurations. So, com will be for the site.com, whilst org. will be for the site.org; the open source version.

    So, it’s more about an implementation detail made more encapsulated into a high level package path giving it name and purpose vs. “just because everyone else does it.”

    Granted, Flash code doesn’t get deployed server-side (but Flex does, and I’ve made Central run as a server…), but it does get deployed client-side. Case in point, if we decided to release an open-source version of our code from here at work, we’d release it as org.roundboxmedia instead of com, since com applies to our commercial products that either we own, or the client does (although, from my understanding, we own most of the code and sell it as various products), whilst org would be us supporting an open source initiative(s).

    So:
    – name context helps in server deployment
    – name context helps in code distribution to various clients

    That was enough to sell me!

    * B, sorry for the late response; took me awhile to gather my thoughts on this.

    Anyone else got other reasons?

  • MXDU 2005 Presentation Notes

    Here are my presentation notes from MXDU 2005. I don’t have much explanation about the code, but the gist is I’ve provided 3 Flash examples of how to get stock information into Flash:

    • Screenscraping with AMFPHP
    • Using a webservice
    • Using Flashcom which uses screenscraping with AMFPHP

    The Flashcom version does not have all the bells and whistles that concrete the point of it being a superior way to garner data from your Model tier by doing 1 database hit, caching the data, and reducing redundancy by pushing to mulitple clients, nor scaling the frequency of those updates to clients. If it did, I’d sell it since any would pay for a technology to effectively turn 10,000 database hits a minute to 1 big one across a cluster with all clients getting pushed data in real-time… wouldn’t they?

    Additionally, my speech wasn’t recorded live since I didn’t have an AV whatever adatpor for DVI, so it’s recorded later, here in the states since I had to turn it in for Speech class.

    I’ve included my presentation FLA file so you can see how it’s built as well as my slides in PNG format for easier viewing. I’ve used the MediaDisplay component’s addCuePoint functionality (although I could of used the Component Inspector which has a nice Flash interface for me to do this, I was in a hurry, and did it via code… yes, I know, that sounds backwards).

    Please note the comment about Flashcom on devices is incorrect; I currently do not know of a device that supports Flashcom, Flast Lite wise, and I’m not sure if Flash 6 or Flash 7 for Pocket PC supports Remote SharedObject or not.

    MXDU 2005 Speech – ZIP

    MXDU 2005 Notes – ZIP

  • Compile Flash From Dreamweaver/FlexBuilder

    Those of you who have used SciteFlash from bomberstudios.com know that one of the key features of that editor was its ability to cause Flash to compile directly from SciteFlash’s coding IDE. This way, you could code like normal, and press Control + 1 to cause Flash to test movie, just like you would do Control + Enter in Flash to test movie. This was beneficial because you didn’t have to ALT + Tab (or click on Flash in the taskbar) to switch to Flash just so you could compile.

    I’m using Dreamweaver, just like I did in Flash MX (because Dreamweaver had tabs back then, Flash didn’t), because I’m doing some crazy re-factoring, and Dreamweaver has some awesome find and replace features. …however, same problem; don’t want to switch to Flash just to compile. However, I have a JSFL folder in my class directory that I’m viewing in Dreamweaver’s Files panel (which is what Flash’ Project Panel should be). I dropped a JSFL file in there called “compile.jsfl” that just does:

    fl.getDocumentDOM().testMovie();

    All I have to do is double-click it in Dreamweaver, and it’ll go back to Flash and compile my only open FLA. Haven’t figured out how to map to a Dreamweaver keyboard shortcut yet, but anyway, awesome!

  • Changing MovieClip Class Name via JSFL

    Re-factoring your classes’ package path isn’t so bad. With 1 find and replace command in Dreamweaver/FlexBuilder, you can change it from “company.” to “com.company.” in just 3 seconds on all of your classes without having to open all, or any of them.

    …this isn’t so easy with MovieClips in Flash. FLA is binary, and to access the AS2 class name, which associates a MovieClip with your class, you have to right click on a symbol in the library, manually change the name in a cramped text input field, and click ok… then repeat this for your other 39 classes, or more.

    Or you could use JSFL. Programmer I work with educated me why you prefix class paths with “com.” and “net.”. I’ve forgotten why it’s important, could of sworn at the time I had an epiphany of understanding, but regardless, here’s the code to quickly change all of your AS2 + linkage ID’s to point to a new class path/linkage ID name. I include linkage ID because typically your linkage ID and AS2 class path are, and should be, identical.

    function d(o)
    {
            fl.trace(o);
    }
    
    function init()
    {
            fl.outputPanel.clear();
            var i = fl.getDocumentDOM().library.items.length;
            while(i--)
            {
                    var linkage = fl.getDocumentDOM().library.items[i].linkageIdentifier;
                    var className = fl.getDocumentDOM().library.items[i].linkageClassName;
                    var testingString = className;
                    if(testingString != null)
                    {
                            if(testingString != "")
                            {
                                    var a = testingString.split(".");
                                    if(a[0] == "roundboxmedia")
                                    {
                                            a.unshift("com");
                                            d("old:");
                                            d(fl.getDocumentDOM().library.items[i].linkageIdentifier);
                                            d(fl.getDocumentDOM().library.items[i].linkageClassName);
                                            fl.getDocumentDOM().library.items[i].linkageClassName = a.join(".");
                                            fl.getDocumentDOM().library.items[i].linkageIdentifier = fl.getDocumentDOM().library.items[i].linkageClassName;
                                            d("new:");
                                            d(fl.getDocumentDOM().library.items[i].linkageIdentifier);
                                            d(fl.getDocumentDOM().library.items[i].linkageClassName);
                                    }
                            }
                    }
            }
    }
    
    init();