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

The Archive Base Latest Questions

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

This application is a much simplified version of what I am trying to accomplish,

  • 0

This application is a much simplified version of what I am trying to accomplish, some smoothing of some motion on the screen by using a composite animation and rerunning it as things change, and using bindings to set some of the values of the animation. The animation is periodically stopped, and then restarted. valueFrom is not set so a property value just continues from where it was towards a new goal. In this example, I’m animating a Rect’s left/top towards mouse’s X/Y to make it chase the mouse.

Problem is the memory of this application continues to grow if you wait a little while and continue to move the mouse. So what should I be doing that I am not?

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication 
    xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" 
    xmlns:mx="library://ns.adobe.com/flex/mx"
    creationComplete="creationCompleteHandler(event)"
    mouseMove="mouseMoveHandler(event)"
    mouseOut="mouseOutHandler(event)"
    >
    <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;

            private static const RECT_HALF_SIZE:int = 5;
            private static const NO_CHASE:int = -1000;

            [Bindable]
            private var lastMouseX:int = NO_CHASE;

            [Bindable]
            private var lastMouseY:int = NO_CHASE;

            private var evalTimer:Timer = new Timer(100);

            protected function creationCompleteHandler(event:FlexEvent):void
            {
                evalTimer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void { evalChase(); });
                evalTimer.start();
            }

            protected function mouseOutHandler(event:MouseEvent):void
            {
                lastMouseX = lastMouseY = NO_CHASE;
                evalChase();
            }

            protected function mouseMoveHandler(event:MouseEvent):void
            {
                const reStart:Boolean = (lastMouseX == NO_CHASE);

                lastMouseX = event.localX;
                lastMouseY = event.localY;

                if(reStart)
                    evalChase();
            }

            private function evalChase():void
            {
                doChase.stop();
                doChase.end();

                if(lastMouseX == NO_CHASE)
                    return;

                doChase.play();
            }

        ]]>
    </fx:Script>
    <fx:Declarations>
        <s:Linear id="linearEaser" />
        <s:Parallel
            id="doChase"
            duration="2000"
            >
            <s:Animate target="{chaser}" easer="{linearEaser}" >
                <s:SimpleMotionPath property="left" valueTo="{lastMouseX-RECT_HALF_SIZE}" />
            </s:Animate>
            <s:Animate  target="{chaser}" easer="{linearEaser}" >
                <s:SimpleMotionPath property="top" valueTo="{lastMouseY-RECT_HALF_SIZE}" />
            </s:Animate>
        </s:Parallel>
    </fx:Declarations>

    <s:Rect
        id="chaser"
        top="0" left="0"
        width="{2*RECT_HALF_SIZE}" height="{2*RECT_HALF_SIZE}"
        >
        <s:fill>
            <s:SolidColor color="red" />
        </s:fill>
    </s:Rect>

</s:WindowedApplication>
  • 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-31T02:11:08+00:00Added an answer on May 31, 2026 at 2:11 am

    Don’t think you’re actually doing anything wrong in this code, I copied into a new Flex 4.6 project and ran it, I could see what you’re saying with regard to the ADL process itself increasing slightly in memory consumption over time, particularly after it stops motion then begins again, however I tried running this in Flash Builder with the profiler and it seems the swf itself isn’t really leaking any memory, it stayed right around 1.1 MB for me (up to about 1.4, but then back down) it seems it had a fair amount of Vector.<*> objects in memory though I’m not clear on what is being stored in those objects.

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

Sidebar

Related Questions

This application is using windows integrated authentication in IIS. No anonymous login. It's also
I have this application that need to do some things in protected paths (like
The simple curve in this application only appears when it's dragged off the screen,
I'm trying to apply the MVVM design pattern to a diagramming application. In this
Client/server desktop application using C#, WCF, WPF. Since pretty much every action is going
there's a WinForms-application written in C# using .NET Framework 3.5. This application uses a
I'm currently developing a web application using Struts2 framework. This application requires to dynamically
I have a web application developed using JSP and Servlet. This web application is
I'm using boost log in my application for logging. However, in some sections of
I have a large 1 page ASP.Net application. Much of this application has been

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.