Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6473205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:26:18+00:00 2026-05-25T06:26:18+00:00

Basically what Im trying to do is have a TileGroup component’s horizontalCenter and verticalCenter

  • 0

Basically what Im trying to do is have a TileGroup component’s horizontalCenter and verticalCenter attributes modified inversely of the mouses movement, and use an spark move effect to make that motion be smooth. The TileGroup is a child of a mx:Canvas that is set to be 100% wide and 100% tall. Their are about 20 or so BorderContainers inside of the TileGroup.

For an example of how it should be working, look at http://gallery.artofgregmartin.com/

My version moves just like that one, but its not nearly as smooth. Looking at CPU usage both mine and his use about the same (80-90% when the motion is going) but we differ in GPU usage. Mine only utilizes about 4% while his is near 10%.

Here is my movement code:

private function onMouseMove(event:MouseEvent):void{
    var stageCenterX:Number = this.stage.stageWidth/2;
    var stageCenterY:Number = this.stage.stageHeight/2;
    var sliderPanelCenterX:Number = sliderPanel.width/2;
    var sliderPanelCenterY:Number = sliderPanel.height/2;
    var mouseX:Number = event.stageX;
    var mouseY:Number = event.stageY;
    var offsetX:Number = 0;
    var offsetY:Number = 0;
    var padding:Number = 400;

    var multX:Number = (stageCenterX - mouseX)/stageCenterX;
    offsetX = (multX * sliderPanelCenterX);

    if(mouseX <= stageCenterX){
        offsetX = offsetX - Math.abs(multX * stageCenterX) + Math.abs(multX * padding);
    }
    else {
        offsetX = offsetX + Math.abs(multX * stageCenterX) - Math.abs(multX * padding);
    }

    var multY:Number = (stageCenterY - mouseY)/stageCenterY;
    offsetY = (multY * sliderPanelCenterY);

    if(mouseY <= stageCenterY){
        offsetY = offsetY - Math.abs(multY * stageCenterY) + Math.abs(multY * padding); 
    }
    else {
        offsetY = offsetY + Math.abs(multY * stageCenterY) - Math.abs(multY * padding);
    }

    panelHC = Math.round(offsetX);
    panelVC = Math.round(offsetY);

    movePanel.captureStartValues();
    sliderPanel.verticalCenter = panelVC;   //sliderPanel is the id for the TileGroup
    sliderPanel.horizontalCenter = panelHC;
    movePanel.play();
}

And here is the reverent mxml code:

<fx:Declarations>
    <s:Move id="movePanel" target="{sliderPanel}" />
</fx:Declarations>
<mx:Canvas width="100%" height="100%" backgroundColor="#111111" 
    horizontalScrollPolicy="off" 
    verticalScrollPolicy="off">
    <s:TileGroup id="sliderPanel" horizontalGap="2" verticalGap="2" width="2010" 
       horizontalCenter="0" verticalCenter="0" z="1" />
</mx:Canvas>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:26:18+00:00Added an answer on May 25, 2026 at 6:26 am

    Well it would seem that the built in animation routines are not exactly optimized. I switched all the tweening methods out for TweenMax ( http://www.greensock.com/tweenmax/ ) as well as followed some of the optimization tips on that site and its running smooth as butter now.

    Thanks for all the helpful response!

    -Nigel

    TweenMax method:

    Replaced
    
    movePanel.captureStartValues();
    movePanel.easer = powerEasing;
    sliderPanel.verticalCenter = panelVC;
    sliderPanel.horizontalCenter = panelHC;
    movePanel.stop();
    movePanel.play();
    
    With
    
    TweenMax.to(sliderPanel,2.5,
      {verticalCenter:panelVC,horizontalCenter:panelHC, ease:Back.easeOut});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically on .show() I've been trying to have all of the inputs convert to
I have tried and failed to get this working. Basically I am trying to
Basically what I'm trying to do is have a picture rotate using mouse events.
I basically have the following string in the format: A,B,C:D,E,F What I am trying
I have a problem trying to design some generic storage.. Basically I have the
I have a script that I'm trying to get working. Basically, what I'm trying
I have a relatively big SSIS package which I'm trying to edit. I basically
i am trying to do a groupby in linq, basically i have a list
I'm trying to emmulate the following: Any ideas how? Basically all photos have the
I'm trying to create a responsive gui, which basically means that I have an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.