A Flash Developer Resource Site

Page 3 of 9 FirstFirst 1234567 ... LastLast
Results 41 to 60 of 169

Thread: Buttons in down state... little help?

  1. #41
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Fruitbeard, do you decompiled the .swf? Hehe

  2. #42
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Fruitbeard: he never has mentioned anything about a pause/unpause button, and anyway there is no pause button on the tape player, he wanted rewind/fastforward buttons, thing that i'm not too advanced with, so, as you are so wishful in helping him, here is your chance ^_^ i did a lot already. I will post the fixed .fla so both can proceed with the rewind/fastforward thing.

    One last thing, i did make the reel rotations stop, maybe you are watching an old .swf in my site, you need to clear the cache. The reel are stopped when the movie starts, then when you hit on of the right tape buttons, the reels begin to rotate. Then when you hit stop, the reels stop. For the reels playing if there is not a tape inside, i made it like that because I knew that when you press the play button on a tape player, the reels begin to rotate even if no tape inside. I just tried it with my cassette/tape FM radio, I removed the tape, pressed play and it was rotating and working with no tape inside.

    And you used a lot of functions only for a simple thing like a rotation. I already have the main function " songSelected(); " that contains the function " rotateReels();" there is no need to use a 3rd function "playreel();"

    songSelected(); is the function that the "playbutton" and the "tape buttons" will call to do this things: 1-go to the frame 2 of the playbutton movieclip, where it is DOWN/PRESSED. 2- turn the playbutton pressed =true; 3- play a click sound when the playbutton is pressed 4- rotate the reels

    And the songSelected(); function calls the rotateReels(); function that contains the actually rotating script
    Actionscript Code:
    reel._rotation +=8;
        reel2._rotation+=8;
    And when you hit the stop button it deletes the onEnterFrame function of the rotateReels(); function , stoping the rotation of the reels.

    That meets the requirements. What you did, fruitbeard, is like this:
    This function, will call this other function, that will call this another function, that will rotate the reels. 3 steps, for something that can be done in 2. Hehe.

    And i didn't understand the fact of doing this:

    Actionscript Code:
    reel._rotation = reel._rotation + 8;
        reel2._rotation = reel2._rotation + 8;

    Isn't it the same than doing this:
    Actionscript Code:
    reel._rotation  += 8;
        reel2._rotation += 8;
    ???

    It is like comparing a movieclip with itself? I have seen a lof of times that when you use the equal sign is for comparing to different objects:

    Actionscript Code:
    reel._rotation = xmouse +8

    Scot: We are few steps closer to achieve your ambicious project hehe. I have had fun with it. I fixed the button boundaries/hit state, the buttons are not overlapping each other anymore. you can click anywhere on the buttons now. For the eject button, yeah, we can make it empty the tape's tray and stay like when the movie starts.

    Fruitbeard, the ball is in you yard! Good luck with the rewind/fastfordward buttons. If need my help, I will be arround.

  3. #43
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    That thing looks amazing ^ I hope thats not the correct resolution though because can't read anything, Also when you hold down the button it plays the click/unclick sound even if you didnt unclick it :P but im just looking at the minor details :P what is that thing for and cool songs.

    Talking about this : http://sofistica2.zzl.org/Yes.html
    lol I was commenting on the first page

    This gives me a great idea for my game

    Also found a bug :
    Attached Images Attached Images
    Last edited by AS3.0; 07-18-2012 at 06:14 PM.

  4. #44
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Basses, i have nothing to do with the images hehe. I'm only helping our friend scot with the actionscript. Yes, there is a lot to fix on the buttons, align them etc. I'm working right now on the Eject button script. That image, lols.PNG, what's the bug? Thanks for coming by ^_^

  5. #45
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Scot, i need something, please make the Eject button image PRESSED/DOWN, and send it to me as .PNG or .FLA.

  6. #46
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Updates
    1-The rewind, fastforward and record buttons have not been programmed yet.
    2- Scot wanted the songs to be started automatically after pressing the song/tapes buttons on the right. I thought about 'selecting' the song first, then hitting the PLAY button to start the song, so it isn't a bug actually, he want it that way.
    3- I added a sound like a "motor" when there is not a tape inserted, and you hit the play button, the reels start to rotate and the sound of the reels/motor...it is perfect to me, and that is how most tape/cassette players and karaokee's work.

  7. #47
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    Theres no tape but the middles spinning

    For some reason this thing amazes me alot, do you care if I made my own version and show it here later :P this things so simple yet awesome got atleast 10 ideas.
    Last edited by AS3.0; 07-18-2012 at 06:58 PM.

  8. #48
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Yes bosses. It is supposed to work that way. Have you ever used a tape player? I have one in my house, and i connected it to see how it works, and yes, even if no tape is inserted, and you press the play button, the middles (like you called it) the reels, begin to rotate and a motor like sound is heard.

    Updated SWF ( if no see the changes, clear the browser's cache)
    http://sofistica2.zzl.org/Yes.html

  9. #49
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    Oh, my bad dude I love it xD

  10. #50
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Yeah, it's really nice

  11. #51
    Member
    Join Date
    Jul 2012
    Posts
    52
    Quote Originally Posted by angelhdz View Post
    Scot, i need something, please make the Eject button image PRESSED/DOWN, and send it to me as .PNG or .FLA.
    Angelhdz, here's a link to the down state eject button in png: http://www.sendspace.com/file/v4w5ok

  12. #52
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    I'm working on a tape player now xD I cant help it, its too beast props to you scot

  13. #53
    Member
    Join Date
    Jul 2012
    Posts
    52
    Quote Originally Posted by Basses6 View Post
    That thing looks amazing ^ I hope thats not the correct resolution though because can't read anything, Also when you hold down the button it plays the click/unclick sound even if you didnt unclick it :P but im just looking at the minor details :P what is that thing for and cool songs.
    It's an mp3 player for a musician client I'm working with to showcase some of his songs.

    Yes, the buttons need to be lined up a little better, but that's not a big deal. The scripting is the hard part.
    Last edited by ScotinOttawa; 07-18-2012 at 08:12 PM.

  14. #54
    Member
    Join Date
    Jul 2012
    Posts
    52
    Quote Originally Posted by Basses6 View Post
    I'm working on a tape player now xD I cant help it, its too beast props to you scot
    It's mostly Angelhdz. I just did the graphics.

  15. #55
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    Master, mine is half done I'll show you tommorow :S

  16. #56
    Member
    Join Date
    Jul 2012
    Posts
    52
    Quote Originally Posted by angelhdz View Post
    Scot, i need something, please make the Eject button image PRESSED/DOWN, and send it to me as .PNG or .FLA.
    Here is the link for the eject button in the up state: http://www.sendspace.com/file/htt3qp

  17. #57
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Quote Originally Posted by fruitbeard View Post
    Hi,

    on Angels code, swap it all for this, no worry angel i only added a function for the reels to play and not play;

    Actionscript Code:
    function rotateReel()
    {
        reel._rotation = reel._rotation + 8;
        reel2._rotation = reel2._rotation + 8;
    }
    function songSelected()
    {
        tapeout.gotoAndPlay(2);
        reel._visible = true;
        reel2._visible = true;
        playbutton.gotoAndStop(2);
        playbutton.pressed = true;
        btnclick.start();
    }
    function playreel()
    {
        this.onEnterFrame = function()
        {
            rotateReel();
        };
    }
    stop();
    playbutton.stop();
    stopbutton.stop();
    fastforwardbutton.stop();
    rewindbutton.stop();
    player.stop();
    reel.stop();
    reel2.stop();
    tapebtn1.stop();
    tapebtn2.stop();
    tapebtn3.stop();
    song1 = new Sound();
    song1.attachSound("song1");
    song2 = new Sound();
    song2.attachSound("song2");
    song3 = new Sound();
    song3.attachSound("song3");
    btnclick = new Sound();
    btnclick.attachSound("btnclick");
    playbutton.onPress = function()
    {
        if (this.pressed == true)
        {
        }
        else
        {
            songSelected();
            if (tapebtn1.pressed == true)
            {
                stopAllSounds();
                song1.start(0,99);
                playreel();
            }
            if (tapebtn2.pressed == true)
            {
                stopAllSounds();
                song2.start(0,99);
                playreel();
            }
            if (tapebtn3.pressed == true)
            {
                stopAllSounds();
                song3.start(0,99);
                playreel();
            }
            trace("play button pressed");
        }
    };
    stopbutton.onPress = function()
    {
        stopAllSounds();
        btnclick.start();
        this.gotoAndStop(2);
        playbutton.gotoAndStop(1);
        playbutton.pressed = false;
        delete onEnterFrame;
        delete this.onEnterFrame;
    };
    stopbutton.onRelease = stopbutton.onReleaseOutside = function ()
    {
        this.gotoAndStop(1);
    };
    tapebtn1.onRollOver = tapebtn2.onRollOver = tapebtn3.onRollOver = function ()
    {
        this.gotoAndStop(2);
    };
    tapebtn1.onRollOut = tapebtn2.onRollOut = tapebtn3.onRollOut = function ()
    {
        this.gotoAndStop(1);
    };
    tapebtn1.onPress = function()
    {
        playreel();
        songSelected();
        player.gotoAndStop(2);
        stopAllSounds();
        song1.start(0,99);
        tapebtn1.pressed = true;
        tapebtn2.pressed = false;
        tapebtn3.pressed = false;
        playbutton.pressed = true;
        playbutton.gotoAndStop(2);
    };
    tapebtn2.onPress = function()
    {
        playreel();
        player.gotoAndStop(3);
        songSelected();
        tapebtn2.pressed = true;
        tapebtn3.pressed = false;
        tapebtn1.pressed = false;
        stopAllSounds();
        song2.start(0,99);
        playbutton.pressed = true;
        playbutton.gotoAndStop(2);
    };
    tapebtn3.onPress = function()
    {
        playreel();
        player.gotoAndStop(4);
        songSelected();
        tapebtn3.pressed = true;
        tapebtn2.pressed = false;
        tapebtn1.pressed = false;
        stopAllSounds();
        song3.start(0,99);
        playbutton.pressed = true;
        playbutton.gotoAndStop(2);
    };
    you dont have to use it but it does what you wish.

    the links, do you mean you wish the songs to pause and unpause rather than load again?
    Hey fruitbeard! Did you decompile the swf? How did you get my code?

  18. #58
    Member
    Join Date
    Jul 2012
    Posts
    52
    Angel, how close are we to RW and FF? There is a tutorial for this:

    Maybe try this action script:
    this.onEnterFrame = function () {
    //Reverse
    if (REV==1 && myMusicPosition>0) {
    _root.myMusic.stop("myMusic01");
    myMusicPosition=myMusicPosition-.5;
    //The .5 is the decremented amount.

    _root.myMusic.start(myMusicPosition,0);
    }
    revButton.onPress = function () {
    REV=1;
    myMusicPosition=_root.myMusic.position/1000;
    //
    }
    revButton.onRelease = function () {
    REV=0
    }
    //Fast Forward
    if (FF==1 && myMusic.position < myMusic.duration) {
    _root.myMusic.stop("myMusic01");
    myMusicPosition=myMusicPosition+.5;
    //The .5 is the incremented amount.

    _root.myMusic.start(myMusicPosition,0);
    }
    FFButton.onPress = function () {
    FF=1;
    myMusicPosition=_root.myMusic.position/1000;
    }
    FFButton.onRelease = function () {
    FF=0
    }

  19. #59
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    That case is not mine lol. I did a lot already. Talk with fruitbeard, he's very interested in this project. If tomorrow he doesn't respond , then tell me and i'll work on it.

  20. #60
    Member
    Join Date
    Jul 2012
    Posts
    52
    I was really hoping to have this ready to go by end of day. If it's just a matter of the fast forward and rewind buttons, maybe you can post the .fla and I can take a crack at it? The buttons need to be lined up anyway, so that would be something I can do in the meantime.

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