7 Replies Latest reply on Nov 21, 2006 2:15 PM by xcoldnet

    swaping images for buttons

    xcoldnet Level 1
      what is the action script code, and what else is needed, to make my buttons change color (indeed image) on rollover?

      I have got this from the manual:

      366ActionScript classesonRollOut (Button.onRollOut handler)onRollOut = function() {}Invoked when the pointer moves outside a button area. You must define a function that executes when the event handler is invoked.Availability: ActionScript 1.0; Flash Player 6ExampleIn the following example, a function that sends a trace() statement to the Output panel is defined for the onRollOut handler: my_btn.onRollOut = function () {trace ("onRollOut called");};onRollOver (Button.onRollOver handler)onRollOver = function() {}Invoked when the pointer moves over a button area. You must define a function that executes when the event handler is invoked.Availability: ActionScript 1.0; Flash Player 6ExampleIn the following example, a function that sends a trace() statement to the Output panel is defined for the onRollOver handler: my_btn.onRollOver = function () {trace ("onRollOver called");};

      how do I hanlde the trace() statement??

      Thanks,

      Dario
        • 1. Re: swaping images for buttons
          Marghoob Suleman Level 1
          what do you want man?
          • 2. Re: swaping images for buttons
            2m Level 2
            Don't get me wrong for starting that at an unexpected angel, but how can it be, that you are a senior Member here with over 200 posts, and not know that ?

            I don't want to make fun of you, I'm just not sure how to answer your question, as normally I'd guess that you are a very beginner, and start explaining things you from the very beginning, but maybe I just misunderstood your question?
            • 3. Re: swaping images for buttons
              clbeech Level 3
              hhrummf, hhrummf ... I agree.

              However it will depend on if your using a button or a MC for your button, and are you trying to change the image of the button, or a different image on the stage.

              Trace statements are for Debuging purposes, and print to the output panel in Flash, you can use them to check for code progression and function.

              If your using a button symbol then you don't really need any code to change the images of the button, just modify the frames comprising the button in Edit mode.

              But again, not exactly sure what it is that your asking. Can you tell us more about what it is that your trying to do?
              • 4. Re: swaping images for buttons
                xcoldnet Level 1
                Thanks to all of you for your replies.... :) I agree with you 200 posts and not nothing the basic of Flash! but the 200 post were made mainly on the Dreamweaver forum, not on Flash.

                anyway, what I want to achieve is the classic effect to have a buttun changing its color on rollOver. For the time being I used one of your suggestion, to simply point to another frame which is equal to the precedent less teh buttun which is another image. the effect is perfect, it looks like I have a fully functional menu, but the side effect is that my .swf file if getting havy in this way.

                there is any better way to achieve swaping images in the menu buttns (on rollOver and on rollOut) without building up kb? Thanks.

                Dario
                • 5. Re: swaping images for buttons
                  2m Level 2
                  Hi Dario,
                  what to do best in your case largely depends on the design of you buttons.If a "tint" would do, you could use this, by making your image a movieClip and tint it in the second frame thus saving size, a multilayer version could be more flexible. If you could show us your design we could be of more help I guess.
                  • 6. Re: swaping images for buttons
                    clbeech Level 3
                    Also, if the buttons are bitmap images as opposed to vector drawing objects or text created in Flash, the bitmaps will use a lot more memory.

                    In Dreamweaver, one uses the replace image onRollover method to achieve this type of change, but Flash operates differently, so unless the image that your using is a picture, you can most likely re-create the button using Flash drawing tools and text, directly on the Stage.

                    You can also use ActionScript to change the look of a Button, use an MovieClip as a Button, use the color controls(tint, brightness or alpha as mentioned above), use Flash filters, use the Tweens and Transitions classes to animate it, or use a variety of other advanced methods, and combinations of any of these!

                    Agreeing with 2m, if you could post a simple example file online, we could be of more assistance.
                    • 7. Re: swaping images for buttons
                      xcoldnet Level 1
                      sorted, all i had to do is to double click on the button and the four state of the button appear. create key frame for the down state, change the color of the down state and that is all! and the size of the .swf file stay at its best. thanks to all.

                      Dario