Topic: Detecting Virtual Chumby Playback

How can I detect if my widget is playing in the virtual chumby?

I can easily detect if I'm playing on chumby since System.capabilities.playerType is undefined, but since I may play my widget on the web on it's own without the virtual chumby, I can't rely on that. Is there some global set by the virtual chumby i can check or a reliable to way to tell if my movie is not the _root?

2 (edited by vivid007 2007-11-28 14:45:02)

Re: Detecting Virtual Chumby Playback

other than using System.capabilities.playerType,  i would try using _url to detect if it is running on your domain or not...

trace(this._url);

http://www.actionscript.com/reference/movieclip_url.php

Re: Detecting Virtual Chumby Playback

You can also check the value of _root._chumby_chumby_name, which should be "Virtual Chumby" in the virtual chumby, or the chumby name on an actual chumby, or undefined in other circumstances.
The method proposed by vivid007 is probably better, because it doesn't rely on anything that might change some day, but this I thought you might find this other fact interesting.

Re: Detecting Virtual Chumby Playback

I came up with a wacky method that works. If i detect that we're playing in the browser than I count the number of props in root. Since my movie has nothing in root, this works well. It's kinda lame, so ideally I would just check _root._chumby_chumby_name.

//var virtual_chumby = (_root._chumby_chumby_name == "Virtual Chumby");

var virtual_chumby = (System.capabilities.playerType == "PlugIn") || (System.capabilities.playerType == "ActiveX");
if (virtual_chumby) {
    var count = 0;
    for (var prop in _root) {
        count++;
    }
    if (count < 3) {
        virtual_chumby = false;
    }
}