MouseEvents not responding within a class

Hi
I have some code that draws a line that follows the mouse and fades away over time,
until now it was in the main file of my program but i want to make a class out of it for later use in other programs
i edited the code into a singleton MouseHandler class with one function that registers the mouse up and down events;
with trace and 'hasEventListener' i found out that the events are registered but nothing happenes when i press my mouse buttons
here is the class
package 
     import adobe.utils.ProductManager;
     import flash.display.DisplayObject;
     import flash.display.DisplayObjectContainer;
     import flash.display.MovieClip;
     import flash.display.Sprite;
     import flash.events.Event;
     import flash.events.MouseEvent;
     import flash.geom.Point;
      * @author Gadi G
     public class MouseHandler extends Sprite
          private  var _stage:DisplayObjectContainer;
          private var _bDraw:Boolean = false;
          private var _arrLine:Array = new Array();;
          private var _angle;
          private var _p1:Point =  new Point();
          private var _p2:Point = new Point();
          private var cos:Number;
          private var sin:Number;
          private var lineDrawing:Line;
          private var angle;
          private var distance:uint;
          private static var instance:MouseHandler;
          public function MouseHandler()
          public static function getInstance():MouseHandler
               if (instance == null)
                    instance = new MouseHandler();
               return instance;
          public function startListening(prnt:DisplayObjectContainer)
               _stage = prnt;
               _stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
               _stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
          private function mouseDownHandler(e:MouseEvent):void
               trace('down');
               _bDraw = true;
               _p2.x = mouseX;
               _p2.y = mouseY;
               _stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
               _stage.addEventListener(MouseEvent.MOUSE_MOVE, drawMouseLine);
          private function mouseUpHandler(e:MouseEvent):void
               trace('up');
               _bDraw = false;
               _stage.removeEventListener(MouseEvent.MOUSE_MOVE, drawMouseLine);
          private function enterFrameHandler(e:Event):void
               for each (var s:Line in _arrLine)
                    s.scaleX = s.scaleY *=  .79;
                    // the lowest possile value is one twip which is 0.05
                    if (s.width < .7)
                         _arrLine.splice(_arrLine.indexOf(s), 1);
                         removeChild(s);
                         s = null;
               if (! _bDraw && _arrLine.length == 0)
                    _stage.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
          private function drawMouseLine(e:MouseEvent):void
               _p1.x = mouseX;
               _p1.y = mouseY;
               _angle = Math.atan2(_p1.y - _p2.y,_p1.x - _p2.x);
               var rot:Number = (180 / Math.PI ) * _angle + 180;
               cos = Math.cos(_angle);
               sin = Math.sin(_angle);
               distance = Math.round(Point.distance(_p1,_p2)) + 1;
               while (--distance)
                    lineDrawing = new Line();
                    lineDrawing.x = _p2.x;
                    lineDrawing.y = _p2.y;
                    lineDrawing.rotation = rot;
                    _arrLine.push(addChild(lineDrawing));
                    lineDrawing = null;
                    _p2.x +=  cos;
                    _p2.y +=  sin;
               _p2.x = _p1.x;
               _p2.y = _p1.y;
in my main class i just use
MouseHandler.getInstance().startListening(this);
Thanks

1. If you want to use "this" as a parameter - you need to place objects on display list of "this" scope so that mouse interaction can occur. Otherwise - pass Stage instance.
2. How does instance of Line know how to draw base on mouse coordinates? From your code it doesn't seem it draws anything.
3. You don't add Line instance to display list.
4. Why do you set lineDrawing instance to null in the loop?

