Topic: Help with Widget

I have what I believe to be a simple widget created in Flex 4.6. What it does is gets the data from a url, parses it and sets an image link presented. then it displays that image. Refreshes every minute, shows date\time, and allows to pause refresh and go to previous image.

This works locally on my laptop, also on the chumby.com preview but when loaded on my chumby it is just a blank black screen. Can anyone please help me with this? The code is below

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="800" minHeight="600"
               initialize="application1_initializeHandler(event)"
               click="application1_clickHandler(event)"
               width="800" height="600" enterFrame="application1_enterFrameHandler(event)"
               >
    
    <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;
            import mx.filters.BaseFilter;
            
            private var u:URLLoader = new URLLoader();
            private var timer:Timer;

            [Bindable]
            private var pause:Boolean = false;
            
            private var lastURL:String;
            
            [Bindable]
            public var overlay:Boolean = true;

            [Bindable]
            public var currUrl:String;
            
            protected function application1_initializeHandler(event:FlexEvent):void
            {
                timer = new Timer(60000,0);
                timer.addEventListener(TimerEvent.TIMER, timerHandler);
                timer.start();
                loadImage();
            }
            
            protected function application1_enterFrameHandler(event:Event):void
            {
                var now:Date = new Date();
                var hour:Number = (now.hours < 12 ? now.hours : now.hours - 12);
                var ampm:String = (now.hours < 12 ? "AM" : "PM");
                date.text = (now.month+1) + "/" + now.date + "   " + hour + ":" + now.minutes + ":" + now.seconds + " " + ampm;
            }
            
            protected function timerHandler(event:Event):void
            {
                if (!pause)
                    loadImage();
            }
            
            protected function loadImage():void
            {
                var ur:URLRequest = new URLRequest("http://splakow.com/random.php");
                u.load(ur);
                u.addEventListener(Event.COMPLETE, urlComplete);
            }
            
            protected function urlComplete(event:Event):void
            {
                var s:String = u.data;
                var a:Array = s.split("\"");
                var url:String = a[7];
                
                lastURL = currUrl;
                currUrl = url;
                imageName.text = url;
            }
                
            protected function application1_clickHandler(event:MouseEvent):void
            {
                var x:int = event.localX;
                var y:int = event.localY;
                
                if (y < 300)
                {
                    overlay = !overlay;                    
                }
                else
                {
                    if (x < 400)
                    {
                        pause = true;
                        currUrl = lastURL;
                    }
                    else
                    {
                        pause = !pause;
                    }
                }
        
            }
            
        ]]>
    </fx:Script>
    
    <s:Image id="image" source="{currUrl}" width="100%" height="100%"/>
    <s:Label top="20" left="20" fontSize="15" id="date" visible="{overlay}">
        <s:filters>
            <s:DropShadowFilter color="#FFFFFF" distance="0" strength="200" alpha="0.7"/>
        </s:filters>
    </s:Label>
    <s:Label id="imageName" bottom="20" left="20" visible="{overlay}">
        <s:filters>
            <s:DropShadowFilter color="#FFFFFF" distance="0" strength="200" alpha="0.2"/>
        </s:filters>
    </s:Label>
    <s:Label visible="{pause}" text="Paused" right="20" bottom="20" fontSize="15">
        <s:filters>
            <s:DropShadowFilter color="#FFFFFF" distance="0" strength="200" alpha="0.7"/>
        </s:filters>
    </s:Label>
</s:Application>

I should mention that I am building this app because I am using Gallery3 and none of the Photo widgets quite do what I am looking for.

Re: Help with Widget

Flex will only generate Actionscript 3 - the chumby uses Flash Lite 3, which supports up to Actionscript 2.

Re: Help with Widget

I am using a chumby 8 which I thought used actionscript 3.

Re: Help with Widget

There's a beta firmware image with AS3 support, but I don't thinkt he stock production release supports it.

In any case, Flex is a bit heavy, depending on what you're doing.  I don't think Adobe recommends Flex for Flash Lite 4 development.  What you'll want to do is run the widget directly in the player to see what's going on if the widget is failing.

Re: Help with Widget

Got it. I may try the beta firmware then. I did get a flex 3.6 app working and it ran fine however it did take longer to load it initially.

Where can I go to get the beta firmware.

Re: Help with Widget

it's linked from the "Beta Feedback" section of the forum.

Re: Help with Widget

I am sorry for dragging this out. It appears the beta firmware for the chumby 8 may still be unstable, is this still true? Also, how would I revert back to standard firmware?

Re: Help with Widget

Production firmware images for C8 are typically linked from here.