Dispose of a Tween

So I have a clip in my library set to export as "sample" and
then this code. (AS2, published for Flash 8, although if there are
differences in the AS3 Tween class I would like to hear about it.)
There doesn't seem to be an explicit method for removing or
deleting tweens. It seems that doing a Tween.stop(); and then
delete scope.Tween; works.
My guess is that internally tween is using the
onEnterFrameBeacon and some addListener. When you stop, there is
some removelistener, and while the tween instance still exists it
will be removed with the removeMovieClip.
Is that it? Is there anything more I should be aware of.

I tried this and it doesn't seem to work for me.
I have a class that loads an image and resizes a masking
movie clip to the size of the loaded image. I used the Tween class
to animate the resizing.
I have several buttons set up to load various images.
Clicking a button to load a new image before the current Tween has
finished resizing causes problems. The first Tween seems to
continue and the image jumps to the size of the second image
suddenly.
It seems to me that the first Tween is continuing and does
not get removed.
I can post my class file if you are interested.

Similar Messages

  • Free Transform breaks Motion Tweens

    Sigh! Normally I try to solve problems myself... but Google isn't giving me anything about this so maybe I'm the only one in the world experiencing this particular issue.
    I've used Flash for making games for years now, and I got used to using the old motion tweens for making looping animations for characters. I made the leap from AS2 to AS3 a while ago, and felt like I should try to use these new motion tweens as well since I got CS5...
    I've found them completely unusable, however, due to a bizarre problem that happens when moving around objects using the Free Transform tool.
    For a single character, I'll have a MovieClip with several layers, each with a 'body part' MovieClip on it, then I add the new blue-type motion tweens to all of those layers. At the end of those tweens, I use F6 to (hopefully) duplicate the starting pose; it is meant to loop, after all. Then I'll go about half way between these two keyframes and move bits around to create the A->B->A sort of 'idle' or 'breathing' animation.
    The Free Transform seems dodgy though. If I select all the 'limbs' of a character at once and try to rotate them as a group, it works, but they each end up displaced a bit when I release the mouse; they get offset slightly or rotate a bit in seemingly random directions.
    For example, compare these two images (it's easiest if they're opened in separate tabs, I suppose): http://scraps.fighunter.com/sparkpupagh1.png and http://scraps.fighunter.com/sparkpupagh2.png
    The first one is after rotating it but before I released the mouse button, the second is what the pieces ended up like after I released the button. Most of the pieces ended up where they should be, but the head was offset slightly. This is a mild case; it's usually worse and affects all the pieces, and the slight offsets and rotations build up, too.
    This in itself wouldn't be too bad - though it's frustratingly inaccurate - but it gets much, much worse the more I work on a single animation.
    (Note: These strange changes don't happen if I rotate all the parts as a group if they're not also contained within new motion tweens...)
    Here's a screenshot showing a frame mid-way through an animation, with one of the parts selected: http://scraps.fighunter.com/meepagh1.png
    The Motion Editor is shown, though I don't use that directly.
    With that feather bit selected, I then rotated it a tiny, tiny amount, but didn't *move* it at all. When I released the mouse, it ended up snapping suddenly to here: http://scraps.fighunter.com/meepagh2.png
    That'd be frustrating in itself, but as you can see from the Motion Editor, it's also messed up most of the other frames in the animation, somehow. This becomes unbearable, as you can likely imagine!
    If I edit the graph in the Motion Editor directly to alter the Z value and cause a rotation, it works, without problems... but this is horribly inefficient and unintuitive and not a solution. I can't animate by tweaking numbers. It's like trying to draw a portrait using an Etch-A-Sketch!
    It seems to only be the Free Transform tool that creates this bizarre problem.
    This has been happening since I got CS5 maybe a year or two ago, though I haven't actually had to use the animation tools much until a few days ago so that's why I'm bringing it up now. I've restarted Flash, my computer, etc, etc, many times; I also got the trial version of CS6 today to see if THAT would fix it, but the exact same thing happens in that version too.
    I'm wondering whether it's my computer's fault in some way... I don't know enough about hardware and 'specs' and that sort of stuff to describe anything about it, but I'm using Windows Vista and the computer is fairly old and not exactly what I'd call reliable. I'm planning to get a new one soon, so it'd be nice if that fixed this problem... but frustrating if it doesn't.
    I'll link to the CS6-flavoured .fla that those screenshots are from: http://scraps.fighunter.com/Meep.fla
    I'd very much appreciate it if someone could test this to see if it's happening to only me! If I go to frame 146 (to choose one at random), and try to rotate the foot, slightly, using the Free Transform tool, it breaks in the way that I've described. (Oddly, the head feather rotates without issues on that frame...) If you were to try to do this same thing and it *doesn't* break, it might be a good sign that it's my computer's fault!
    If it *does* break though... then I'd very much appreciate any help I can get from someone who understands the new motion tweens better than I do!
    It'd be a shame to have to go back to Classic Tweens because of this...

    Sigh! Normally I try to solve problems myself... but Google isn't giving me anything about this so maybe I'm the only one in the world experiencing this particular issue.
    I've used Flash for making games for years now, and I got used to using the old motion tweens for making looping animations for characters. I made the leap from AS2 to AS3 a while ago, and felt like I should try to use these new motion tweens as well since I got CS5...
    I've found them completely unusable, however, due to a bizarre problem that happens when moving around objects using the Free Transform tool.
    For a single character, I'll have a MovieClip with several layers, each with a 'body part' MovieClip on it, then I add the new blue-type motion tweens to all of those layers. At the end of those tweens, I use F6 to (hopefully) duplicate the starting pose; it is meant to loop, after all. Then I'll go about half way between these two keyframes and move bits around to create the A->B->A sort of 'idle' or 'breathing' animation.
    The Free Transform seems dodgy though. If I select all the 'limbs' of a character at once and try to rotate them as a group, it works, but they each end up displaced a bit when I release the mouse; they get offset slightly or rotate a bit in seemingly random directions.
    For example, compare these two images (it's easiest if they're opened in separate tabs, I suppose): http://scraps.fighunter.com/sparkpupagh1.png and http://scraps.fighunter.com/sparkpupagh2.png
    The first one is after rotating it but before I released the mouse button, the second is what the pieces ended up like after I released the button. Most of the pieces ended up where they should be, but the head was offset slightly. This is a mild case; it's usually worse and affects all the pieces, and the slight offsets and rotations build up, too.
    This in itself wouldn't be too bad - though it's frustratingly inaccurate - but it gets much, much worse the more I work on a single animation.
    (Note: These strange changes don't happen if I rotate all the parts as a group if they're not also contained within new motion tweens...)
    Here's a screenshot showing a frame mid-way through an animation, with one of the parts selected: http://scraps.fighunter.com/meepagh1.png
    The Motion Editor is shown, though I don't use that directly.
    With that feather bit selected, I then rotated it a tiny, tiny amount, but didn't *move* it at all. When I released the mouse, it ended up snapping suddenly to here: http://scraps.fighunter.com/meepagh2.png
    That'd be frustrating in itself, but as you can see from the Motion Editor, it's also messed up most of the other frames in the animation, somehow. This becomes unbearable, as you can likely imagine!
    If I edit the graph in the Motion Editor directly to alter the Z value and cause a rotation, it works, without problems... but this is horribly inefficient and unintuitive and not a solution. I can't animate by tweaking numbers. It's like trying to draw a portrait using an Etch-A-Sketch!
    It seems to only be the Free Transform tool that creates this bizarre problem.
    This has been happening since I got CS5 maybe a year or two ago, though I haven't actually had to use the animation tools much until a few days ago so that's why I'm bringing it up now. I've restarted Flash, my computer, etc, etc, many times; I also got the trial version of CS6 today to see if THAT would fix it, but the exact same thing happens in that version too.
    I'm wondering whether it's my computer's fault in some way... I don't know enough about hardware and 'specs' and that sort of stuff to describe anything about it, but I'm using Windows Vista and the computer is fairly old and not exactly what I'd call reliable. I'm planning to get a new one soon, so it'd be nice if that fixed this problem... but frustrating if it doesn't.
    I'll link to the CS6-flavoured .fla that those screenshots are from: http://scraps.fighunter.com/Meep.fla
    I'd very much appreciate it if someone could test this to see if it's happening to only me! If I go to frame 146 (to choose one at random), and try to rotate the foot, slightly, using the Free Transform tool, it breaks in the way that I've described. (Oddly, the head feather rotates without issues on that frame...) If you were to try to do this same thing and it *doesn't* break, it might be a good sign that it's my computer's fault!
    If it *does* break though... then I'd very much appreciate any help I can get from someone who understands the new motion tweens better than I do!
    It'd be a shame to have to go back to Classic Tweens because of this...

  • Adobe Flash CS5 - Blur effect & tween not working

    When I try to create a tween for the blur, so it will blur into focus, the tween just wont work. I go to frame 130, keyframe, add blur filter, create clasic tween. But when i go to frame 131 it instantly pops into focus instead of going along the tween time span to blur in gradually(I have the next keyframe at 160). Anyone have any ideas?! This boggles my mind!
    Any help or suggestions would be deeply appreciated
    Thanks in advance...

    What type of textfield are you using?  What type of symbol have you created it as?  If you can show a screenshot of the stage and timeline for what you have it might help to identify the problem.

  • Best Buy hijacked my bank account and disposed my Best Buy points

    I placed an online order on 09/05/2014 (Order number: (removed per forum guidelines) around 4pm eastern, and about 3 hours later, I got another email stating "YOUR ITEM HAS BEEN CANCELED". It was for an in-store open box item, which I was able to pay for online and pick-up at the store, or so I thought. I used two $5.00 reward certificates, a gift card, and my credit card to finalize the transaction. The email titled, "YOUR ITEM HAS BEEN CANCELED" contained this information:
    Be assured that if you paid by credit card, it has not been charged, and any other method of payment has been credited. If you used a Gift Card for this order and no longer have it, please call the number below and we'll send you a replacement.
    If you have any questions about your order or need further assistance — or if you'd like help finding a similar item — please contact us at
    1-888-BEST BUY (1-888-237-8289).
    Once again, we're sorry for this inconvenience, and are working hard to serve you better in the future.
    Sincerely,
    Karalyn Sartor
    Vice President Customer Care
    Well, lets just start wih Karalyn did not answer my call or attempted to help.
    My gift card was immeditely re-credited, however it has been a different story for the other method of payment. My certificates which were accumulated through purchases totaling over $500 dollars, never regenerated (i've called 3 separate times about when are they going back to my points bank and responses range from 24hr to 45days) it's now Wednesday this happen last Friday. The cancelation email stated my credit card would not be charged, but Best Buy did something worse they placed a hold on my card for this order that wasn't fulfilled and actually canceled by Best Buy employees at the store(553) due to not in stock (as stated in cancelation email).
    The transaction was completed online because it indicated stock was available and the, "Thank you for your order" email implied that ownership was mine. I don't understand why Best Buy placed a hold on my card, if the transaction was manually checked and canceled? What makes it worse there was no attempt to contact me to substitute canceled order or give me a definitive reason why it was canceled. In fact, my reward certificates that I accumulated over some time were gone due to this cancelled order and no definitive answer has been given to when they will show back on my account. I was told Friday the hold would release in 3-5 days and it "should" drop, but it now Wednesday. I would understand if this was a return transaction and I have to wait for my funds to be available again, but I had no possession of item and it the transaction didn't go through why is Best BUy holding my money hostage? I'm not in the business of lending out money, and I needed those funds to actually acquire what I attempted to in my order. I shouldn't have to wait on my money, I feel like I'm being bullied and down right punished.
    So, now it gets worse for me because. I called I-800 for Elite Plus reward members ( been a member since it was Premier Silver) to make sure stock was available on a similar item (at full price), and asked about the points, I lost and how I would be able to apply them to my purchase. The rep adjusted the price to accommodate my transaction and said that the points would be still go back on my account in 24 hrs. This new order was finalized on the same day as original order Friday 09/05/2014.
    Well, I checked my bank account Monday , and was surprised to see the original cancelled order was still there, as well as two identical transaction that I'm assuming represented my new order. I was patient and waited till Tuesday to check again, and hoped that all mistaken holds would drop, but I was wrong. Instead, now a hold actually posted as a completely different amount (lower) with the new order number associated to it, and the other amount(what I expected) is also there plus the original transaction amount. Who gave Best By create a third order without my consent? Why did Best Buy assume I had money to lend their cooperation? Why did Best Buy assume that my funds were at their disposal and authorized their own transaction? How dos Best Buy not consider unapproved transactions could overdraft my account? I called and asked, but no answer could be given to why that happen except that the rep charged me twice, and thats why theres two holds, but then that doesn't explain why one of those holds post at a cheaper price with my new order number on it. This is crazy, there is no reason why a third order should have been created because I didn't approve it. This has been too many days without my money, and these holds total a little pass $300.00 dollars (not chump change).
    Yesterday (09/09/14) I contacted my bank to find a solution to these unwarranted charges, and the only way to expedite and release my funds would be in a from of a letter from best buy on their letter head to be faxed to 18663097443 with the transaction amounts, card number, my name, date of transaction, signed by a manager, and a statement informing the bank that Best Buy would not collect on those charges. The other solution was to dispute the charge that posted because that amount was not contracted to be fulfilled under the agreement of the order form.
    So, I called Best Buy again. Well, after over an hour on the phone and the rep spoke to her superiors which declined the request, so I asked for the case number, but the rep told me that after during the conversation her computer crashed and no number could be given. So, I asked for some type of compensation for this crazy ordeal and for the financial position it put me in by creating a new order and holding funds from a canceled order. Well, she said my situation didn't correspond to reasons that warranted compensation, not even a coupon. I thought what happen to customer service as being a reason? The Best Buy rep did seem to empathize with my situation, and asked again for that authorization letter, and she said she got it approved; this was around 5pm yesterday. She then even said she was able to generate a case number with this approval (case number 144087240).
    Guess what Best Buy community its now Wednesday, and the holds are all there no communication was sent to the resolution department on the behalf of Best buy and I'm still out $300. plus dollars since Friday. Normally banks charge interest on loans, what will Best Buy do for me now that I have stolen my money? I never gave consent to create a third order, which now I will have to dispute and report to the Better Business Bureau. The most unbelieveble part of this mess is that the item in my original order that satrted all this is still up on the Best Buy page. An employee supoosley checked and made the determination that the item is out of stock, but its still on the webpage to trap another customer in lending Best Buy capital to fund their organization. I would clike to challenage any employee to attempt to but this item and see what happens to their funds. I mean, come on Best Buy if you don't pay the employee to trap people, then have them remove the item off the website where people are becoming victims to this money pit. Here is the link go for it and see what happens to you Karalyn Sartor, Vice President Customer Care. 
    http://www.bestbuy.com/site/apple-open-box-ipad-mini-with-wi-fi-16gb-white-silver/6208541.p?id=12187...
    I shop at Best Buy so much I held the silver Premier status since it was introduced, and every year the amount of how much you spend gets raised as benefits get removed, I've been able to surpass that threshold to maintain Elite Plus status since it too has been created topping almost $5000.00 this year alone, and we haven't hit Christmas yet. This experience is something to consider next time I think about going to Best Buy.

    Good afternoon robertocar78,
    After reading through your detailed post, I can fully understand why you would be frustrated with this experience. First off, stores should ensure that their clearance and open-box items listed on BestBuy.com are up-to-date to prevent such experiences as yours. Secondly, to have such an amount of funds unavailable would be quite worrisome, and I hope that I can bring some light to your particular situation.
    Using the email address you registered with the forum, I was able to locate your cancelled order as well as the replaced order. Typically when an order is placed, the funds are immediately authorized to ensure the funds are available. While this authorization may make the funds unavailable, the funds have not actually been collected.
    Once an order ships, the funds will be collected at that time. Should there be more than one item on an order, if the items ship separately or at different times, you may be charged for the individual items. That being said, you could see multiple smaller charges for one order that together make up the order total. If an order is cancelled, the authorization should be dropped on our end. However, this may take 3-5 business days to reflect on your end, depending on your financial institution’s processing times.
    I was able to see that you have been working extensively with Todd on our Consumer Relations team in regards to your situation. I spoke with him personally about your particular situation and let him know that you have also posted here in regards to your concerns. I’m happy to hear that he has been able to assist you in resolving most of your issues thus far.
    Also, please know that I am reaching out to the Tropicaire store in Miami, FL store in regards to this iPad listing to ensure they have a chance to correct any inventory or listing issues they may have. I am truly sorry for any inconvenience this experience may have caused you. I hope that this experience has not influenced your future shopping destinations.
    If you should have any further concerns or questions, please feel welcome to reach out to me here on the thread or by sending me a private message via the link in my signature below.
    Cheers!
    Tasha|Social Media Specialist | Best Buy® Corporate
     Private Message

  • How to dispose a JPanel ?

    Hi,
    i want to know, how to dispose or close the JPanel from the application as well as from the memory?.
    In Simple,
    for JFrame or JInternalFrame we have .dispose(), which will remove the component from view as well as from allocated memory.
    What is the equivalant method for that in JPanel.
    Thanks in advance.
    ** Subbu **

    yeah, u r right.
    i want to remove the JPanel from the JInternalFrame which is inside the JFrame.
    well, whenever i am clicking the MenuItems i will open a new JPanel in the Internal frame.
    In order to close that panel and open a new one , i made that as JPanel.setVisible(false) and creating a new instance for the second JPanel.
    When the panel count is increasing, i should make all the opened panels as setVisible as false. i don't want to do like this.
    i don't want to hide that JPanel. I want that to be removed entirely from the application.
    Whenever i need that again, i will create a fresh instance for that.
    can u able understand my problem?
    --Subbu                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Mail options & disposable addresses moved!

    Did anyone else lose access to their disposable addresses?  They're under 'Mail options', which used to be a very clear text button at the top left of the mail screen.  I've finally found that it's moved to the 'Gear cog' tools icon, at the top right, which is probably more logical.  
    Just in case anyone else spends 20 minutes trying to find it, like I did  

    Tried Live Help, but they were out to lunch or asleep, so that was 10 minutes wasted waiting for someone to respond. So with heavy heart used the phone, went throught the usual rigmarole and "did you know you can fix problems by looking online...." (yawn) and eventually insisted on being put throught to Yahoo, a patient and very polite guy near Delhi, who persuaded me to share control, got into the problem secondary account and just clicked around a bit, merely looking at settings, didn't change a thing, asked me to send another test email to one of the problem disposable addresses. Lo and behold it worked.
    The equivalent of kicking a car to make it start Isn't science marvellous?

  • Issue on Ordinary Depreciation Start Date and Disposal of Asset

    Hi All.
    I am facing the following the issues.
    Fiscal Year is from July - June
    First Problem: Company acquired the asset Vehicle on 26.Dec.2008. System proposes Ordinary Depreciation Start Date as 01.Jan.2009 rather then proposing Ordinary Depreciation Start Date as 01.Dec.2008.
    Since depreciation for previous year has been posted the client later found out that instead of calculating depreciation for 7 months depreciation was only calculated for 6 months. I tried to manually change the dep. start date but the system doesnot update the previous years values, it's still calculating depreciation for 6 months and not 7 months. Is there anyway in updating the previous fiscal years depreciation values.
    2nd Problem: I created a test case scenario today i.e. 16.09.2009 by creating and capitalizing an asset vehicle. Once I capitalized the asset the system automatically proposed the start date as 01.10.2009 and not 01.09.2009 which is what i require. What setting do i need to check or maintain in order to solve this issue because the user does not want to manually change the date each time an asset is created.
    3rd Problem: Similar to this now when client disposes of an asset suppose on 10.Feb.2009 (FY2009). The system calculates depreciation till the month in which disposal takes place (February), the client does not want this, their requirement is that depreciation should be calculated one month before disposal takes place i.e. in this case Dep should be calculated till Month of January.
    Your assistance will be highly appreciated.
    Mohammed Ali Khan.

    Hello Khan,
    The depreciation start date will get determined based on the period control method assigned to depreciation key,
    Period control methods are defined in transaction code : OAVH
    In period control method we will mention the depreciation start date for acquisition, additions and also depreciation end date for disposals, retirements.
    SAP has given some default period control keys. If any of these are not suitable to your requirement you can create on your own period control methods.
    THanks
    Sai

  • Problem with Tweens and HitTest

    Hi guys,
    I have a problem with by code generated Tweens and HitTest.
    But first of all the backgeround info. I have a couple of dots. They are generated from a single movieclip and differ in scale. The idea is, that the biggest one ist set to the middle position of the stage.
    The others are coming from the outer stage border and are moving towards the middle position. This is done by using the Tween class.
    What should happen is, that they stop exactly at the border of the dots which are already in the middle. In the beginning there is just the main, big dot which was manually positioned to the middle. When the first dot reached its position, the bounding box should include this new dot.
    I use the hitTestObjects method to stop the Tweeing.
    The problem is, that there is a 80% chance that the dots have gaps or overlapping each other. Any thoughts on that?
    Thanks for every reply!
    This is the hitTesting Code in the main class:
    public function hitTesting(e:Event):void{
                                  for(var i:int=0; i<dotArray.length;i++){
                                                      for(var j:int=i+1; j<dotArray.length;j++){
                                                                if(dotArray[i].hitTestObject(dotArray[j])==true){
                                                                          dotArray[i].stopTweening();
                                                                          dotArray[j].stopTweening();
    This is the code for a single Dot
    public function Dot(anchorArray:Array,randomX:int,randomY:int,scaleVal:Number,first:Boolean, delayVal:Number, lastElement:Boolean, values:Array) {
         this.x=randomX;
         this.y=randomY;
         this.scaleX=this.scaleY=scaleVal;
         this.valueName=values[0];
         this.countValue=values[1];
         this.gRanking=values[2]
         this.lastElement= lastElement;
         this.first=first;
          if(!first){
               this.xTween = new Tween(this, "x", None.easeNone, this.x, anchorArray[0], 20, false);
               this.yTween = new Tween(this, "y", None.easeNone, this.y, anchorArray[1], 20, false);
               this.xTween.start();
               this.yTween.start();
    public function stopTweening():void{
      if(!first){
          if(lastElement)
               parent.removeEventListener(Event.ENTER_FRAME, parent.hitTesting);
          xTween.stop();
          yTween.stop();

    Ok guys,
    found a solution. It seems to be, that the build in HitTest functionality is to inaccurate for my problem.
    I found a better implementation here.
    Tanks for reading.
    -alex

  • Problem with JFrame's dispose();

    Hello everyone,
    I'm having a problem with JFrame's dispose() method. In my program I have 2 classes which go into full screen. On each screen there is a button to switch to the other screen. The first time I push the button on both of them the other screen closes, which is what I want. However, if I push the same button more than twice - like by going from Screen1 to Screen2 and Screen2 to Screen1 and then Screen1 to Screen2 - I get 2 screens. If I keep doing that I eventually get 10+ screens up, which is bad. How do I prevent that?

    There's a lot of code, so I'll just post up the part that does it.
    backButton.addActionListener(new ActionListener()
                  public void actionPerformed(ActionEvent e)
                      soundManagerM.close();
                        new MenuScreen().setVisible(true);
                        dispose();
             });I don't think it opens up 2 at once, because it would play multiple music right?

  • I am trying to create a simple animated gif in Photoshop. I've set up my frames and want to use the tween to make the transitions less jerky. When I tween between frame 1 and frame 2 the object in frame two goes out of position, appearing in a different p

    I am trying to create a simple animated gif in Photoshop. I've set up my frames and want to use the tween to make the transitions less jerky. When I tween between frame 1 and frame 2 the object in frame two goes out of position, appearing in a different place than where it is on frame 2. Confused!

    Hi Melissa - thanks for your interest. Here's the first frame, the second frame and the tween frame. I don't understand why the tween is changing the position of the object in frame 2, was expecting it to just fade from one frame to the next.

  • Use of dispose() and finalize()

    Hello everyone (first post ever). I have a question about a program that I'm currently working on that doesn't seem to be releasing system resources. Here's a brief description of my program and my problem:
    Program Description: It's a widget that queries a news file every couple of minutes to check if the file was updated. If it was updated, then the taskbar icon flashes and signals the user to click on it to open a window showing them the news.
    Problem: The main use of this program will be just sitting in the taskbar waiting and checking to see if there are any updates. However, after a user opens the window, the memory usage obviously spikes to show the content of the window. After the window is closed, the memory stays allocated and never seems to go back down to it's memory usage when it was just sitting in the taskbar. I have the window set to dispose on close and have fiddled around with adding finalize() and dispose() statements in a couple of different places. I also don't call anything from this class in any of my other classes.
    Here is my Window.class, where I'm hoping the problem is. Thanks.
    package mainFiles;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    // The part of the program that displays the main window of the widget
    public class Window extends JFrame implements ActionListener, WindowListener {
         private static final long serialVersionUID = 1L;
         // Declare the global variables used in the method
         private JButton updateButton;
         // The default constructor of the window
         public Window() {
              // Create the container for holding the content of the widget
              JFrame mainWindow = new JFrame();
              mainWindow.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
              this.centerWindow(mainWindow, 475, 350);
              mainWindow.addWindowListener(this);
              // Customize the look of the JFrame a little bit
              mainWindow.setIconImage(new ImageIcon("system/images/tray_inactive.gif").getImage());
              mainWindow.setTitle("Widget Text");
              mainWindow.setResizable(false);
              // Create the home panel of the widget
              WindowBackground homePanel = new WindowBackground();
              mainWindow.setContentPane(homePanel);
              homePanel.setLayout(new BoxLayout(homePanel, BoxLayout.X_AXIS));
              // Create the left side of the window
              JPanel leftPanel = new JPanel();
              leftPanel.setOpaque(false);
              leftPanel.setPreferredSize(new Dimension(104,324));
              homePanel.add(leftPanel);
              // Add a spacer to the left panel from the top
              leftPanel.add(Box.createRigidArea(new Dimension(104,16)));
              // Add the update button to the left side of the widget
              updateButton = new JButton("Refresh");
              updateButton.addActionListener(this);
              leftPanel.add(updateButton);
              // Create the right side of the window
              JPanel rightPanel = new JPanel();
              rightPanel.setOpaque(false);
              rightPanel.setPreferredSize(new Dimension(365,324));
              homePanel.add(rightPanel);
              // Add a spacer to the right panel from the top
              rightPanel.add(Box.createRigidArea(new Dimension(365,16)));
              // Create the scrollpane which allows the news to be scrolled up and down
              JScrollPane contentScrollPane = new JScrollPane(Content.mainPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                        JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
              contentScrollPane.getViewport().setOpaque(false);
              contentScrollPane.setOpaque(false);
              contentScrollPane.setEnabled(true);
              // Set the size of the scrollpane, then add it to the right panel
              contentScrollPane.setPreferredSize(new Dimension(356,290));
              rightPanel.add(contentScrollPane);
              // Create an empty border around the scrollpane to remove the border
              Border empty = new EmptyBorder(0,0,0,0);
              contentScrollPane.setBorder(empty);
              contentScrollPane.setViewportBorder(empty);
              // Whenever the window is opened, update the tray icon to inactive
              Widget.updateIconToInactive();
              // Show the window to the user
              mainWindow.setVisible(true);
         // If the main window of the widget is closed, then give the user the ability to make a new one
         public void windowClosing(WindowEvent event) {
              // Set the window to no longer being active
              Widget.windowActive = false;
              // *** This doesn't seem to work
              this.removeAll();
              System.gc();
         // For centering the window on the user's desktop
         public void centerWindow(JFrame window, int width, int height) {
              // Set the size of the window to the size wanted
              window.setSize(width, height);
              // Get the two sizes and compute the average size between them
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              Dimension windowSize = window.getSize();
              int x = (screenSize.width / 2) - (windowSize.width / 2);
              int y = (screenSize.height / 2) - (windowSize.height / 2);
              // Set the location to the center of the screen
              window.setLocation(x, y);
         // Whenever a new WindowBackground is created, paint the background image on it
         public class WindowBackground extends JPanel {
              private static final long serialVersionUID = 1L;
              // Paint the background on the panel
              public void paintComponent(Graphics g) {
                   ImageIcon background = new ImageIcon("system/images/bg_window.gif");
                   background.paintIcon(this, g, 0, 0);
         // For responding to actions performed in the interface
         public void actionPerformed(ActionEvent event) {
              // If the user pushes the manual update button, then check for new updates
              if (event.getSource() == updateButton)
                   Content.check();
         // Although these aren't used, they must be included in the class
         public void windowActivated(WindowEvent arg0) {}
         public void windowClosed(WindowEvent arg0) {}
         public void windowDeactivated(WindowEvent arg0) {}
         public void windowDeiconified(WindowEvent arg0) {}
         public void windowIconified(WindowEvent arg0) {}
         public void windowOpened(WindowEvent arg0) {}
    }

    I'll try to describe it in some more detail:
    When the program first starts up, memory usage is around 9K to 11K, since the only task it has is to check an external file every five minutes to see if it's been updated. If there is an update, then the icon blinks which alerts the user that there is an update available. When they click on the icon, a window pops up displaying the news. Memory usage at this points run up to about 25K. Now this is where the problem comes in. After the window is closed, it should be disposed. Now, from what I understand, that means that the Garbage Collector should destroy it at some point and release the memory that's being used. However, many hours after the window has been closed, the memory usage is still at 25K. I just don't understand why it isn't using 9K-11K at that point.
    The main reason I care so much about memory usage is because this is a program that is going to be running in the background while users play PC games. It's mainly to get in touch with each other and tell each other when an event is happening in a specific game.

  • Crystal Reports Server 2008 dispose not closing document

    Hey everyone,
    I;m running some reports through Crystal reports 2008 server (no service packs) using the RAS sdk and Java.
    This was working swimmingly for a while until yesterday when the server hosting the RAS and app server fell over. I tracked it down to a problem with the RAS server. The error i got in my logs was General Exception, Report SDK Exception Not enough memory for operation.  I reran the process and when i watched task manager the memory being allocated to crystalras.exe went through the roof! it went from 50k to 1.8g of ram in under 10 minutes.
    I tried lots of the other suggestions in here for the errors about memory that are similar to mine (increasing the heap memory etc.) and none of them worked.
    One thing i noticed though is that when I run the process and watch the metrics page of the RAS server on the management console the number of Open documents does not decrease even though i am 100% totally and utterly calling .close and .dsipose after every report i open. Definitely. Ive debugged it a million times and it is calling these methods. It is successfully releasing the connections fine but does not seem to releasing the open documents. After the Open documents metric went down to 0 (im presuming after a timeout) the memory that crystalras.exe was reduced. I then  changed the timeout tag in CRConfig.xml to 1 minute to see would this help out any but the open documents did not timeout any faster.
    Would i be right in thinking that these open documents would be causing my problem of the aggregated memory? Im at my wits end here so any piece of help is greatly appreciated!

    Hi Ted,
    Thank you for getting back to me, i was on vacation there for a while so that is why i didnt get back to you.
    When I call reportClientDocument.isOpen() just before i dispose of the report it is true and after i dispose of it it correclty returns false.
    I am really stressing out over this as we are reduced to running 500 reports through the server (one after another) and then stopping the process and restarting the RAS server and then running another 500 reports.
    crystalras.exe gets up to about 2g of ram consumed for only 500 reports.
    I even changed some of the timeout settings on the settings page of the management console to see would they timeout and release the memory but alas it didnt release as much as a byte. I left it for 3 days and it didnt deallocate one piece of memory.
    Im currently investigating is there some way from my code that I can restart the RAS server, either through the SDK or through a windows process or scheduled task.
    Ted, as far as i can see there are no service packs for Crystal Reports Server 2008, is that right? when i go to the downloads page there only ones listed for release X1.
    Thank you for your help.
    J.

  • Disposing RefCursor does not close RefCursor?

    Hi,
    I want to dispose the OracleRefCursor after executing the executedatatable command. To achieve this, i tried to dispose the OracleRefCursor object but it did not close the cursor, i saw the related cursor in v$open_cursor table. So how can i close the opened cursor without closing the connection or committing or rollback? Thanks...
    The code that i tried to close cursor is:
    OracleParameter m_Cursor = m_Command.Parameters["pCursor"];
    m_Cursor.Dispose();
    It did not work.

    Hi,
    According to AskTom the fact that you see it in v$open_cursor doesnt mean it's necessarily open.
    Are you seeing a problem as far as ORA-1000 that you're trying to troubleshoot for example? Or is this just something you noticed?
    Thanks
    Greg

  • Closing or Disposing the Connection Does Not Release Open Cursors

    Hi,
    I have an architecture like this:
    Web Service ---> Business COM+ Component ---> Data COM+ Component
    I found that doing a SetAbort() plus explicitly close and dispose the OracleConnection object in my COM+ component does not necessarily close the open cursor.
    The way I tested was I would call the same same service multiple times and do a "select * from v$open_cursor where user_name = 'xxx'", I would see a bunch of open cursors with exactly the same SQL_TEXT. The only way to close those open cursors seems to be killing the aspnet_wp.exe process in the Task Manager.
    Someone here suggested it might be .NET's problem but I don't think so since I had the same problem with OraMTS 9i.
    Can someone from Oracle help? Thanks.
    -Linus

    Neeraj,
    Thank you for your reply. I'd like to let you know that my company submitted a TSR ticket last year (around Oct.?) on this issue and it's still not fixed, yet. This problem prevents us from using COM+ to handle any transactions, which is not acceptable to us. Please try to raise the issue again to your development team if you can, we are depending on the fix.

  • Dispose Report.vi cannot release excel

    HI.
    This is my first time to use the sub vi to generate excel file.
    I have used New report.vi and Dispose report.vi from the report generation kit but I can see from the Window Tast Manager, the excel .exe is stil running after the Dispose report.vi.As a result of that, I cannot see the excel file when my LabVIEW programme is running.
    Actually is it normal for that ?
    Thanks in advance.
    IO

    Dear Brian K,
    Thanks for your reply.
    Actually I have used the VIs in the toolkit to generate the excel file.
    My flow is : generate new excel file>make a new name to the worksheet to A>add a title to the data in sheet A>put the data in the worksheet A>save the file>select the other worksheet>name the worksheet to B>put some data to it>save the file>create graph >put data to graph>change the graph proporties>save the file>maxmize the excel window>dispose report.
    I have setted the whole programme to be continously running.
    What I suppposed is the excel file will be released after the first looping,then it will active again when the flow is reach to the VI to create excel file but in the real case, it doesn't behave like that.
    So I don't know whether I have got anything wrong with my flow or it's normal for that in LabVIEW.
    Thanks in advance,
    Io Hui  

Maybe you are looking for

  • Unable to chat "because user failed to respond"

    I and my family are having trouble using iChat AV for video chat. The problem also affects audio chat. Essentially, when person A invites person B to chat, and person B accepts, there is a delay with the spinning indicator (which always pauses moment

  • How To Avoid the message ...

    hi all, First the explanation: in one form ,form_A a query form where i enter just the empno to get the emp details and press the 'QUERY' button to get details i have written the below code in the when-button-pressed trigger. begin execute_query; end

  • Error 300 in deployment

    hi, excuseme my english isn´t very good, i expect could understand me..... well, I have a applications in jdeveloper, and my aplication server is in weblogic... well i have one pc with windows Vista Bussines Edition with Service Pack 1 and the other

  • Energy saver not coming on when lid closed

    I'm not sure if this because I changed some setting or because I did the battery sw upgrade but now when IU close the lid on my MBR it does not sleep. The apple on the back of it stays lit, and it looks like the display never goes off. Is there a set

  • Can't create subinterface from Cisco5510

    Hi Guys, need your help. I have a newly purchased Cisco5510 and I am configuring it as usual from the other high end ASA. But from this ASA, I cannot create a subinterface and cannot configure nameif from the main interface. Is it really a behaviour