4 Replies Latest reply on Nov 16, 2013 5:57 PM by RT1984

    AIR for iOS performance issue on iPhone4




      I have a little script that changes the scale of the ball based on sample data I'm getting from the microphone.

      It is working perfectly on MacBookPro, but when I compile it into ipa and test on my iPhone4, I'm getting very slow rendering. The ball changes scale slower and doesn't hit every beat as it does when I test in on MacBook. I have tested it on iPad3 as well and it acts the same ;(


      The question is - how can I improve performance, or maybe it just can't be done with AIR for iOS?


      So my FlashCC setup is 640x960px, 30fps.

      On stage I have just an instance of the "ball" - a movie clip with 100x100px vector circle with solid fill.

      For bitmap mode I used Cache as bitmap.




      import flash.media.Microphone;

      import flash.events.SampleDataEvent;

      import flash.utils.ByteArray;


      var mic:Microphone = Microphone.getMicrophone();

      mic.rate = 8;

      mic.gain = 100;

      var diff_norm = 0;


      mic.addEventListener(SampleDataEvent.SAMPLE_DATA, SampleData);

      this.addEventListener(Event.ENTER_FRAME, loop);


      function SampleData(eventObject:SampleDataEvent):void{

                var byteData:ByteArray = eventObject.data;

                while (byteData.bytesAvailable > 0)


                          var diff:Number = byteData.readFloat() * 20;

                          diff_norm = (Math.floor(Math.abs(diff)))




      function loop(e:Event):void{

                ball.scaleX = ball.scaleY = diff_norm;




      Thanks in advance.