Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Gary Griswold

Panel Scrolling Example

Recommended Posts

Hello,

 

The prior website contained an excellent example of horizontal panel scrolling (or dragging) with the panels going back to alignment with the edge of the display when released. I believe it was on the ThrowProps page, but this example did not use ThrowProps. I can't seem to find it in the new website.  My modifications of the code seem to have messed it up somewhere along the line and I need to get back to the original.

 

The JS Draggable looks extraordinary, and exactly the kind of thing I need.  Is there any plan to get it running in ActionScript?

 

Gary

Link to comment
Share on other sites

Hi Gary,

 

I believe the panel scroll demo (non-ThrowProps) can still be found at the very bottom of the ThrowProps page: http://greensock.com/throwprops-as

 

If there is something different you are referring to, can you share a screenshot or the files you have?

 

The JS Draggable tool was actually created simply to help folks with ThrowPropsPlugin, as most ThrowProps tweens were based off of dragging, and in the JS / HTML5 world there really isn't a consistent, cross-browser way of dragging. Apparently this solved a huge problem for folks and the feature requests kept rolling in.

 

Since AS3 already has startDrag() and other handy methods available we have no plans at this time to develop a robust drag utility for AS3. 

Link to comment
Share on other sites

The panel scrolling example works great and by comparing it to my code, I have been able to fix the problem that I had.  Thanks very much.

 

But, I am running into another problem using it and hope you have some advice on what would be the best solution.  My panels are a mixture of text, images with some interactive objects.  When I put three or more of them side by side, all of the performance degrades significantly.  My panels are much too large to be cached as bitmap.  Blitmask doesn't work well because there are too many interactive components whose change would require recreation of the Blitmask.  I am guessing that the problem is that flash is spending time rendering the panels that are not in view.

 

The only other solution that I can think might work would be to keep only one panel on the stage, and add a second panel only when I have an event that indicates the user is scrolling horizontally.  I think this would fix the problem, but it would introduce a slight delay in the start of scrolling.

 

Do you have any other ideas that you think might be better?

Link to comment
Share on other sites

I have just discovered a simple solution.  Changing panels to visible=false when they are not on stage corrects the performance problem.

 

Amazing. I had used the visible property before to make things appear or disappear, but also seems that the renderer is able to ignore those things that are not visible.

Link to comment
Share on other sites

Yup, visible = false; basically removes the element from any render logic and mouse events. Glad you got it working.

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.
×