1 (edited by talksrealfast 2007-04-26 14:49:21)

Topic: Accessing "Buttons" with the Touchscreen

I've read the bit about accessing the last point touched on screen here:
http://wiki.chumby.com/mediawiki/index. … ouchscreen

But I can't figure out how to get a simple button (it's actually a movieclip) to work in my widget. It works in the Flash IDE, on a server, blah blah blah. But on the chumby "clicking" a button doesn't act the same as it does in another environment. Does anyone know how to make the touchscreen work like a mouse click essentially?

Re: Accessing "Buttons" with the Touchscreen

Buttons should operate normally - all of the movies we've created use standard Button objects.  The only think to watch for is that you don't rely on mouseOver events, since they are never generated (we can't track something that isn't touching the screen).

The documentation on the site regarding the touchscreen ASnative calls is only for those folks wanting to get raw, unprocessed coordinates from the touchscreen driver, which isn't really of much interest to anyone but a low-level Flash hacker.  The Control Panel, for instance, uses this data in order to produce a calibration mapping between touchscreen coordinates and screen coordinates.

Re: Accessing "Buttons" with the Touchscreen

Ah, yes. I took out some classes that were for animating after the button click, and now the "button click" works. It also trimmed down the file size quite a bit, so that's an added bonus.

What's strange now, is that when the button is clicked, two text fields are updated. The movie is being published as Flash 7, so that's not it. I've even traced where the asset was being hosted on chumby.com, and it works in my browser. My fonts are also embedded, so that makes me even more confused. Does anyone know of why something would prevent my text fields from being populated when the button is clicked? For help, here's the code doing the work. In this case, this.id equates to the id stored for the thumbnail being clicked on (either 0, 1, or 2). Again, it works outside of the chumby, so I'm lost.

        container["thumb" + i].onRelease = function():Void
        {
            container.attachMovie("titleOverlay", "titleOverlay", container.getNextHighestDepth()); //attaches the overlay with the text fields
            titleOverlay.titleText.text = titlesArray[this.id]; //sets the text - works in a browser and locally
            titleOverlay.descriptionText.text = descriptionArray[this.id]; //sets the text - works in a browser and locally
            
            titleOverlay.overlayLayer.onRelease = function():Void //when the background is clicked, remove the movie clip
            {
                removeMovieClip(titleOverlay);
            };
            
            titleOverlay.closeButton.onRelease = titleOverlay.overlayLayer.onRelease; //when the close button is clicked, remove the movie clip
        };

Re: Accessing "Buttons" with the Touchscreen

I have solved my own problem. I was embedding the fonts in the library, which works fine for static text fields, but for dynamic text fields you need to embed the fonts directly using the properties panel. Boom - it worked.