Skip to main content
Inspiring
September 12, 2011
Answered

Why is the startDrag() lag so choppy?

  • September 12, 2011
  • 4 replies
  • 2693 views

I have tried increasing the frame rate, it doesn't help.

I am compiling using AIR for iOS and running on a first generation iPad.

I have simple movie clips that get dragged around the screen. No memory hogs, it's just a little kid's game. And yet startDrag() and startTouchDrag() are really choppy. It's like dragging on one of those old 1 frame per second machines. My finger will land and .75-1 second later the Sprite will catch up. 1 second is a long, long time in a user interface. Other similar apps (not written in Actionscript) have smooth, silky drag functions. Even my 3 year old daughter notices how bad the lag is.

Is this just an AIR compiler problem, or am I doing something wrong?

This topic has been closed for replies.
Correct answer Colin Holgate

Yes, dragging textfields is demanding enough, but at least against a bitmap it wouldn't have to re-render the background part every frame. You could try setting the cacheasbitmap of the vector symbol to true. That could speed things up.

4 replies

Inspiring
September 23, 2011

do you have other things going on at the same time? I found that if I had vector text on the stage my drag would be choppy.

AmbariAuthor
Inspiring
September 28, 2011

Yes - actually the movie clip being dragged is nothing but dynamic text (I changed this from when I wrote earlier saying they were simple graphics. I had to make them dynamic. It didn't effect the drag). But that's the only thing going on.

But I have other apps where I drag dynamic text around and it works just fine.

Is there a setting in fonts embedding or something like that that would make it better?

(Hm, I just thought of this...in my other apps the dynamic text is being dragged over a bitmap and in this one it's being dragged over a vector. Would that make a difference?)

Colin Holgate
Colin HolgateCorrect answer
Inspiring
September 28, 2011

Yes, dragging textfields is demanding enough, but at least against a bitmap it wouldn't have to re-render the background part every frame. You could try setting the cacheasbitmap of the vector symbol to true. That could speed things up.

Participant
September 13, 2011

set it to GPU mode in the app.xml

I had the same problems when running on CPU mode

AmbariAuthor
Inspiring
September 22, 2011

GPU mode made it way, way, way worse.

Any other ideas?

AmbariAuthor
Inspiring
September 12, 2011

I'm running CS 5.5 and Air 2.6. How do I upgrade to 2.7? Will that fix it?

My code is this.startDrag(); and this.stopDrag();

Participating Frequently
September 13, 2011

Hi,

You can download AIR 2.7 from here and overlay it with CS 5.5 using the instructions at this page. You could also download the AIR 3 RC build from labs and give it a try. If you still see an issue, please file bug.

Thanks,

Sanika

Inspiring
September 12, 2011

Hmm, i was developing a Iphone app a while ago. Was coding in the timelime like a noob. And i had the same problem. I was scrolling content mimicing the IOS scrolling with easing. And it was disgusting when put on a device.

I realised it was bad becuase there was animation happening. I had a twitter bird flying, on the stage at the time, but various animations through out the app.

Including a animation of a 3D motorbike rotating. With was something like 300 jpegs. So from experience i can say smooth scrolling does not like a library full of animation. It has more to load i guess.

AmbariAuthor
Inspiring
September 12, 2011

I've got nothing else on the screen. The movie clips are nothing more than static graphics that have only been turned into movie clips to make them draggable. There's no other animations or anything on the screen. What else could be causing it?

Inspiring
September 12, 2011

Hmm, not sure exactly. Maybe its because you are using the old IOS template. You need the updates. But i think i know why you do not have it

What Code are you using for your drag?