A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: simple button question

  1. #1
    Member
    Join Date
    Oct 2008
    Posts
    48

    simple button question

    Hello

    Heres the code I have inside a class in a constructor:

    Code:
    var bgRed:Shape = new Shape()
    			bgRed.graphics.beginFill( 0xFF0000 );
    			bgRed.graphics.drawRect( 0, 0, 200, 30 );
    			bgRed.graphics.endFill();
    			
    		var bgBlack:Sprite = new Sprite();
    			bgBlack.graphics.beginFill( 0x000000 );
    			bgBlack.graphics.drawRect( 0, 0, 200, 30 );
    			bgBlack.graphics.endFill();
    		
    		var tf:TextFormat = new TextFormat();
    			tf.color = 0xFFFFFF;
    			tf.font = "Verdana";
    			tf.size = 17;
    			tf.align = "center";
    		
    		var txt:TextField = new TextField();
    			txt.text = "Snipplr Rocks!";
    			txt.x = 0;
    			txt.y = 0;
    			txt.width = bgRed.width;
    			txt.height = bgRed.height;
    			txt.setTextFormat( tf );
    		
    		var mc:MovieClip = new MovieClip();
    			mc.addChild( bgRed );
    			mc.addChild( txt );
    			
    		var mc2:MovieClip = new MovieClip();
    			mc2.addChild( bgBlack );
    			mc2.addChild( txt );
    			
    		var btn:SimpleButton = new SimpleButton();
    			btn.upState = mc;
    			btn.overState = mc2;
    			btn.downState = btn.upState;
    			btn.hitTestState = btn.upState;
    			btn.x = 10;
    			btn.y = 10;
    			
    		addChild( btn );
    What it will only show text on mouse-over effect?

    Thanks a lot for help!

  2. #2
    trace("AKA: Biro Barna");
    Join Date
    Oct 2007
    Location
    RO.Timişoara
    Posts
    1,403
    I don't understand you problem, could you write proper English ?



    | Windows MSN: birobarna [at] hotmail [dot] com | Skype: barna.biro |
    WebLog: http://blog.wisebisoft.com/ |
    | Software Developer / Flash & Flex Developer | Student ( Computer Science ) | Interested in: Sharing Knowledge |
    |
    Romanian Adobe Flash, Flex, AIR Forum: http://www.flashforum.ro/
    | By perseverance the snail reached the ark. |


  3. #3
    Member
    Join Date
    Oct 2008
    Posts
    48
    With the code above I can only see text when I go over the button with the mouse, else its covered with red rectangular.

    I want text to be visible on mouseover as well as on mouseout event.

    Why is that happening?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center