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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:37:06+00:00 2026-05-23T21:37:06+00:00

I have a sprite that holds a bitmap data. I want to give the

  • 0

I have a sprite that holds a bitmap data.
I want to give the user the ability to resize the image with a slider.
I am using the code beneath, as you can see the problem is that the scaling is additive so very quickly the image is gone totally.

I understand that i have to scale it in non additive way, just can not figure out how?

I tried to pass :

var m:Matrix = userImageCopy.transform.matrix;

when userImageCopy holds the original image. that helped for the scaling but then, each time the scaling started the userImage jumped to the position of the userImageCopy.

Any help?

function onSliderChange(evt:Event):void
    {
        trace( evt.target.value);
        //this will create a point object at the center of the display object

        var ptRotationPoint:Point = new Point(userImage.x + userImage.width / 2,userImage.y + userImage.height / 2);
        //call the function and pass in the object to be rotated, the amount to scale X and Y (sx, sy), and the point object we created
        scaleFromCenter(userImage, evt.target.value, evt.target.value, ptRotationPoint);
    }

    private function scaleFromCenter(ob:*, sx:Number, sy:Number, ptScalePoint:Point)
    {
        var m:Matrix = userImage.transform.matrix;
        m.tx -=  ptScalePoint.x;
        m.ty -=  ptScalePoint.y;
        m.scale(sx, sy);
        m.tx += ptScalePoint.x;
        m.ty += ptScalePoint.y;
        ob.transform.matrix = m;
    }
  • 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-23T21:37:07+00:00Added an answer on May 23, 2026 at 9:37 pm

    Rather than combining your center values with the current tx and ty, just set them directly with the Matrix.translate method:

    private function scaleFromCenter(ob:*, sx:Number, sy:Number, ptScalePoint:Point)
    {
        var m:Matrix = new Matrix();
        m.translate(-ptScalePoint.x,-ptScalePoint.y);
        m.scale(sx, sy);
        m.translate(ptScalePoint.x,ptScalePoint.y);
        ob.transform.matrix = m;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(using flash) I have a Sprite object that I want to show on google
I have a sprite(image of a ball) I can move it using touch and
I have got a sprite that moves based on touch location. I am using
I have a class called Textures that use holds some data like this //Textures.h
Here is the setup: I have a class called Sprite that contains an image
I have sprite brick that I want to use many times in my parallax
I have a sprite that animates using a sprite sheet. He is only 16x16,
I have a sprite that contains a textfield. Then, I want to create a
I have a sprite image that is the background of a div and the
I have a sprite loaded from a PNG that has an alpha channel. The

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.