Similar Messages

  • Error: Device\Ide\iaStor0, did not respond within the timeout period.

    Hello,
    In last few months, I began getting the error:
    The device, \Device\Ide\iaStor0, did not respond within the timeout period.
    My system hangs and slows to a crawl.  Error seems to be well-known, and solution is to install the latest version of Intel Matrix Manager, which is 8.6.   I've done this, I reinstalled my OS, and I've reinitialized my hard Raid1 array.  None of this has helped.
    http://www.intel.com/support/chipsets/imsm/sb/cs-025783.htm
    Any suggestions?
    Thx.
    Scott

    Quote
    Have you tested HDD's with Seagate diagnostic utility?
    Going by the link you have provided I assume you are using Vista?
    Yes, I am using Vista and I did also use Sea Tools; no issue identified.  I'd love to hear more suggestions.  Things I've done:
    1.  Reformat / reinstall.  Helped, but problem not eliminated.
    2.  Ran SeaTools Disk Diagnostic.  No issue.
    3.  Installed Intel Matrix STorage, most recent version 8.6.  Should've fix prob, but didn't. 
    4.  Upgraded Bios from 7.5 to 7.9.
    Seems like the upgrade to Intel Matrix Storage Manager should've fixed this issue, but it didn't.   Any particular drive identified in the error message in the original post? 
    It is also not clear what changed to have introduced this error.  My system has been stable for 2 years and from the errors looks like I've had problems for the last 3 months, but they got notably worse in the last 2 weeks.  Reformatting / reinstall helped, but didn't eliminate these issues.  Any insight would be appreciated.

  • Developer Studio:Exception:The message server did not respond within 60 sec

    Folks,
    I am getting this error in Developer Studio ( J2EE Engine Preference) , Can anyone please tell me what is the issue.
    Exception: The message server did not respond within 60 sec.Please check if the message server is running and if the socket connection has been established
    Thanks,
    Manish

    If the system information page is showing 3900, you should use 3900 in your studio settings.
    39xx is the new default for 2004s. It was 36xx with 2004. And xx is the instance number.
    Regards,
    Christophe
    Message was edited by:
            Christophe Benoit

  • Java.sql.SQLException: Io exception: A remote host did not respond within t

    Hi All,
    I am using SUN ONE Webserver 6 on AIX with Oracle 8i. Every now and then I get this error
    java.sql.SQLException: Io exception: A remote host did not respond within the timeout period.
    I am not able to unterstand this. Some one please help...
    Thanks

    Are you able to connect to the database server from the same machine where you are running SJS Web Server using JDBC?
    Are the driver and the Database using compatible drivers?
    Does it normally work? Is the error accompanied by other symptoms like application failure or unusually slow responses?

  • J2ee connection error, "The Message Server did not respond within 60 sec"

    Hi,
    I am facing the error "The Message Server did not respond within 60 sec. Please check if the message server is running.." when connecting to J2ee through NWDS.
    I am able to reach the index page via http://<ip address>:53500/index.html but yet unable to reach through NWDS.
    I have tried various combinations of host and port names like:
    Message Server Host : <ip address>, <host name>
    Message Server Port : 3636, 3936
    but still no luck.
    I've also cross checked the value of message server port by navigating to http://<IP address>:53500/monitoring/SystemInfo too, it is 3636.
    The telnet test (telnet <ip address> <port Number>) draws a blank window.
    I know this problem has been posted again and again, but then I am unable to understand what is the solution to this.
    Can someone please help me in resolving this issue?
    Note: [link 1|Unable to Connect to the J2EE Server from Netweaver Developer Studio; & [link 2|Developer Studio:Exception:The message server did not respond within 60 sec; are already checked.

    Hi Robin,
    Although I still haven't received any info from my colleagues regarding the central instance..
    Just a quick query, if we have NW04 we use 36** and if it is NW04S then we use 39** , is this the only difference for message server port?
    If that is the case, as I mentioned earlier, I have tried both, and one gave me N/A(3936) while the other gave me 'message server did not respond' error(3636).
    I have the message server host name & port , Enqueue Server Host name & Port and SDM PID and Port details with me..
    Can this be anyway useful in establishing a connection?
    Waiting for your inputs...
    Best Regards,
    Vinay

  • Exception:The messege server did not respond within 60 sec.

    When I am deploying my application it is aborted and displaying the Error as
    'Deployment exception : Cannot determine sdm host (is empty). Please configure your engine/sdm correctly !'
    In Preferences >> SAP J2EE Engine I have specified a messege server host and its port.
    When I go to the Perspective J2EE Engine there I can see an error i.e.
    'Exception:The messege server did not respond within 60 sec.Please check if the messege server is running and if the socket connection is established'
    How to resolve this?

    Hi,
    I think the connection data is somehow not right.
    What is your message server host and port  being configured?
    I think the default message server port is 3601
    Regards,
    Vincent

  • Exception: The message server did not respond within 60 sec.

    Folks,
    I am getting this error in Developer Studio ( J2EE Engine Preference) , Can anyone please tell me what is the issue.
    <i><b>Exception: The message server did not respond within 60 sec.Please check if the message server is running and if the socket connection has been established</b></i>
    Thanks,
    Manish

    Hi,
    I think the connection data is somehow not right.
    What is your message server host and port  being configured?
    I think the default message server port is 3601
    Regards,
    Vincent

  • A remote server did not respond within timeout period

    HI
    I have a opened in servlet which is not closed.My servlet uses it for various checks.When a request comes after long time, my servlet tries to make a database call and that time I am getting following error.
    java.sql.SQLException:IO Exception A remote host did not respond within the timeout period.
    Please guide.
    Thanks in advance.

    I am using the same connection again.
    The db server is up and running and the query fetches hardly any data.
    when i stop and restart the servlet, everything becomes normal.

  • This item could not be crawled because the repository did not respond within the specified timeout period. Try to crawl the repository at a later time, or increase the timeout value on the Proxy and Timeout page in search administration. You might also wa

    HI,
    I got the error message in the crawl log as below after performing the Full Crawl
    This item could not be crawled because the repository did not respond within the specified timeout period. Try to crawl the repository at a later time, or increase
    the timeout value on the Proxy and Timeout page in search administration. You might also want to crawl this repository during off-peak usage times.
    To overcome the above error,many forums have suggested me to increase the time out which is under Farm level settings.But if time out gets increased,performance impacts as well.
    So please suggest me to overcome this error without increasing the timeout.Thanks in advance
    Regards,
    Sudheer
    Thanks & Regards, Sudheer

    Hi,
    I understand that you get the error message when performing a full crawl. I have seen similar cases caused by IE proxy settings. You can try to edit the Internet Options>Connections>LAN settings. Uncheck ‘Automatically detect settings’.
    For more information, please refer to this site:
    Search error: crawler could not connect to the repository:
    http://social.technet.microsoft.com/forums/en-US/sharepointadminprevious/thread/c230ab36-8d0b-4c25-bf86-33136d17642b/
    Thanks,
    Entan Ming
    Entan Ming
    TechNet Community Support

  • The embedded controller (EC) did not respond within the specified timeout period - Flex 15D

    Hello,
    I have an IdeaPad Flex 15D, and I have had several problems (mostly processor-related) in the time I have been using it. I contacted Customer Support twice, and finally did a system reset a few days ago after being told by Lenovo Support that my choices for fixing the problem were 1) Reset, or 2) Pay for a premium service to diagnose the problem. Needless to say (again), I went with option 1. So far I have not had any noticible problems with the processors, but there is a certain error showing up in the Event Viewer that I am concerned about. Lenovo Support has been next-to-useless troubleshooting my problems thus far, so I'm taking them here. The error is as follows:
    (Event ID 13)
    The embedded controller (EC) did not respond within the specified timeout period. This may indicate that there is an error in the EC hardware or firmware or that the BIOS is accessing the EC incorrectly. You should check with your computer manufacturer for an upgraded BIOS. In some situations, this error may cause the computer to function incorrectly.
    Sounds like the BIOS needs an update, right? Well, I went straight to the Flex 15D drivers page, and guess what? I quote the drivers page: Bios update is not required for this product. Not required? So, Lenovo ships a broken BIOS and then refuses to support it? I don't know if Lenovo employees ever read this forum, so this might not be the best way to get their attention, but I am so fed up with Customer Support and I want this issue to be known to more than just a few unhelpful 'tech support' people. The Flex 15D isn't one of the more popular laptops out there, so I can't expect anyone reading this to be able to duplicate this problem or really provide any support, but if you have any suggestions whatsover, please reply to this thread. Like I said, I want people to know, and hopefully we can get Lenovo's attention so they can fix this problem.
    Best regards,
    Owen Dugmore

    Hi,
    I understand that you get the error message when performing a full crawl. I have seen similar cases caused by IE proxy settings. You can try to edit the Internet Options>Connections>LAN settings. Uncheck ‘Automatically detect settings’.
    For more information, please refer to this site:
    Search error: crawler could not connect to the repository:
    http://social.technet.microsoft.com/forums/en-US/sharepointadminprevious/thread/c230ab36-8d0b-4c25-bf86-33136d17642b/
    Thanks,
    Entan Ming
    Entan Ming
    TechNet Community Support

  • ITunes becomes 'not responding' within seconds of running

    I have installed the latest version of iTunes but it won't run without crashing and becoming 'not responding'.  I can only kill it from Task Manager.  Initially I thought it was due to the Determining Gapless Playback Information sequence failing, so I moved my iTunes database into another folder imagining that rescanning my library and creating a new one would solve the issue.  However when running, iTunes asks to scan my system for music, finds a few tracks then crashes again.
    What can I do?
    PC running Win 7
    Music stored on NAS connected to Wifi Router
    iPhone 4S

    An update:
    I found an article which suggested running iTunes in 'Safe Mode' to disable plug-ins.  I don't recall installing any plug-ins but I did this nonetheless.  I'm happy to report iTunes ran and got through the Determining Gapless Playback process.
    I searched in the places where the article suggested the plug-ins were stored and did not find any files (though I did find the folders).  I have got 'Show hidden folders and files' selected.
    What else can I do, other than running iTunes in Safe Mode every time?

  • Satellite L305-S5955 Freezing and not responding

    I have had this laptop for more than 4 years now and recently I have had issues with it freezing up and not responding within approximately 5-10 min of booting up. I have had to do a system restore to factory out of box state 3 times now. What could be causing this issue and how do I stop it from happening again? Please help me!!!!

    How to create a system repair disc?http://windows.microsoft.com/en-us/windows7/create-a-system-repair-disc
    I Love my Satellite L775D-S7222 Laptop. Some days you're the windshield, Some days you're the bug. The Computer world is crazy. If you have answers to computer problems, pass them forward.

  • With ios 8.3 ipad mini apps sometimes do not respond when touched

    a new problem occurred with ios 8.3 ipad mini applications sometimes do not respond when touched Fix it in ios 8.4

    If it has NEVER been jailbroke, here are some standard repair procedures:
    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  It could take well over an hour!  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow the on-screen directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    At the end of the basic Restore, you will be asked if you wish to sync the iPad/iPod.  As before, say "yes."  Note that that sync selection will disappear and the Restore will end if you do not respond within a reasonable time.  If that happens, only the apps that are part of the IOS will appear on your device.  Corrective action is simple -  choose manual "Sync" from the bottom right of iTunes.
    If you're unable to do the Restore (or it doesn't help), go into Recovery Mode per the instructions here.  You WILL lose all of your data (game scores, etc,) but, for the most part, you can redownload apps and music without being charged again.  Also, read this.

  • Hu, my iPad has a frozen screen, was working fine then would not respond to touch, any ideas?

    Hi,
    Has anyone had a problem with their ipad screen not responding to touch? I can't close it down properly or entre the password to start it up again, the screen does not respond to touch...any ideas?
    Thanks
    Rob

    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  It could take well over an hour!  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow the on-screen directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    At the end of the basic Restore, you will be asked if you wish to sync the iPad/iPod.  As before, say "yes."  Note that that sync selection will disappear and the Restore will end if you do not respond within a reasonable time.  If that happens, only the apps that are part of the IOS will appear on your device.  Corrective action is simple -  choose manual "Sync" from the bottom right of iTunes.
    If you're unable to do the Restore, go into Recovery Mode per the instructions here.  You WILL lose all of your data (game scores, etc,) but, for the most part, you can redownload apps and music without be charged again.  Also, if you have IOS-7, read this.

  • HT201263 display extremely faint; sliders do not respond

    My itouch seemed dead to the world, but close examination revealed an extremely faint screen. Battery charged.
    Slide bars not responsive to my touch; cant unlock it.  Restored software; no improvement.
    Comments?   Thanks,  Chris

    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until the screen blacks out or you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    At the end of the basic Restore, you will be asked if you wish to sync the iPad/iPod.  As before, say "yes."  Note that that sync selection will disappear and the Restore will end if you do not respond within a reasonable time.  If that happens, only the apps that are part of the IOS will appear on your device.  Corrective action is simple -  choose manual "Sync" from the bottom right of iTunes.
    If you're unable to do the Restore, go into Recovery Mode per the instructions here.

Maybe you are looking for

  • Unhandled exception error when i open the reports in crystal reports 12.0

    Hi All When i open Reports in SAP Business one it is showing unhandled exception occured unknown user name and password because of this i could not check my reports can any one help me on this? Regards Boopathi.T

  • Buffer Tuning in ST02 Recommendations

    I am looking for some advice as to how to change tune my buffers in our application servers.  Their current settings are based off of SAP’s, pre go-live checks.  But to me they seem to need some adjusting. Our server has 8GB’s of RAM, so I feel like

  • Opening hang reports

    My main problem is, after recently upgrading to Leopard I get frequent hangs in Safari (sometimes other applications too, but unlike Safari, these usually resolve themselves in a few seconds). Hoping to post a couple of the hang reports (are these th

  • IPhoto Library Upgrader not successful

    I recently upgraded from my old iMac using Leopard v10.5.6 to a new iMac with Mountain Lion v10.8.2.  All my documents were successfully transferred to my new computer from my external hard drive including photos however I only seem to be able to vie

  • Google search redirect to yahoo 404

    Recently, when searching using my google search in safari on my iPad 1 I am redirected to a yahoo 404 error.  After resetting the iPad it seems to have gone away, but is this symptomatic of something else? This happened while on wifi.  Any insight is