As3 code: Change the mouse arrow style and follow the mouse!

Source: Internet
Author: User
Package
{
Import Flash. display. Sprite;
Import Flash. Events. mouseevent;
Import Flash. UI. Mouse;
Public Class Main Extends Sprite
{
Private VaR Flag: Boolean = New Boolean ();
Public Function Main (): void
{
// Create a new light mark (small square)
VaR A: SPRITE = new sprite ();
A. Graphics. beginfill (0xff0000 );
A. Graphics. drawrect (0, 0, 50, 50 );
A. Graphics. endfill ();
This. addchild ();

A. startdrag ( True ); // The new cursor follows the mouse
Mouse. Hide (); // Hide original cursor
Stage. addeventlistener (mouseevent. Click, ); // Monitor whether the stage is clicked
Flag = False ; // Identify that the original mouse arrow is hidden
}

// Events triggered by mouse clicking on the stage
Private Function An (EVT: mouseevent): void
{
If (Flag = False )
{
Mouse. Show (); // Show Original cursor
}
Else
{
Mouse. Hide (); // Hide original cursor
}
Flag =! Flag; // hide and display status conversion
}
}


}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.