A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Boolean toggle button in AS3.0 (flash CC)

  1. #1
    Junior Member
    Join Date
    Sep 2015
    Posts
    4

    Boolean toggle button in AS3.0 (flash CC)

    Hello

    I'm new to AS3.0 and I'm trying to create a toggle button that starts and pauses on a timeline (button = playTrace).

    play_btn just makes the correct instance of the button show for each Boolean state.

    I think the "var f1_MC" is the problem. Its ugly but here is what i have.

    Thank you in advance for any help.

    p.s. the initial code was taken from a sound channel and i tried to modify it.



    playTrace.addEventListener(MouseEvent.CLICK, fl_ClickToPlay);

    var fl_MC:MovieClip
    var lastPosition:Number = 0;

    var fl_ToPlay:Boolean = true;

    function fl_ClickToPlay(evt:MouseEvent):void
    {
    if(fl_ToPlay)
    {

    fl_MC = play(lastPosition);
    play_btn.visible = false
    }
    else
    {

    lastPosition = fl_MC.position;
    play_btn.visible = true
    /*fl_MC.*/stop();
    }
    fl_ToPlay = !fl_ToPlay;
    }

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    It's hard to do as you haven't given all the code. ( I think you are needing sound channel ect ect, if it's anything to do with sound. )

    Here is an mp3 player I made ( AS3 - CS6 ), take a look and get what you need from it and incorporate your boolean buttons.

    Just put an mp3 in the same directory called "song.mp3" and publish the swf.
    Last edited by fruitbeard; 09-15-2015 at 01:57 AM.

  3. #3
    Junior Member
    Join Date
    Sep 2015
    Posts
    4
    Hello fruitbeard

    I want it to work on a timeline not as a sound channel, the reason is i need to be able to manually add an audio file (to the timeline) and adjust the timeline labels to fit the length of the audio file. I have the players all set up in AS1 but that does me no good now that i only have the CC version of flash. thank you for taking the time to answer my question.

    fyi: that is all the code i have written in AS3 so far

  4. #4
    Junior Member
    Join Date
    Sep 2015
    Posts
    4
    Fruitbeard

    thank you for the mp player, if i was to use this kind of "sound channel" set up for my audio player would i be able to do a fast forward and Rev? and if so how would the player figure out where the segments (for lack of a better term) would be. my player is used to play instructions and breaks in the middle of sentences would sound bad.

    thank you again

  5. #5
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    I have a feelingy ou want your sound to be on the timeline, so if you import your sound to the timeline and stretch the movieclip graphics/text to equal the sound timeline length.

    yes you can rw/ff sound. search for sound scrubbing / timeline scrubbing

    The attached file just slightly corrects your orignal code, you will not be able to scrub the movieclip timeline using sound.posiiton very easily, although it could be done.

  6. #6
    Junior Member
    Join Date
    Sep 2015
    Posts
    4
    Yes I do want my audio on a timeline and I was trying to modify some sound channel code to work with my AS1 audio player. i will research scrubbing to see what I can figure out. i was going to add what i have so far but the file is too big for the attachment rules



    Thank you again for the help.

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