7 Replies Latest reply on Dec 30, 2007 11:44 PM by kglad

    button scripting

    pow_haaweeese Level 1
      here's the code I have on frame 1 of my ActionScript layer. (below)

      please don't laugh...or if your must, at least stop laughing during your reply. >smile.

      I'm trying to accomplish a simple thing, at least I think it should be simple, and have been scouring tutorials and posts for hours..honestly.

      I've a button btn_01. I need this button to:

      a) on RollOver send the playhead to "chinTitle" lable. This is a screen grab of my movie. (code works)
      b) when they rollOut, I send them to "init" the home area if you will of my video section. (code works)
      c) when pressed, button sends to yet another Frame label, "chinMusic" it's there my movie lies in a FLV playback component and does begin to play. (code works...but...)
      //here's where I loose it
      d) if user clicks it (btn_01) to start...all's well...as long as they hold their mouse directly over the btn_01 button and don't rollOut >smile... If they do rollOut, Flash does what I told it to do above, goes to the "home" area of the video section....and as a "bonus" the video also stops.


      So basically, it's the fourth step..how do I get a button to know that they've clicked it (a listener?)...and have the video play all the way thru, or at least play until they select another button or...the video ends. I can't figure it out. It's like I need a "once Pressed" function. I believe I need to "cancel" the functions I've set up...within the gotoAndPlay("chinMusic") function...but I don't know how.

      any help would be appreciated.

      Thank you.

        • 1. Re: button scripting
          kglad Adobe Community Professional & MVP

          • 2. Re: button scripting
            pow_haaweeese Level 1
            hello again kglad,

            and thank you for your code work below. This does what I asked, and let's me at least get functioning.
            I know this is because of how I set this up..with the onPress, onRollOver, onRelease...but here's what's happening. If I'm unable to fix it, I'll leave it to the users to "learn" how it works, but what's happening with the below code is:

            I rollOver btn_01, and my screengrab of tv spot shows up (great)
            I click on btn_01, and the video plays...(great)
            when I rollOut of btn_01, the video still continues to play. (again great, and thank you for this code)

            ...what is something I think will cause problems...and party because of how my buttons are graphically laid out on the scene, but a dynamic text block is near the buttons, and there's a scrollBar on that text....well...when the user clicks on the button to play a chosen video, they then are asked by me, the way it's laid out, to cross over an adjacent button....to get to that scrollBar...and of course...this stops the current video being played, and switches the screen to the rollOver image I've got on the button they just skimed over...to get to a scrollBar. If they're careful, and don't accidentally mouse over a different button...all is well. But I think that's too much to ask from them..that they'll do that.

            Basically...the "live-ness" of the buttons, the fact that after they've played...they're still able to be "hit" could be a problem. I'm not sure there's a fix...i think I different layout...maybe where they're not near the other buttons, but still, I think that's asking alot that they won't accidentally mouse over any other buttons.

            I'm fearing the only way to fix the "non-liveness" of the button so as to fix the above, would make the buttons a one-time hit...to make it so the user must re-fresh, to re-set the buttons so they could watch a video again.

            I'm not sure there's a way to fix this...I think I could re-work graphically how the buttons are laid out...but...not sure if that's completely eliminate this problem, as users are click-happy.

            thanks for anythoughts you've got or if the fla would help...please advise.

            • 3. Re: button scripting
              kglad Adobe Community Professional & MVP
              if a button is pressed, do you want to disable all the buttons until the video completes?
              • 4. Re: button scripting
                pow_haaweeese Level 1
                hi kglad,
                I thought it'd help to post what I'm doing so you could see.


                To get to what I'm working on...scroll down say 1000 pixels on the main homepage...and on the left, there are two small 32x32pxl gray squares. click on the left one and it should take you to my tv section of my website. (should see a projection screen, buttons and scroll text prob are at bottom)

                so now you see my problem. The numbers...say if you select clip # 4...and you try to go back to the dynamic text, you will hit the other buttons which stop the video.

                I have these buttons in the exact place on the print section (not posted) and they all work fine, as I don't have rollOvers...maybe that's what I should do...is lose the rollOver effect. I rather like the way it works...just it's a usabiility thing now.

                ...unless you other others might have an idea that could make those buttons live...and yet have them not interrupt videos being played.

                I do realize that good web design is about usability..and maybe that's what I need to revisit. how it's laid out, my design.

                your thoughts..
                and thanks..


                -an example of how I could to it i guess...a simpler version.

                > move large button to the right to "heat"
                > hit "the work" nav
                > hit "EA"
                > choose TV "1" or "2"
                for example...these have no rollovers and just work as buttons.
                I mean that's simple...
                • 5. Re: button scripting
                  kglad Adobe Community Professional & MVP
                  that's a design issue. noone can tell you how to design your project.

                  you must decide how you want to handle the design and, in particular, the rollovers. if you want to give a preview after a rollover, does the preview have to be in the same location as the display when a button is pressed?

                  if no, then your issue is resolved: you can continue play after a button press and still allow previews.

                  if yes, then you must decide if you want to allow a preview after a buttons is pressed or if you want to disable previews until the button press display is complete before re-enabling previews.
                  • 6. Re: button scripting
                    pow_haaweeese Level 1
                    thanks kglad,
                    appreciate your opinion, and I'll take a look at those options.
                    thanks very much for your time to help me on this, you helped me a lot.
                    • 7. Re: button scripting
                      kglad Adobe Community Professional & MVP
                      you're welcome.