Blog

  • New Search: No More Atomz, Hello Google

    I first started using MoveableType’s built in search for users to search my site. Then it broke.

    Anu told me to use Atomz.com as their search was free. They have some interesting reporting tools, and while it does help me focus the writing of my blog content based on what people are looking for, it wasn’t that beneficial overall. Not only was the crawling of my site a manual process that I had to do, but they had a limit on the number of pages that I was allowed to have their product crawl unless I was a paying member. They then started inserting ads in my search results, but didn’t pay me to host their ads.

    Google’s Adsense for search also allows you to maximize your earnings by providing the Google search engine to search your site, but you can customize the appearence of the results, have the google search engine interface be on your page, and utilize adsense in the search results. It appears Google has just as good, or better search query reporting tools compared to Atomz.com.

    If you experience any problems, let me know; I believe using Google’s search engine will improve the searching experience on my site.

  • Flashcom AudioConference Component Converted to Flex

    Apparently I’m the only one who codes on a Friday night when your school is cancelled the next day because of an impending ice-storm of doom because I live in a hot state that has 2 salt trucks to its name and people drive 80mph when ice is falling from the sky because they aren’t yankee born like me… because I asked if anyone had converted the AudioConference component from Flashcom to AS2 on the Flashcom list. No responses, so in my impatient manner, I just converted it. I think it works ok :: shrugs ::. I had to rename the .asc file 2 because Flashcom kept loading the other one; apparently the Rhino JavaScript engine is case sensitive, but not via the load command. Go consistency.

    Anyway, here’s the source; if you need this for Flash, it shouldn’t be too hard to convert over; just keep in mind I’m using a canvas with addChild/destroyChild to managed the creation of movie clips for managing the NetStream’s sound objects; you can change it back to movie clip creation if you wish, just 2 lines of code.

    AudioConference for Flex – ZIP

  • Flex & Central: Single State Based App, 2 Different Designs

    One technique I showed last night at my presentation on Flex for Flash Developers I didn’t explain the significance. When installing applications into Macromedia Central, if you add additional applications tags, it’ll install multiple applications, all from 1 product.xml file.

    However, 1 of my applications merely operated in a different state. If you are a presenter, the components have additional controls to allow a presenter to do things that a viewer cannot. Each component follows the loose interface of “I’m a Presenter or not”. It’s merely a boolean. However, I was having a hard time making them look different. Since the functionality is significantly different depending on the user’s role, it has different branding.

    Another problem is that Flex compiles the CSS file you use to style your app at compile time; there is no dynamic way to change CSS styles at runtime… but you can use setStyle to change the style properties after the fact.

    And that’s just what I did. Observe the 2 following screenshots (click on them for larger view):

    DM Version

    Player Version

    Each app is the same code base, just configured differently by the product.xml. The DM version is a presenter based tool, whilst the player one is not. The DM has a red background with a different logo and program icon; the player version has a blue background with a different logo and program icon.

    The way I got this to work is to utilize the initialData tag in my product.xml file. When your application starts in Central, the onActivate method gets the data you put in your product.xml file as XML passed into it as a native ActionScript object. In my case, for the DM version, I made a “runmode” variable equal to a string value of “dm”. For the player application, it equals “player”.

    The DM application XML:

    <initialData runmode="dm" />

    The Player Application XML:

    <initialData runmode="player" />

    When my application starts, the onActivate handler determines what mode the application is running in and styles accordingly. In this case, it sets the background color and the logo image. The Central installation process via the product.xml has already assigned the correct icon.swf files for use in Central itself.

    The onActivate handler:

    public function onActivate(shell:Shell,
                               appID:Number,
                               shellID:Number,
                               baseTabIndex:Number,
                               initialData:Object):Void
    {
            this.shell = shell;
            
            onResize();
            
            if(initialData.runmode == "dm")
            {
                    isPresenter = true;
                    logo_img.contentPath = dm_logo_img;
                    this.setStyle("backgroundColor", 0x530002);
                    gameWizard_mxml = GameCreationWizard(PopUpManager.createPopUp(this,
                                                                                                GameCreationWizard,
                                                                                                true));
                    gameWizard_mxml.addEventListener("gameCreated", Delegate.create(this, onGameCreated));
                    gameWizard_mxml.centerPopUp();
            }
            else
            {
                    isPresenter = false;
                    logo_img.contentPath = player_logo_img;
                    this.setStyle("backgroundColor", 0x002953);
                    loginWizard_mxml = LoginWizard(PopUpManager.createPopUp(this,
                                                                                          LoginWizard,
                                                                                          true));
                    loginWizard_mxml.addEventListener("gameSelected", Delegate.create(this, onGameSelected));
                    loginWizard_mxml.centerPopUp();
            }
    }
    
    

    Obviously, not only is having the ability to install 3 seperate applications via 1 XML file cool, but having 1 of those applications operate as 2 seperate, independant applications in a different state merely from an installation configuration variable. Nice.

    Notice I had previously set the backgroundColor of the application tag to black; as per Flex Chronicles #8, if you don’t set an initial value to the backgroundColor, you cannot later set it.

  • Flex Chronicles #8: backgroundColor

    This style has mad significance. First, if you don’t set it on most containers, they won’t have a background. If they don’t have a background (fill/rect/what have you), you cannot use them as drop targets since there is nothing to detect a drop on.

    Secondly, as you’ll see in my next post, if they don’t have a backgroundColor defined, they don’t draw one, so at runtime (at least as I’ve found), you can’t use setStyle(“backgroundColor”, 0xFF0000); there’s nothing there to color. I think by setting it at authortime, it draws a background, and from then on at runtime you can then use setStyle to color it.