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

  • Home
  • SEARCH
  • 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 6096815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:58:16+00:00 2026-05-23T12:58:16+00:00

I have a Flex 3 app that has elements that a user can add

  • 0

I have a Flex 3 app that has elements that a user can add to the main canvas then resize and reposition.

There are 3 key functions I am using for the resize which are as follows:

When the resize begins:

        private function startResize(event:MouseEvent):void
        {
            RESIZE_START_MOUSE_X = event.localX;
            RESIZE_START_MOUSE_Y = event.localY;

            RESIZE_START_WIDTH = this.width;
            RESIZE_START_HEIGHT = this.height;

            RESIZE_START_X = this.x;
            RESIZE_START_Y = this.y;

            RESIZE_BOUND = calculateResizeBound(event);

            addEventListener(MouseEvent.MOUSE_MOVE, resizeMouseHandler);

            isResizing = true;
        }

When the resize is complete:

        private function endResize():void
        {
            RESIZE_START_MOUSE_X = -1;
            RESIZE_START_MOUSE_Y = -1;

            RESIZE_START_WIDTH = this.width;
            RESIZE_START_HEIGHT = this.height;

            RESIZE_START_X = -1;
            RESIZE_START_Y = -1;

            RESIZE_BOUND = '';

            removeEventListener(MouseEvent.MOUSE_MOVE, resizeMouseHandler);

            isResizing = false;             
        }

Whilst the user is resizing:

        private function resizeMouseHandler(event:MouseEvent):void
        {
            var deltaX:Number = event.localX - RESIZE_START_MOUSE_X;
            var deltaY:Number = event.localY - RESIZE_START_MOUSE_Y;

            if (RESIZE_BOUND.indexOf('T') > -1)
            //We are fixing the top so move the bottom edge
            {
                this.height = RESIZE_START_HEIGHT + deltaY;
            }

            if (RESIZE_BOUND.indexOf('B') > -1)
            //We are fixing the bottom so move the top edge
            {
                this.y = RESIZE_START_Y + deltaY;
                this.height = RESIZE_START_HEIGHT - deltaY;
            }

            if (RESIZE_BOUND.indexOf('L') > -1)
            //We are fixing the left so move the right edge
            {
                this.width = RESIZE_START_WIDTH + deltaX;
            }

            if (RESIZE_BOUND.indexOf('R') > -1)
            //We are fixing the right so move the left edge
            {
                this.x = RESIZE_START_X + deltaX;
                this.width = RESIZE_START_WIDTH - deltaX;
            }

        }

There is another function referenced in these called calculateResizeBound(). What this does is return a string indicating which edge / corner should remain fixed during the resize. Eg ‘TL’ means that the top left corner should stay fixed, ‘BR’ means bottom right, ‘L’ means just the left edge etc etc

When the resize starts from the ‘normal’ position, ie the top left corner stays fixed, everything works great. Similarly with the left or top edges fixed. However for the bottom and right cases, I need to reposition the element at the same time as resizing it since all the co-ordinates are calculated from the top left.

The problem that I have is that when it does this, the resize is not smooth, it keeps jumping up and down slightly as you resize it. Not only that but when you resize from the ‘normal’ edges the cursor position remains fixed relative to the fixed edge / corner however from one of the other edges, you can see it start to drift away from the edge / corner as you resize.

With this kind of thing, it is easy to get the + / – of the different bits of the calculation muddled but since the resize is working in the correct direction each time, I assume I have these correct.

So presumably the problem is coming from the simultaneous moving and resizing but I can’t find a work-around for it. Any thoughts / suggestions would be much appreciated

  • 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-23T12:58:16+00:00Added an answer on May 23, 2026 at 12:58 pm

    Doug McCune has an awesome Resize wrapper that you can use to resize elements. Then you just need to add a mover on it. See the blog post for code/sample: http://dougmccune.com/blog/2007/08/17/my-360flex-slides-and-code/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a flex app that takes data from a back end database then
I have a string called userEmail in my Flex 4 app that has a
I have an AIR/Flex app that can have multiple windows (s:Window instances) open at
I have a flex app that has several timers running for various amounts of
I have a Adobe Air app (AS3, not Flex) that has 2 windows. When
I have a Flex App that allows you to dynamically build an animation. It
I have a flex app that is hosted on my server. It runs off
Hello StackOverflow'ers, I have a (flex) app that, on the click of a button,
I have a flex 3 app that uses netstream and a video object to
I have an app that uses Spring security and BlazeDS. Flex 3.2 is used

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.