1 (edited by mgalpert 2007-07-09 07:11:28)

Topic: widget works differently on different "instances" of chumby

Although my swf file works fine when it's called directly, as well as on the channel screen (when adding widgets to the channel), it is missing the text when played on the virtual chumby (my chumby), and it is missing all of the images on the real chumby.  Any ideas as to how to fix this bug?  Is this a chumby issue or an error on my side?

Re: widget works differently on different "instances" of chumby

Its probably due to not being Flash Lite 2.0 code.
When you call it directly/view in channel screen, its whatever your flash version on the computer. I don't know about the VC though.

Re: widget works differently on different "instances" of chumby

zachninme wrote:

Its probably due to not being Flash Lite 2.0 code.
When you call it directly/view in channel screen, its whatever your flash version on the computer. I don't know about the VC though.

The swf had previously been published in Flash Lite 2.1 code.  I changed it to 2.0, but that still didn't work.  Is it possible that the chumby is calling a cached version, and it is still calling the 2.1 code?  Or is it a completely different error?

Re: widget works differently on different "instances" of chumby

Without seeing the actionscript you're using, it's hard to tell what's going on.

With images, the alpha prototype chumbys only support non-progressive JPEG, while the desktop Flash plugin supports other formats, so it's possible for the virtual chumby to show more images.

Also, upon image load, FlashLite has different properties showing up at different times.  I've notied that the _width and _height  of a loaded image can sometimes show up at different frames, so you have to be careful with image resizing code.

Also, the chumby is going to have some restrictions on the overall dimensions of the image, since it doesn't have as much memory as a desktop machine.

Re: widget works differently on different "instances" of chumby

The widget that's actually uploaded to the chumby website is just a loader - here's the code:

var randomNum:String = String(Math.ceil(Math.random()* 1000));

var swf_name:String = "http://www.worth1000.com/widgets/chumby.swf?random=" + randomNum;
var slide_show_mc:MovieClip = this.createEmptyMovieClip("slide_show_mc",1);

The loader calls another swf, which is actually the widget.  I know it's loading to some degree, since the textbar (not the text itself, just the bar beneath the text) is showing up.  But that's about it that shows.  Below is the widget code.  Any help would be appreciated:

var rssObject;
var numPics;
var currentPic;
var intervalTime;

var loadListener:Object = new Object();

//When image begins loading this function is invoked to scale the image,
//center it, and apply a transition to it.  After waiting 4 seconds (4000 ms),
//calls the function to load the next image.
loadListener.onLoadInit = function(target_mc:MovieClip){

//scale movie clip to fit the stage once it had loaded
       var scaleRatioHeight = (240/ target_mc._height);
    var scaleRatioWidth = (320/ target_mc._width);
    if(scaleRatioHeight < scaleRatioWidth) {
        target_mc._height = 240;
        target_mc._xscale = target_mc._yscale;
    else {
        target_mc._width = 320;
        target_mc._yscale = target_mc._xscale;
    //center the movie clip
    target_mc._x = (320 - target_mc._width)/2;
    intervalTime = setInterval(loadNextImage,4000);

var mcLoader:MovieClipLoader = new MovieClipLoader();

//Parses RSS Object and calls function to load the first image
this.receiveRSSObject = function(rssObject1)
    rssObject = rssObject1;
    numPics = rssObject.channels[0].items.length;
    trace("Channel Title: " + rssObject.channels[0].title);
    currentPic = -1;

//Displays picture and title bar
function loadNextImage()
    //ensure that for each setInterval, loadNextImage gets called only once
    currentPic %= numPics;    //shows first image again after last infinitely
    trace("Item Title: " + rssObject.channels[0].items[currentPic].title);
        this.createEmptyMovieClip("pic1_mc", 1);
        mcLoader.loadClip (rssObject.channels[0].items[currentPic].description, pic1_mc);
        //create the text bar
        this.attachMovie("txtbar_mc", "textBar_mc", 1000);
        textBar_mc._height = 25;
        textBar_mc._width = 320;
        textBar_mc._y = 240 - textBar_mc._height;
        textBar_mc._x = 0;
        var formatText:TextFormat = new TextFormat();
        formatText.align = "center";   
        formatText.color = 0x000000;
        formatText.url= rssObject.channels[0].items[currentPic].link;
        //set text of the title bar as hyperlink
        textBar_mc.title_txt.html = true;       
        textBar_mc.title_txt.htmlText = rssObject.channels[0].items[currentPic].title;


rssObj = new RSSDataFactory()
                 this, "receiveRSSObject");

Re: widget works differently on different "instances" of chumby

I'm not seeing a crossdomain.xml file on your server - could be a security sandbox issue.

The chumby widgets are loaded from the domain "chumby.com", so your server should respond to a request for:



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cros … policy.dtd">
  <allow-access-from domain="*.chumby.com"/>

Re: widget works differently on different "instances" of chumby

The crossdomain code is now on the server, but the widget still does not work.  Any other ideas of what might be the problem?


Re: widget works differently on different "instances" of chumby

I guess the next thing I'd look for is to make sure all of the fonts are embedded, then I'd ssh into the chumby and run the flash player directly to see the debug output.

1) Turn on sshd by going to Settings->Info and hitting the legs of the chumby in the background in the order 1,1,2,3,5 - you should get a little winking chumby logo.  This means that sshd is running on the chumby.

2) Using an ssh client (ssh on the Mac or Linux, PuTTY on Windows), log into the chumby using the IP on the Settings->Info screen as user "root".

3) Kill the currently running Flash Player, with:

rm /tmp/flashplayerstarted
killall chumbyflashplayer.x

4) Restart the Flash Player from the console:

chumbyflashplayer.x -i /usr/widgets/controlpanel.swf

You'll now see all the debug output from the operation of the player, including any trace() statements you've added to your Actionscript.  You shoul dbe able to spot your widget loading and fetching data from your servers, and see any errors that might be happening.

Or, you can send the FLA and any associated files to me (duane@chumby.com) and I can take a look at it here.

Re: widget works differently on different "instances" of chumby

I ran flash player from the console, and the tracing was fine.  There seems to be a BadImageError.  This is what traced each time:
NetStreamRequest::Open(40): Opening protocol 'http://' host 'www.worth1000.com' port 80 location '/entries/75500/75908VBda_small.jpg'
NetStreamRequest::Step(40): done,closing stream (5833 of 5833 bytes)
SI_NotifyError(0x1832e4): Error 6 (FI_BadImageDataError)
ClientObject::DoUpdate(): got FI_FrameBufferNotUpdatedWithError
---my trace statements

Do you know what could have caused these errors?
Thank you.

Re: widget works differently on different "instances" of chumby

Yes - it turns out that particular image is a "progressive" JPEG, which is not supported by Flash Lite.  This file could not be handled by any version of Flash prior to Flash 9.

We have an open bug for the production units to replace the stock JPEG decoder with one that will handle these types of files.  They're actually pretty rare nowadays, so it's not the highest priority.

To verify that it's progressive, open it in Photoshop, and do a "Save As..." - in the JPEG options dialog, you should see the "progressive" radio button selected.