Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. package
  2. {
  3.  
  4. import flash.display.Sprite;
  5. import flash.events.MouseEvent;
  6. import flash.text.TextField;
  7. import flash.text.TextFormat;
  8. import flash.text.TextFieldAutoSize;
  9. import com.greensock.TweenMax;
  10. import com.greensock.plugins.*;
  11.  
  12. public class Main extends Sprite
  13. {
  14.  
  15. private var format:TextFormat;
  16. private var text:TextField;
  17.  
  18.  
  19. public function Main(name:String,swf:String):void
  20. {
  21. graphic();
  22. events();
  23. createFormat();
  24. createText(name);
  25. //loaderSwf(swf);
  26. }
  27. private function graphic():void{
  28. graphics.beginFill(0x332211);
  29. graphics.drawCircle(0,0,50);
  30.  
  31. buttonMode = true;
  32. }
  33. private function createFormat():void{
  34. format = new TextFormat();
  35. format.font = "Arial";
  36. format.size = 20;
  37. format.bold = true;
  38. format.color = 0xFFFFFF;
  39. }
  40. private function createText(name:String):void{
  41. text = new TextField();
  42. text.text = name;
  43. text.x = -48;
  44. text.y = -12;
  45. text.mouseEnabled = false;
  46. text.width = 97;
  47. text.height= 27;
  48. text.autoSize = TextFieldAutoSize.CENTER;
  49. text.setTextFormat(format);
  50. addChild(text);
  51. }
  52. private function events():void{
  53. addEventListener(MouseEvent.MOUSE_OVER,over);
  54. addEventListener(MouseEvent.MOUSE_OUT,out);
  55. }
  56. private function over(e:MouseEvent):void{
  57. TweenMax.to(e.currentTarget,0.5,{tint:0xff0033});
  58. }
  59. private function out(e:MouseEvent):void{
  60. //TweenMax.to(e.target,1,{tint:remove});
  61. }
  62. }
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement