Category: Flash

  • Zinc Browser & Hacking Root: Part Deux

    Ok, callback had nothing to do with _root hacking; it had to do with the exe calling the SWF from a remote URL. Since the ActiveX is being used (thanks for the 411 Kenny), it’s still acting like a browser based SWF, and thus is restricted by the security sandbox. So, Zinc can’t call the onBrowserDocumentComplete event on _root… because it’s not allowed per Flash’s security sandbox.

    You package it internally vs. a remote SWF, and she works fine.

  • Xamlon MapServer, aka “Google Maps in C# + Flash”

    Wasn’t aware of this addition to the Google Maps I’m-insecure-with-SWF retaliations. Laughingly, I’ve seen Manish’s Flex version, and this Xamlon(C#-to-SWF) version… but no pure Flash one!? Hah hah!

    Since the open-source g33ks are pushing your buttons, I’ll do so too; can this not be done in pure Flash? :: maniacal laugh ::

    Via Darron Schall.

  • Zinc’s Browser & Hacking _root

    *** Updated 7.7.2005 ***

    Zinc allows you to have a browser appear over top of your Flash movie so you can make an interactive web browser. However, Zinc’s programming model assumes AS2 classes don’t exist and _root is… well, just like everyone views _root; as their playground, putting anything they want there and assuming it won’t change.

    What we do is something Darron Schall showed me, only a little different. It allows us to treat _root as a class, get syntax checking, and emulate what Flex does with “mx.core.Application”. We override _root’s __proto__ so it points to our Singleton class, call its constructor manually, and call onLoad if it hasn’t been called already. I had to put a conditional for onLoad because sometimes it gets called for you, and sometimes it doesn’t (like when you debug in Flash).

    Example

    // ensures Flash/MTASC compiles class
    import com.Application;
    var depend:Application;
    delete depend;
    
    // override _root's proto
    this.__proto__ = _global.com.com.Application.prototype;
    //call constructor
    _global.com.Application.apply(this, null);
    // call onLoad if it hasn't been called already
    if(this.calledOnLoad == false)
    {
            this.onLoad();
    }
    
    
    

    That, however, pisses Zinc off. We have do store a reference to the Browser’s class instance on _root (Application class) so it knows to forward events it gets such as when a webpage is done downloading in the browser(in this case, “onBrowserDocumentComplete”). However, after doing the above _root.__proto__ override, I no longer receive those events. It seems the _root Zinc thought was there is no longer there, even though I can clearly trace out the funciton it needs as there and available. Making it static doesn’t work either. However, putting this in the constructor does:

    this.onBrowserDocumentComplete = this.onBrowserDocumentComplete2;

    Where the “onBrowserDocumentComplete2” is the class method, and onBrowserDocumentComplete is merely a variable you define up top:

    public var onBrowserDocumentComplete:Function;

    Something about _root’s “instance” is what Zinc likes I guess. Anyway, I now get my _root events again from Zinc.

  • JXL Chasm

    Only one thing to do when you can’t code anymore…

    Spend 4 hours doing something stupid.

    Thanks for the idea JD!