A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Dynamic Text Box Buttom

  1. #1
    Junior Member
    Join Date
    Nov 2008
    Posts
    3

    Lightbulb Dynamic Text Box Buttom

    Hi all,
    I just want to create a sound button to stop and play.
    But I dont want to draw button or use image(for 2 frames).
    I want to Play and Stop sound on single frame using Dynamic Text Box(DTB) containing values "Off the Sound" and "On the Sound".

    When sound is playing DTB should display "Off the Sound" and when we click on it, the Sound must stop and DTB should display "On the Sound".

    How can I do it using variables to text box.

  2. #2
    Senior Member Robb@exo's Avatar
    Join Date
    Jun 2003
    Location
    Canada
    Posts
    1,540
    Try something like this,...
    PHP Code:
    var pArray:Array = ["On the sound""Off the sound"];
    var 
    playState:Boolean false;

    b1.pState.text pArray[0];

    b1.onRelease = function() {
        if(
    playState == false) {
            
    trace("sound off");
            
    b1.pState.text pArray[0];
            
    playState true;
        } else if(
    playState == true) {
            
    trace("sound on");
            
    b1.pState.text pArray[1];
            
    playState false;
        }

    HTH.
    Wile E. Coyote - "Clear as mud?"

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