first when I new about flash API I wanted to develop an application with sensor... you know, a ball moved around... but I had a problem... the "asynchronous" function doesn't work properly, it has some kind of buffering (the more the program runs the more time between action and reaction - after 30s move rotate phone and after 1-2s view on screen the movement... )
now I have learn about widgets... and I try to take sensors from javascript... but the same problem... unless you slow down the setVariable in flash... seems that javascript throws into flash with more that 15-25FPS, and somehow javascript trowing is put on hold until flash sets that variable (25FPS - about 40ms); that means that if the callback function is trigged at every about 10ms the second value arives in flash after 120ms, not after 20ms as it should be... so I have slowed down the setVariable kind of like this:
Code:var T=0; var flashFPS=15; . . . function flashSetVar(str){ var t=new Date(); if(t.valueOf()-T.valueOf()>1000/flashFPS){ document.getElementById("flashOBJ").SetVariable("flashVAR", str); T=new Date(); } }


Reply With Quote

