You can write your actionscript 3.0 code to function with krpano to work as a plugin. Look at the example pages and download the zip file flashcs3exampleplugin11.zip which is located at the bottom of the page.