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 7667767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:11:18+00:00 2026-05-31T15:11:18+00:00

Iam trying to make clicked position to center in flex. My code is <fx:Declarations>

  • 0

Iam trying to make clicked position to center in flex.
My code is

<fx:Declarations>
    <s:Parallel id="transformer" target="{swe}">
        <s:Scale id="scaleby" scaleXBy="0.2" scaleYBy="0.2" autoCenterTransform="false"/>           
    </s:Parallel>
</fx:Declarations>




   <s:Group width="500" height="350" clipAndEnableScrolling="true">
               <s:SWFLoader source="CasuarinaBigMap.swf"  width="500"   height="350" id="swe" click="swe_clickHandler(event)"/> 

 </s:Group>


protected function swe_clickHandler(event:MouseEvent):void
{
        scaleby.transformX = event.mouseX;
        scaleby.transformY = event.mouseY;
        transformer.play(); 
}

My qustion is
How can I make clicked point pan into the center of the box?
Pls help.

Thanks.

  • 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-31T15:11:19+00:00Added an answer on May 31, 2026 at 3:11 pm

    This ought to do the trick:

    <fx:Declarations>
        <s:Move id="moveEffect" />
    </fx:Declarations>
    
    <s:Group id="mapContainer" width="300" height="300" clipAndEnableScrolling="true"
             click="pan(event.localX, event.localY)">
    
        <s:Image id="map" source="@Embed('bigMap.png')" />
    </s:Group>
    

    ‘localX’ and ‘localY’ are the mouse’s ‘x’ and ‘y’ position relative to the mapContainer.

    And now the pan() method:

    private function pan(mouseX:Number, mouseY:Number):void {
        //calculate the offset from mapContainer's center
        var diffX:Number = mapContainer.width/2 - mouseX;
        var diffY:Number = mapContainer.height/2 - mouseY;
    
        //move the map through the move effect
        moveEffect.xFrom = map.x;
        moveEffect.yFrom = map.y;
        moveEffect.xTo = diffX;
        moveEffect.yTo = diffY;
    
        moveEffect.play([map]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a bookmarklet that when clicked will check the URL
I am trying to make it so when a navigation item is clicked, it
Hi iam trying to make an update trigger in my database. But i get
Hi iam trying to make an Wpf TextBlock to blink. I want like when
I am trying to make a link where when it is clicked, it goes
I am trying to make a Login popup window. For example, if someone clicked
I am trying to make a button in html that when it is clicked,
I am trying to make a link unclickable once it is clicked, then clickable
I am trying to make a button, that when clicked, downloads a src defined
I am trying to code this from scratch, so that when a button clicked

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.