Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
khadesa

Scrolling Navigation Menu for Mobile Using Throwprops

Recommended Posts

Helly everybody,

 

I was hoping someone out there might be able to provide some info on applying the greensock throwprops plugin to a vertical scrolling nav menu for an android app.

 

I have tried modifying the code from the throwprops page, but it uses a textfield, i want buttons inside a movie clip...

Is that even possible?

Can anybody point out any useful tuts or articles? or would someone like to view the file?

Thanks a bunch everybody,

Alex

Link to post
Share on other sites

Yes, it's definitely possible. You don't NEED to use a TextField at all - that was just a simple example. ThrowPropsPlugin doesn't care what type of object you're tweening, nor does it care what property (or properties) you're tweening - it's SUPER flexible. In fact, recent versions integrate with our new VelocityTracker class which makes it crazy simple to get the velocity of any property of any object anytime. 

 

You'd just need to tell ThrowPropsPlugin to start tracking the appropriate properties (in your case, probably "y" because you said it's a vertically scrolling menu), and then make your object draggable (that's the part you handle), and then when the user releases the drag, you generate the ThrowPropsPlugin tween. Kinda like this (pseudo code):

ThrowPropsPlugin.track(target, "y");

//make your object draggable....
//probably adding MOUSE_DOWN and MOUSE_UP handlers, plus startDrag(), etc.

//then when the user releases, do the ThrowPropsPlugin tween:
function mouseUpHandler(event:MouseEvent):void {
    target.stopDrag();
    var velocity:Number = ThrowPropsPlugin.getVelocity(target, "y");
    ThrowPropsPlugin.to(target, {throwProps:{y:{velocity:velocity, max:500, min:0}, resistance:250}});
}

I hope that helps. 

Link to post
Share on other sites

Hey Guys,

 

Thanks for the suggestions!

 

i've think i've modified the code nicely enough for the menu, however, the problem i have now is that the list seems to have a mind of its's own when i release,

i cannot seem to find the values to be modified to correct this... where to position the object on mouse up..

 

i have put together a very basic example to clarify, would love to know what i'm missing,

 

Thanks again!

 

SmoothScrollerV3.zip

Link to post
Share on other sites

Can anybody spare a glance? i've tried for so long and cannot get anywhere...
:[

Link to post
Share on other sites

Sorry for the delay. Your code is good.

The problem is that the registration point of your symbol is in the center of your list which was making it seem like the list wasn't landing at the proper y value.

 

The solution. Simply move the registration point to the top right.

 

I've attached a Flash CC Fla

 

SmoothScrollerV4.fla.zip

Link to post
Share on other sites

Arrrrgggghhhhh, serious?

 

You are the man Carl, thanks heaps,

Boy oh boy do i feel silly. At least it wasn't syntax this time...

Okay, so i have a real question this time,

How can i make the buttons clickable/touchable?

I have used a mouse.click event and added
TweenLite.to(blitMask, 0, {scrollY:0, onComplete:blitMask.disableBitmapMode});

To the mouse Up function,

 

i know i'm on the right track, but i can only to manage to get the buttons too clickable (every time you drag) or not clickable at all using this line in various positions,

What method would you recommend to accomplish this?

Where should the disableBitmapMode sit?

Is there a more efficient way?

Thanks Carl, and everybody at greensock,

By the way, i am determined to publish a tutorial on this topic :]

 

Link to post
Share on other sites

Without seeing the exact implementation it's hard to give a code answer. In general it seems you are on the right path.

 

When you start a tween on the BlitMask enable bitmapMode. And like you have, use a onComplete disable it.

Link to post
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.

×