Jump to content
Search Community

Help with BlitMask and Throw Props

swiftmend test
Moderator Tag

Recommended Posts

Hi,

 

I'm working on a mobile app that shows a list of players avatars, these avatars are made up of text, external swfs and other things. It's basically a big movie clip holding these objects.

 

Now, I'd like to be able to smoothly tween up/down this list using throw props.

 

I have all the functionality I want done, but the performance is not very good.

 

Am I doing something wrong?

 

This is my code:

 

 

function mouseDownHandler(event:MouseEvent):void
		{
			TweenLite.killTweensOf(container);
			y1 = y2 = container.y;
			t1 = t2 = getTimer();
			container.startDrag(false, new Rectangle(bounds.x, -99999, 0, 99999999));
			container.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
			container.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
		}

		function enterFrameHandler(event:Event):void
		{
			y2 = y1;
			t2 = t1;
			y1 = container.y;
			t1 = getTimer();
			Mask.update();
		}

		function mouseUpHandler(event:MouseEvent):void
		{
			container.stopDrag();
			container.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
			container.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
			var time:Number = (getTimer() - t2) / 500;
			var yVelocity:Number = (container.y - y2) / time;
			var yOverlap:Number = Math.max(0,container.height - bounds.height);
			ThrowPropsPlugin.to(container, {throwProps:{
			 y:{velocity:yVelocity, max:70, min:70, resistance:200}
			 }, onUpdate:Mask.update, ease:Strong.easeOut
			}, 10, 0.3, 1);
		}

Link to comment
Share on other sites

From a cursory glance the code looks like a fairly straight-forward (and accurate) adaptation of the sample code on the ThrowProps page.

Are you getting poor performance on a particular device?

Have you tried setting smoothing to false on your BlitMask, do you see a big difference?

Have you tested the code from the ThrowProps page without any modifications on your device? does it run any differently than your modified version?

 

We've heard plenty of great reports from folks using ThrowProps, but there are many factors that can impact performance on mobile devices and it really isn't possible to know what can be wrong from just seeing a code fragment.

 

Based on what you have provided it is difficult to really know what is wrong. The best thing I can recommend to isolate the problem would be to create a throwProps sample with the least amount of technical overhead as possible ie, don't rely on externally loaded swfs, text or any other functionality. See how well you can get ThrowProps to run on its own, perhaps in the exercise of removing things it will be revealed what is the problem. It is very likely that the performance could be a hardware or AIR limitation and it simply can't handle ThrowProps :(

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...