Buttons in AS3??????

I used to use a script like this in a frame on the timeline
to add functionality to my buttons.
btn_01.onRelease = function(){
_root.targ_Main.loadMovie("oranythingelseineededthebuttontodo");
Now in AS3 I have no clue!!!!!!!!!!
And apparently you have to be some sort of uber programmer
just to read the documentation. Can anyone tell me how to make a
simple button work?

leodsmith,
> Now in AS3 I have no clue!!!!!!!!!!
Yes, things have changed, but keep in mind, you don't *have*
to use AS3.
Your publish settings (File > Publish Settings) let you
configure any FLA
for ActionScript 3.0, 2.0, 1.0, and even older versions
(precursors, really)
of the language.
> And apparently you have to be some sort of uber
> programmer just to read the documentation.
I realize it can feel that way, but there's a trick to
figuring out the
documentation, and it call comes down to something called
classes. In a
nutshell, classes are like recipes, or blueprints, for the
objects you now
and use every day in Flash. If you're using a button symbol,
you're
actually dealing with a button object; that is, an instance
of the Button
class in AS2 or the SimpleButton class in AS3. If you're
using a movie
clip, you're dealing with an instance of the MovieClip class,
regardless of
the version of AS. Text fields are defined by the TextField
class. Sounds
are defined by the Sound class, and so on.
ActionScript 3.0 has a larger API (more classes) than
previous versions,
but it's structured the same way. For example, AS3 provides a
set of
companion classes for audio: Sound, SoundChannel,
SoundTransform, and
SoundMixer. AS2 only provides a Sound class. On the face of
it, that may
seem easier because it's less to deal with ... but every coin
has two sides.
In AS2, the concept of a sound channel is present (this is
the thing that
lets you differentiate between different "sound banks"), but
there is no
SoundChannel class. Instead, AS2 associates Sound instances
with a
particular timeline (that is, with a movie clip) ... so even
if AS2 is more
familiar, it isn't always as intuitive as it should be.
Okay, back to classes. So classes define objects, and as a
general
rule, classes are categorized into three headers: Properties,
Methods, and
Events. Sometimes you'll see a few more, but those three are
the main ones.
Properties refer to an object's characteristics (width,
height, number of
letters, volume, etc.). Methods refer to things the object
can do
(gotoAndPlay(), setTextFormat(), attachAudio(), etc.).
Finally, events
refer to things the object can react to (mouse ups, the end
of an audio
file, the passing of a timeline frame, and so on.)
So if you're looking up something about buttons, try the
SimpleButton
class in AS3, or the Button class in AS2 (usually, the class
names are the
same for both versions; this happens to be an oddball). Look
up events, to
see what sort of "can react to" opportunities exist for
buttons, then check
out the sample code. Granted, that may be easier said than
done -- new
stuff is always bewildering until you get familiar with it --
but I hope
that at least helps you get your bearings. Be aware that most
classes
inherit functionality from each other (just like genetics in
humans), so
when you see hyperlinks in the documentatoin for showing
inherited
properties, methods, or events, be sure to click them!
In this case, as NedWebs correctly pointed out, you're going
to use the
addEventListener() method to associate a particular
MouseEvent with a custom
function. In principle, this is the same way it happens in
AS2 (unless
you're attaching code directly, which AS3 doesn't support).
AS2:
btn_01.onRelease = function() {
// something to do
Here, you're using an anonymous function (meaning, the
function isn't
named). You could also do this:
btn_01.onRelease = clickHandler;
function clickHandler() {
// something to do
... which, on a certain level, is pretty much the same thing.
Giving your
function a name is arguably better, becuase if you ever need
to kill that
event handler, you can set it to null:
btn_01.onRelease = null;
... and then, if you ever need to re-enstate that event
handler, you can
simply re-associate it with the same previously named (and
already declared)
function:
btn_01.onRelease = clickHandler;
So in AS3, you're doing the same thing:
btn_01.addEventListener(
MouseEvent.CLICK,
function(evt:MouseEvent) {
// something to do
... or, for more control, use a named function:
btn_01.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(evt:MouseEvent) {
// something to do
See the similarities? In AS3, the event actually sends
itself to the
receiving function, which is where there's a parameter inside
the function
(I used "evt", but you can use whatever variable name makes
sense for you).
This parameter is typed as an instance of the MouseEvent
class because, as
you can imagine, it's an instance of the MouseEvent class.
Like any other
class, MouseEvent has properties (listed in the MouseEvent
class), and one
of those properties lets you refer back to the object that
dispatched the
event in the first place.
It's all in there; you just have to dig a bit and see what
your options
are.
Here are some links that might give you a hand:
Colin Moock
http://www.insideria.com/2008/01/actionscript-30-is-it-hard-or.html
http://www.insideria.com/2008/07/the-charges-against-actionscri.html
One of my blog entries ...
http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3
(written for Flash CS3, but it's about AS3, so it still
applies)
Obviously, these Web references are free, but you might also
get
something out of an AS2-to-AS3 migration book I recently
co-authored for
O'Reilly:
The ActionScript 3.0 Quick Reference Guide
http://tinyurl.com/2s28a5
(only two Amazon reviews so far, but they're both 5 out of
5)
David Stiller
Co-author, Foundation Flash CS4 for Designers
http://tinyurl.com/5j55cv
"Luck is the residue of good design."

Similar Messages

  • Referencing buttons in AS3

    I am trying to figure out a way to reference a specific button out of a large group of buttons in AS3. I’ll explain. Let’s say, for instance, I have a lot of buttons on the stage (let’s say 100.) Each of these buttons causes something to happen. Instead of creating an event listener and a function for all 100 buttons, I want to do it more dynamically. I want to have some kind of variable which will equal the instance name of whatever button was pressed, and then an event listener that will check that variable’s value, and, depending on what it is equal to, it will issue a command. Any ideas on how to reference a button in that way? Thanks in advance.

    import fl.controls.Button;
    var buttons:Array = new Array();
    for(var i:uint = 0; i < 10; i++) {
    buttons[i] = new Button();
    buttons[i].move(0, i * 22);
    buttons[i].label = 'hi ' + i;
    buttons[i].addEventListener(MouseEvent.CLICK, onClick);
    addChild(buttons[i]);
    function onClick(event:MouseEvent):void {
    trace(event.target.label);

  • Play/Pause Button in AS3

    I have search the internet, but I cannot find a simple way to
    create a play/pause button in AS3. All the solutions I find are for
    older versions when buttons could have actionscript directly
    applied to them.
    I created a flash animation and exported it as a .swf to work
    with only one layer in a new .fla file. I have three layers
    created, button, video, and actionscript. What I need is a button
    that will look like a pause button when the animation is playing
    and to pause the animation when clicked. It would be nice if it
    could also switch to a play button when paused.

    I made a movieclip (ppBtn) with 2 frames. The first has the
    pause button and the frame label 'pause'. The second frame has the
    play button, 'play'. I placed your script into the action layer.
    When I preview the animation, the buttons just alternate really
    fast and have no fuction.

  • Back button in AS3

    I did a search on this and didn't find a successful answer
    yet. I need to have a back button in AS3 that'll remember the last
    frame visited from any frame in the site. There are various buttons
    to get to various frames, and the one back button will always be
    showing.
    What's the script to make that happen from any frame
    utilizing AS3?

    OK, syntax was wrong and I fixed that (I knew it had to be
    some silly error like that).
    So now, if I go to one of the pages (frames), then go back to
    the home page (home frame), and click the back button it works to
    take you back to whatever subpage you were just on. However, it
    only works from the home page to go back to a subpage. You can't
    use the back button to go from one subpage to another you were just
    on, or back to the home page again. Why would that be? Is there a
    way to make the back button work from anywhere?
    Also, it only works if I don't assign the home page a
    backvalue (probably why you can't go "back" to the home page). But,
    since it works to go back from there to any other page you were
    just on, I think it must be close to working across the
    board… just curious what the problem could be…
    help??

  • Play Again button w/ AS3

    how would I code a play again button using AS3 since you
    cannot place the code on the button itself anymore. Would the code
    still be gotoAndPlay(1);?
    would I need to give the button an instance name and what
    would I need to change the code to?
    thanks in advance!

    DPSwebmaster,
    > I have given my button an instance name of 'PlayAgain'
    and
    > placed the AS code on frame 1 of my timeline.
    As long as that button (with the instance name PlayAgain)
    appears in
    frame 1 as well, you should be good.
    > PlayAgain.addEventListener(
    > MouseEvent.MOUSE_UP,
    > function(evt:MouseEvent):void {
    > gotoAndPlay(1);
    > }
    >
    There should be a closing parenthesis on that [... this one:
    which is basically the other half of the "sandwich" that
    begins with
    addEventListener( ...]. But other than that, your code looks
    fine. Be
    advised that you can also use a named function, if you like:
    PlayAgain.addEventListener(MouseEvent.MOUSE_UP,
    mouseHandler);
    function mouseHandler(evt:MouseEvent):void {
    gotoAndPlay(1);
    Do you see how those are effectively the same thing? The
    addEventListener() method accepts two parameters: a) an event
    to listen for
    and b) a function to perform. In the examples I've shown, one
    of them
    illustrates an anonymous function; the other illustrates a
    named function.
    In any event, to make sure your code is responding at all,
    it may help
    to use a trace() function. This is nothing more than a
    mechanism to print
    text to the Output panel, but it's great for debugging:
    PlayAgain.addEventListener(
    MouseEvent.MOUSE_UP,
    function(evt:MouseEvent):void {
    gotoAndPlay(1);
    trace("I've been clicked!");
    Try that revision (only one line has changed), and when you
    click on the
    button, you should see the message "I've been clicked!" in
    your Output
    panel. If you don't, we'll know that this event listener
    isn't getting
    assigned properly.
    David Stiller
    Co-author, ActionScript 3.0 Quick Reference Guide
    http://tinyurl.com/2s28a5
    "Luck is the residue of good design."

  • Overlapping buttons cs3/as3

    I've been able to avoid this issue by avoiding overlaps or breaking the top layer down to a bitmap but in this particular design I need to have overlapping buttons. 
    Previously if I had an MC overlap a button (cs3/as3) the button wouldn't work so in this design I made sure the hit areas weren't overlapping and the buttons do indeed work.
    Problem is when you click them, most of the time, there will be what looks like a single frame blink.  In recording the issue the blink is the exact size of the full button being pressed.
    http://villagegreenstudios.com/view5/
    All of the buttons do it, Home, Bio, Demo, Contact.  If it doesn't do it at first, keep clicking and they will.
    Can anyone help with this issue specifically and/or the issue at large?
    Thanks.

    Hey Ned.  Thanks.  Here's a screen grab:

  • Help with buttons in AS3

    Hi Folks,
    I'm stuck with a simple flash movie I need to create in which two images fade in and fade out, and each of them must be clickable and hyperlink to a separate URL.
    I've got the fading going okay, but I cannot for the life of me get even a single button to work on it.
    If it's helpful I can send along what I've got so far.  Any assistance would be greatly appreciated.
    Regards,
    Andrew.

    Hi Ned,
    Thank you for the followup email.
    I think I was close - I was aware of the changes between AS2 and AS3, but I
    think I was putting the Action in the wrong place.
    Next question - if I have 2 buttons (say btn1 and btn2), how do I make btn1
    available for say frames 1-60, and btn2 available from frames 61-120?
    I am primarily a ColdFusion developer, and a complete newbie to flash, so
    sorry if this is a dumb question.
    Regards,
    Andrew.
    2009/5/15 Ned Murphy <[email protected]>
    In AS3, to make a button work with code, you need to add an event listener
    for it.  In the timeline that holds that button, in a separate actions layer
    that you create, in a frame numbered the same as where that button exists,
    you would add the event listener:
    >
    btn1.addEventListener(MouseEvent.CLICK, btn1Click);
    >
    Descriptively, that line of code contains the following:
    >
    buttonInstanceName . displayObjectMethod (eventClass . eventType,
    eventHandlerFunction);
    >
    The name of the function for processing the clicking of that button was
    already defined at the end of the event listener assignment, so now you just
    have to write that function out:
    >
    function btn1Click(evt:MouseEvent):void {
       var /String = "http://www.awebsite.com/awebpage.html";
       var req:URLRequest = new URLRequest(url);
       navigateToURL(req);
    >

  • Buttons in AS3.0... is there an easier way?

    I am wondering if there is an easier way to create buttons in
    3.0... I want to make an e-publication in 3.0 but am finding most
    of the actions easier to do in 2.0. Should I generally use a
    combination of these AS versions or am I missing something with
    this endless array of 3.0 options? I am having troubles adapting to
    the whole applying an action to a frame rather than button thing...
    I have downloaded all the terminology from Adobe so that I can get
    better adjusted, but it's always nice to read feedback from a real
    person explaining a few simple things to me... links or comments
    much much much appreciated!!!

    cdbsoccer63,
    vvirgill's answer is good, because it shows how easy AS3
    buttons can be.
    In fact, the nice thing about ActionScript 3.0 is that nearly
    all event
    handling is this easy, becuase nearly all of it is performed
    the same way.
    That is ...
    someObject.addEventListener(
    <an event to listen for>,
    <what to do when the event occurs>
    You can put that all on one like, like vvirgill showed, or
    broken over
    several lines, like I just showed with my own example. My
    example isn't
    literal code, so it wouldn't work if you typed that into the
    Actions panel.
    Like vvirgill did, you'd have to replace the <an event to
    listen for> part
    with the name of some event. For buttons, one of them is
    "click", which
    appears in quotes because it's a string (text). Then you'd
    replace the
    <what do do ...> part with the name of some function,
    such as myListener(),
    onClick(), or honestly, whatever name you like. I often use
    clickHandler(),
    but it doesn't matter, so long as the function name makes
    sense to you (a
    descriptive name is usually a good choice, such as
    submitForm() or
    orderPizza()). When you refer to your function as a parameter
    inside the
    addEventListener() method, you leave the parentheses off the
    function,
    because it's the parentheses that actually make the function
    do its thing.
    You don't want to trigger the function inside that
    addEventListener()
    method, but rather, in response to whatever event you'r
    listening for.
    So ... how do you know what events are valid for buttons --
    or anything
    else, for that matter? Look up the class entry for the object
    you're
    dealing with. If you're dealing with button symbols, look up
    the
    SimpleButton class. For movie clip symbols, look up the
    MovieClip class.
    For text fields, the TextField class, and so on. Each class
    entry -- in
    this case, in the ActionScript 3.0 Language and Components
    Reference (F1
    key) -- generally has three categories: Properties
    (characteristics of the
    object), Methods (things the object can do), and Events
    (things the object
    can react to). You'll find relevant events under the Events
    heading, as you
    can imagine. Many classes inherit frunctionality from other
    classes, so
    always make sure to click the hyperlink that says "Show
    Inherited
    Properties/Methods/Events" near each heading.
    The documentation will show you things a bit differently
    than vvirgill
    showed. Instead of "click", for example, you'll find sample
    code that shows
    you MouseEvent.CLICK. Don't be thrown by that. All that means
    is that the
    "click" string is stored as a constant (an unchanging
    variable) of the
    MouseEvent class. You can reference that string by referring
    to the
    contstant, like this:
    myButton.addEventListener(
    MouseEvent.CLICK,
    clickHandler
    According to best practices, you should do it like that
    (it's the more
    "proper" way to go about it), but in the end, all that
    contsant does is
    point to the string "click", so they ultimately mean the same
    thing.
    Nearly every time, if an object has an event, you'll be able
    to wire up
    an event listener the same way youv'e seen now in this
    thread. The only
    exceptions I can think of are related to video (cue points
    and status
    messages, I think) -- but for everything else ...
    myObject.addEventListener(someEvent, someHandler);
    ... and then, of course, you have to write out that what
    "someHandler" is.
    As vvirgill demonstrated, that's easy to. You need a function
    declaration,
    and then the code you want performed, and that's really all
    there is to it.
    You do have to write the function to accept one parameter:
    function myFunction(param:Event):void {
    ... which I called param in that snippet (vvirgill called it
    e). That
    parameter gives you optional access to the event itself, and
    the *type* of
    parameter it is depends on the type of event that triggers
    the function.
    Strictly speaking, the MouseEvent.CLICK event is an instance
    of the
    MouseEvent class (just like button symbols are instances of
    the SimpleCutton
    class, movie clips are instances of the MovieClip class, and
    so on). So
    ideally, that parameter should be typed as MouseEvent rather
    than Event:
    function myFunction(param:MouseEvent):void {
    ... but only when the function is triggered in reponse to a
    mouse click
    (that is, a MouseEvent). Makes sense, right? The reason
    vvirgill's example
    isn't wrong is because the MouseEvent class inherits some of
    its
    functionality from the Event class, so mouse event objects
    actually *are*
    event objects -- the identification as such is true -- but if
    you're
    adhering to Adobe recommendations, you'll type your
    parameters (and all
    variables) specifically.
    David Stiller
    Co-author, Foundation Flash CS4 for Designers
    http://tinyurl.com/5j55cv
    "Luck is the residue of good design."

  • How to check Buttons in AS3

    What is the AS3 equivalent of this AS2 code? I don't want to
    have to type this for every MC or button (especially if there are
    many):
    Button.prototype.buttonMode = true;

    I apologize again. If I had read my own code carefully, TRUE
    should be FALSE.
    I want to toggle all buttons using this. I got it. Thanks. No
    problem. Cool.

  • Loading movie clip to stage with button click AS3

    I'm trying to figure out how to load a movie clip to the stage with a button click and have the movieclip close again using a close button. Does anyone have a step by step on how to do this or links to some tutorials.
    Below is an example of what I'm trying to do.

    Alrighty I changed the publish settings to as3. I'm still getting two errors:
    Scene 1
    1046: Type was not found or was not a compile-time constant: Popup1Btn.
    Scene 1, Layer 'as', Frame 1, Line 3
    1061: Call to a possibly undefined method addEventListener through a reference with static type Class.
    So my setup on my main timeline is I have an actionscript layer with this code now:
    var popup1:Popup1
    Popup1Btn.addEventListener(MouseEvent.CLICK,addF);
    ClosePopup1.addEventListener(MouseEvent.CLICK,closeF);
    function addF(e:MouseEvent):void{
    popup1=new Popup1();
    addChild(popup1);
    function closeF(e:MouseEvent):void{
    removeChild(popup1);
    popup1=null;
    On the stage I have a button with the isntance/AS linkage name Popup1Btn. Inside my Popup1 MC I have a box with text and then a button with the instance/linkage name ClosePopup1 to close the popup.
    What am I missing?

  • Help converting AS2 rollover buttons to AS3

    This is probably a really dumb question, but I'm very new to AS3 so please bear with me. I created some rollover buttons (movieclips) for a flash website in AS2 using the following code:
    onClipEvent (enterFrame) {
        this.onRollOver = function() {
        this.gotoAndPlay(1);
    onClipEvent (enterFrame) {
        this.onRollOut = function() {
        this.gotoAndStop(1);
    on (release){
        getURL("index.html", "_parent");
    Could anyone advise me on how to start converting this code into AS3? I know I have to use an EventListener but I don't really understand how it works.
    Any assistance would be greatly appreciated!

    I have changed my code to:
    Link1.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
    Link1.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
    Link1.addEventListener(MouseEvent.CLICK, onClick);
    function onMouseOver(e:MouseEvent):void {
            Link1.gotoAndPlay(1);
    function onMouseOut(e:MouseEvent):void {
              Link1.gotoAndStop(1);
    function onClick(e:MouseEvent):void {
            Link1.navigateToURL(new URLRequest("index.html"), "_parent");
    But it still doesn't work very well. The animation for the rollover keeps playing over and over, ignoring the "stop" I have within the frame of the movieclip.
    You can view my website at: http://www.halopantryandgrill.com/test/index.php to get an idea of how my rollovers worked before. This was done in AS2.
    I can't seem to get the same effect to work in AS3

  • Simple button in AS3

    hello everybody,
    in my website I have a simple button that should trigger at
    every click a different frame. Browsing the net I have found the AS
    for the simple button (attached code) that works for a sigle click.
    Would please tell me the AS to give to the button the
    function described above??
    thank you so much

    My line would replace the gotoAndStop(2) that you had in your
    previous code. But I'm not sure that it is what you want. The code
    I gave you will tell the thing you clicked on to go to frame 2 and
    only to frame two.
    I think you are trying to do something different that what I
    thought. I think what you want instead of your gotoAndStop() line
    you just want
    nextFrame();
    Of course you might want to do something special when you get
    to the last frame so you might want to add something like:
    if(currentFrame==totalFrames){
    next.removeEventListener(MouseEvent.CLICK, release);
    next.alpha=.5;
    That would go just after the nextFrame(). That checks to see
    if the current frame is the last one and if so removes the click
    handler from the next button and makes it transparent so it looks
    disabled. (That could be done in a lot of fancier ways, but this
    was just to give you the idea.)
    Does that help?

  • NEED HELP WITH BUTTONS IN AS3!!

    Hello, I am stumped with an action scripting problem. I'm
    trying to create a really basic website in flash using buttons to
    jump from scene to scene. Let's say I want to do something as
    simple as make scene 1 jump to scene two right? I'll place in my
    scene 2 button on my first page:
    But instead of the scene changing to the next scene after I
    press the button, these errors come up!!
    1180: Call to a possibly undefined method on.
    1120: Access of undefined property release.
    1120: Access of undefined property _root.
    I've tried asking in so many different forums, I usually do
    pretty good with action scripting for buttons. But this is my first
    time doing it with cs3. I'm utterly confused, someone please help!!
    Thank you.
    The code on this page is the code I was using to try to
    change scenes...Oh! and whenever I try to put a code in the actual
    button, it won't let me. I just get a message that says something
    like "Can't have any actions applied to it".

    foxxpop,
    > But instead of the scene changing to the next scene
    > after I press the button, these errors come up!!
    >
    > 1180: Call to a possibly undefined method on.
    > 1120: Access of undefined property release.
    > 1120: Access of undefined property _root.
    You're using three terms that aren't supported in
    ActionScript 3.0: the
    on() function, the release parameter to that function, and
    _root. In
    ActionScript 3.0, you'll have to give your button an instance
    name and wire
    it up like this:
    http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3
    In that blog entry, you'll see (with explanation) something
    that looks
    like this:
    myButton.addEventListener(
    MouseEvent.CLICK,
    function(evt:MouseEvent):void {
    trace("I've been clicked!");
    Just bear in mind that you can also make that a named
    function, like
    this:
    myButton.addEventListener(MouseEvent.CLICK, clickHandler);
    function clickHandler(evt:MouseEvent):void {
    trace("I've been clicked!");
    > I've tried asking in so many different forums, I usually
    do
    > pretty good with action scripting for buttons. But this
    is
    > my first time doing it with cs3.
    Your issue isn't Flash CS3, it's that your FLA file is
    configured for
    ActionScript 3.0. If you change that to AS2, you can go right
    on using the
    same approach you used to -- and you'll be able to attach
    code directly to
    objects. ;)
    David Stiller
    Co-author, The ActionScript 3.0 Quick Reference Guide
    http://tinyurl.com/2s28a5
    "Luck is the residue of good design."

  • How do I create a button in AS3?

    Hello Everyone
    How do I create a button in action script 3 and handle the click event?
    Thanks

    Maybe this will help you get started.
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.display.Graphics;
    var button:Sprite = new Sprite();  //Sprite to act as the button graphic.
    //Set the color of the button graphic
    button.graphics.beginFill(0xFFCC00);
    //Set the X,Y, Width, and Height of the button graphic
    button.graphics.drawRect(10, 10, 200, 60);
    button.graphics.endFill(); //Apply the fill
    this.addChild(button);  //Add Button Sprite to stage
    button.useHandCursor = true;
    button.buttonMode = true;
    button.mouseChildren = false;
    button.addEventListener(MouseEvent.CLICK, buttonClickHandler);
    function buttonClickHandler(event:MouseEvent):void
               trace("Button clicked!");

  • Help with buttons and AS3

    I need urgent help for a college project, I've drawn a map and I have some photographs that appear on the map from the timeline one after another. I want the timeline to be activated when I press a Button On the map of where I've been on holiday but I have no Idea how to put it together.

    While I can offer a couple ideas, you'll need to spend some time figuring out how to use Flash... maybe get some formal training with it.
    For the photographs, create each set of them as a movieclip, and give each movieclip an instance name so that you can control its visibility using code.  Initially you will want to set the visible property of them all to false, likely done in the first frame of the timeline (ex: imageGrp1.visible = false; ).  Then you will use your buttons to make them visible.
    To code one of the buttons, you need to assign it an instance name as well.  Then you need to assign an event listener for that button to detect when it gets clicked, and an event handler function to go with the event listener... the listener calls the function into action when the event occurs.
    ex:
    // the event listener for a button with an instance name of imgGrp1Button...
    imgGrp1Button.addEventListener(MouseEvent.CLICK, showGrp1);
    // and the event handler function for the CLICK listener
    function showGrp1(evt:MouseEvent):void {
          imageGrp1.visible = true;
    If you want to hide any visible set when you select a new one, then you can create a function that sets them all visible = false and call that function both at the start in frame 1 and in each button event handler function (before you set the selected set to be visible).

Maybe you are looking for