User:Thinkquick
From Chumby Wiki
thinkQuick software
thinkQuick software is an Australian based business.
They are always keen to work on innovative new projects involving modern techniques like Flash/Flex, AJAX (Asyncronous Javascript & XML), Facebook, etc.
Some handy source code examples by thinkQuick
Actionscript for a test harness for the accelerometer (simulates shaking). This example loads a local swf, which is the accelgraph example in this case.:
var my_mc:MovieClip = _root.createEmptyMovieClip("my_mc",_root.getNextHighestDepth()); var my_mcl:MovieClipLoader = new MovieClipLoader(); var my_listener:Object = new Object(); my_mcl.addListener(my_listener); my_listener.onLoadComplete =function(the_mc:MovieClip) { the_mc.ASnative = function(n1,n2) { my_accelerometer = function(n) { return Math.random()*50 - 50; } return my_accelerometer; } } my_mcl.loadClip("accelgraph.swf", my_mc);
In this example, the pendulum will stay still. It appears 2000 is the 'still' value (for the virtual chumby version, at least).
var my_mc:MovieClip = _root.createEmptyMovieClip("my_mc",_root.getNextHighestDepth()); var my_mcl:MovieClipLoader = new MovieClipLoader(); var my_listener:Object = new Object(); my_mcl.addListener(my_listener); my_listener.onLoadComplete =function(the_mc:MovieClip) { the_mc.ASnative = function(n1,n2) { my_accelerometer = function(n) { return 2000; } return my_accelerometer; } } my_mcl.loadClip("http://www.chumby.com/xml/movies/59D1E5A0-AC29-11DB-8062-0030485A78AA", my_mc);