Noob help: Triggering Movie Clips with Buttons

Hi guys,
I'm taking an intro Flash and Action Script class and for my final I need to create a portfolio project that contains 5 unique buttons that trigger 5 unique movie clips. I'm having a hard time with this. I've been able to trigger the 1st movie clip with the first button (although I can't stop it) but I can't trigger any ohter movies with any other buttons.
Here's my code:
stop();
chuck1_btn.addEventListener(MouseEvent.CLICK, playMovie);
function playMovie(event:MouseEvent):void
    spaceship_mc.play();
chuck2_btn.addEventListener(MouseEvent.CLICK,playSaucers);
function playSaucers(event:MouseEvent):void
    saucers_mc.play();
Nothing happens when I click on chuck2_btn when I test the movie. I think I need to create a variable or class but I'm not sure. I'm a super noob with this stuff. Any thoughts? Thanks!
Rick

You should learn how to use the Help documentation to find answers like how to use the visible property.  For the code you showed earlier, here's what you can try in frame 1 to replace it.
stop();
spaceship_mc.visible = false;
saucers_mc.visible = false;
slideshow_mc.visible = false;
chuck1_btn.addEventListener(MouseEvent.CLICK, playMovie);
function playMovie(event:MouseEvent):void
     spaceship_mc.visible = true;
     saucers_mc.visible = false;
     slideshow_mc.visible = false;
    spaceship_mc.play();
chuck2_btn.addEventListener(MouseEvent.CLICK,playSaucers);
function playSaucers(event:MouseEvent):void
     spaceship_mc.visible = false;
     saucers_mc.visible = true;
     slideshow_mc.visible = false;
    saucers_mc.play();
etc...
It could be refined, like having a function that hides everything and using that every time before making the one you need to show visible.  You might find it necessary to include telling the movies to gotoAndStop(1) as well.
That's about as generous as I'm going to get.  It's important that you learn things, and handing you a solution isn't going to help do that.

Similar Messages

  • Changing depths of movie clips with button clicks

    Hello all,
    I've got a file on working on that has 4 different movie clips on one layer that, when clicked, will zoom in (made with tweens in the timeline).
    The issue I'm having, is that when I click one of them, they are arranged in a way that won't work for what I need. I click one, and it works, but it is hidden by the movie clip that is on top of it in the heirarchy. Click another, zooms in, but is partially hidden by another one.
    My question is: Is there anyway in AS2 to code these so that when one is clicked, it will the top spot in the heriarchy? So that I can code them all like this so that whenever one is clicked, it goes to the top so it is not hidden?
    Thanks

    Correct me if I'm wrong, but isn't that just used to swap 2 movie clips?
    Or is there a number I can input instead of the movie clip name that will change all of them?

  • Menu made in movie clip - with sub-section we can click on to go to another frame

    I would like some help about that:
    I want to do a menu made all in movie clip (NO button). In
    this menu, when we click on one of the part (sub-section) of the
    button (which is a mc), we must go to another frame in the main
    scene.
    It is working for the roll-over and mousedown for my button
    (with the _up, _over and _down labels). But it's not working then
    to put, i don't know, another movie clip inside with alpha 0 to
    make another onRelease and then gotoAndStop(20); ...
    Here is the code I have in the main scene (first frame):
    stop();
    mon_clip_mc.onRelease = function() {
    //this._root.gotoAndStop(20);
    And here is the code I have in the first frame of the movie
    clip of the button:
    stop();
    I'd really appreciate some help! Thanx

    lalapinerouge,
    as far as I can see with your method for buttons, is that it
    only reads 1 button inside mon_clip_mc..
    I cant figure out why, i've tested it over, made new fla's
    with your method, and i still cant get it to work, nor do I
    understand why..
    I need to study abit more.
    Maybe someone in the Forum will have a look at this topic,
    and know what's going on with your method.
    In the mean time, heres a submenu I made for a site a while
    ago. This doesnt use timeline actionscript, ( because i was a
    newbie then ) =)
    if you have a look through the whole FLA, ( it's quite abit)
    you can get an Idea of how i do my movie clip buttons, till this
    day, i still use the same method, only i use mainly timeline
    actionscript..
    the main point to notice is that EVERY button ( even submenu
    ) is it's own movieclip...no button in there holds multiple sub
    buttons inside... This gives you complete control of each button,
    and endless possibilities for animation, tweens, and anything extra
    you would want to add to a button.
    Sorry I couldnt help you figure out your problem fully. Im
    still going to mess around with it abit more to see if i can figure
    it out..
    Hope you can addopt some useful info from this FLA.
    HERE

  • Movie Clips as buttons – ignoring my stop actions and event listeners

    Ok, so I think I am hear with the proper linked files to show you guys! Pretty much learning everything, so forgive my ignorance thus far!
    Anyway, I am just trying to figure out movie clips as buttons, and have been following along on Lynda.com – however, I seem to be doing these things right, but when i test my movie, the button just loops regardless of rollovers or stop actions.
    You can check this address www.midnyc.com to see the failed anim, and you should be able to import it as well. Here is my coding:
    function rollover (e:EVENT){
        myBtn.gotoAndPlay ("in");
    myBtn.addEventListener (MouseEvent.MOUSE_OVER, rollover);
    function rollout (e:EVENT){
        myBtn.gotoAndPlay ("out");
    myBtn.addEventListener (MouseEvent.MOUSE_OUT, rollout);
    thank you in advance for your help. And to KGLAD, thanks for recommending how to post a bit better! Since I never had links etc... sorry about that.

    Do you get any kind of error messages?  Normally if there's a coding error, movieclips and other things go haywire.
    For you event handler functions, try specifying the event that matches the listener event...
    function rollout (e:MouseEvent){
    I think "EVENT" would be wrong anyways... "Event" would be correct

  • Movie clips as buttons

    Hi all having a bit of difficulty with a project,
    Iam using movie clips as buttons, the only function they
    perform is loading in external swf files into a blank movie clip.
    The script I have used for this is as follows:
    on (release) {
    loadMovie("folio.swf", "_level0.holder");

    Hi joakimpilo, im not to sure im following your question
    correctly but here goes...
    I am assuming b1, b2, b3 and b4 are your MC buttons and you
    want these to load in information.
    This is what I do for similar situations,
    on your main timeline have an MC named holder that you will
    load external swf files into when you click a certain button. It is
    important that you take a note of the size so you can create the
    external swf at the same size, so when they load in they fit
    correctly.
    then in the buttonMC have a top layer that contains a simple
    box that covers the entire area of the MC. this kind of acts as a
    hit area so if you have animated the MC for a roll over effect make
    sure the button covers the area you need. I then apply the script
    to this button as follows (still in the buttonMC, not on main
    timeline)
    on (release) {
    loadMovie("yourexternalmovie.swf", "_level0.holder");
    "yourexternalmovie.swf" is the name of the external movie
    holding the informatiion you want loaded in to the "holder" MC.
    This is created in an entirely different flash document. Make sure
    and remember the name of these external files and just apply to
    each button.
    It is also very important to keep all the swf files in the
    same folder as the main flash file so it can see them to import.
    Hope that makes some sort of sense, and is actually what your
    looking for.

  • Moving movie clips with ActionScript

    I am trying to move four movie clips with actionscript in a
    circler motion with two buttons, one to rotate the mc’s to
    the left and one button to rotate the mc’s to the right. Here
    is a link to what I am trying to do;
    http://www.us.playstation.com/Lair/
    and it is undrer game features.

    Yes, that's what the code I gave you is intended to do....
    you replace that code with whatever action you need to take to turn
    your movie around.
    I have no idea what your movieclip is doing, but I'm guessing
    by your response that if it was an arrow pointing left to right
    (just an example), you want it to be pointing right to left when
    the left arrow is pressed. If you want an immediate turn around,
    then the simplest way to do that is to have another frame
    containing the movieclip that it moves to where it faces the other
    direction--and to have it appear turned around, from the toolbar
    you select Modify -> Transform -> Flip Horizontal.
    So the movieclip would live inside another movieclip that has
    two frames with stop()'s for each frame. In the first frame you
    would have the subclip facing left to right, and in the second you
    would have it facing right to left. If we call that 2-framed
    movieclip "walker", the code I provided before would
    become...

  • Exporting a move clip with alpha channel

    Hi there,
    I’m trying to export a move clips with alpha channel.
    I’m trying to export an animation with Premiere CS5. I made an animation of a rotating object in Maya and exported it with alpha channel as tiff images. Then they are edited with Photoshop to give them a drop shadow.
    My problem is this. Can I export this tiff animation with the alpha channel?
    My plane is to use move clips over backgrounds in a game – depending on the result there are different animations playing on top of several different backgrounds. There for the objects has to have a transparent/alpha channel over the backgrounds.
    Again the reason for this is the complexity of the game and to make the game looking as real as possible. I’m hoping for some help here to make my plan possible
    …thanks

    Thanks alot for the help.
    But now I’m wondering how to get the file size down?
    The 32bit and alpha channel just increase the file size from about 1MB to 9,3MB, which is pretty much??
    …any ides mate?

  • What type of movie clips are handled by the ipad? I have shot a movie clip with my canon camera and the file is .AVI.  will this load onto ipad?

    what type of movie clips are handled by the ipad? I have shot a movie clip with my canon camera and the file is .AVI.  will this load onto ipad?

    Per http://www.apple.com/ipad/specs/
    AirPlay Mirroring to Apple TV (2nd and 3rd generation) at 720p
    AirPlay video streaming to Apple TV (3rd generation) at up to 1080p and Apple TV (2nd generation) at up to 720p
    Video mirroring and video out support: Up to 1080p with Apple Digital AV Adapter or Apple VGA Adapter (adapters sold separately)
    Video out support at 576i and 480i with Apple Composite AV Cable (cable sold separately)
    Video formats supported: H.264 video up to 1080p, 30 frames per second, High Profile level 4.1 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; MPEG-4 video up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps per channel, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio in .avi file format

  • Copying movie clip with flv

    Hi, I am trying to copy a movie clip with an flv in it from
    one project to another. Everything works fine except the flv just
    keeps trying to load and never plays. I am not sure what to do. Any
    suggestions?

    It sounds like you are using the FLVPlayback component to
    display the FLV, in which case, the FLV is a separate file and
    likely needs to be in the folder next to the new project. Go back
    to the old project and copy the FLV from its location there to the
    new projects folder.

  • Check for movie clips with AS?

    Is it possible to check if a frame contain a movie clip with
    AS, and then if movie clip is found run a function? Like a global
    "event handler " for movie clips.

    I want a function that automaticly can detect and fade in any
    movie clip found in any keyframe in the main timeline. So i don't
    have to make
    In the first keyframe in the main timeline
    on (ohh here i found a movie clip)
    //let's run a nice fade function on that movie clip
    mx.transitions.TransitionManager.start
    (eval(TheClip),
    {type:mx.transitions.Fade,
    direction:0,
    duration:1,
    easing:mx.transitions.easing.None.easeNone,
    param1:empty,
    param2:empty
    Something like that

  • Play Movie Clips with AS 2

    I have 3 Buttons
    I have 3 movie Clips
    Each Button Plays A Different Movie Clip.. Thats Where you
    come in !
    Whats the Code for the button

    are the instance names of your buttons: btn1, btn2, btn3
    are the instance names of your movieclips: mc1, mc2, mc3
    They would need to be named so in order for this to work, and
    it will.

  • Just learning...help on movie clip buttons

    I've tried tons of tutorials and i cant seem to get my movie
    clip button to work when i put the mouse over the button.
    i have included a screen shot of my time line and code.
    Layer 10 frame 1 is where all the script is.
    "actions" layer has my "stop" codes in frames 1 and 20
    time
    line and code
    Thanks for your help.

    ok if i change "home" to "this" in my code, do i also have to
    change my instance name for my button layer from "home" to "this"
    as well?
    and how do I cast e.currentTarget as a movie clip?
    sorry this is only my 3rd day playing around with Flash.
    Thanks!

  • Urgent Need of Help Playing Movie Clips

    I'm a complete noob when it comes to AS. I know basic things like stop(); and gotoAndPlay.
    Here's my dilemma.
    Dearest Professor has given us a task of creating a website in Flash. You need to have 15 links, or 15 pages. He states that you can only go frame by frame on the main timeline with no tweening spaces in between. So I'm virtually creating all of my animations in symbols.
    This isnt such a problem... I created a short introduction title video in Flash using a Movie Clip Symbol... placed it on the main timeline on the first page, and then called ActionScript to play the video.
    Here's the problem... So.... the movie will play, but it will continuously loop... I've tried putting stop(); on the home page, under the AS... I'm just completely lost on how to get this to play the short clip and go straight to the home page... Could someone PLEASE, direct me on how to do this and give me an explanation as to why this way is the way it is... I would very much like to understand how it works.
    Thanks
    The Flash Noob

    Thanks Rob!
    I did what you suggested but I think I may have messed it up...
    Here's the output error I have going on right now.
    TypeError: Error #1034: Type Coercion failed: cannot convert flash_website_template2_fla::MainTimeline@7fff0d7aea1 to openingtodogwood.
      at openingtodogwood/frame9()[openingtodogwood::frame9:3]
    In the end of the timeline of the movie clip I put this:
    stop();
    openingtodogwood(parent).play();
    I think that might be wrong but I'm unsure on what I should have really put. I was also reading that having the name of the movie clip the same as the class in the properties panels is not a good idea?
    Thank you so much for your help!

  • How to change the movie clip a button links to???

    I am working on a website in Flash that had already been
    designed by someone else. There are a number of buttons across the
    website that are linked to the same symbol. Those buttons link to
    movie clips, in the button's actions, that pop up as small windows
    providing more information in regards to the button clicked. The
    problem is that I cannot figure out how to properly change the link
    association between button and movie clip.
    Here is the action script for one of the buttons:
    on (release) {
    _root.scrHEIGHT=100
    _root.scroller.scroller.gotoAndStop(2);
    _root.scroller._x = 100;
    _root.scroller._y = 150.7;
    _root.TM_title = "About Chris Smith";
    _root.READ = 3;
    When I change the number after "root.READ =" it will change
    it to another movie clip but I how do I know what that association
    is based on? For instance if I make a duplicate movie clip how can
    I make the above script link to it? Also, what exactly does that
    last line in the above script mean? When I tested various numbers,
    like 3 and 6, they would link to the same movie clip.
    Please help! This is driving me crazy!
    Thanks!!!

    Hi,
    buttons can be defined with static icon/text, or dynamically via a variable (containing @08\Qtooltip@text for example). You choose the pushbutton type when you define your button using the screen painter. For the dynamic definition, you must tick the "output only" checkbox, enter a global variable name, that you'll fill in your program, preferably using ICON_CREATE function module.
    BR
    Sandra

  • Attaching movie clips to buttons

    I would like to design a portfolio site in which I have small
    buttons that, when moused over, they display, a pic just above it.
    Each button triggers a different pic above it.

    The best way to go about doing is is to use the MovieClip
    class instead of the button class. Use the onRollover event. For
    example, have a movie clip that displays the image on the second
    frame. The use the actionscript: nameOfMovieClip.onRollover =
    function():Void {
    this.gotoAndStop(2);
    If you want to use the button class to accomplish the same
    task, then you will have to create an image that you want to
    display then under the "over" frame of the button, place the image.
    If you want the original image to be there and display the new
    image, then just add a new layer and put the image in the new layer
    while keeping to original layer.

Maybe you are looking for

  • Best video format for mac and pc

    Hello, I recently embeded an mpeg video, flv, mp4, and swf video file to my web page. I then asked several pc users to go to my page and see if they could view the animation clips. They were were able to view all clips, but the mpeg and flv clips aut

  • Problem in String Search using OKAPI in 9i Lite

    We are creating an Symbian EPOC application using Oracle 9iLite in stand-alone mode. We have managed to create a C++ program that creates an Oracle database on the Nokia Communicator 9210. The problem is that a string search returns either null or al

  • Connecting my Mac with my iPad mini

    I tried to connect my iPad mini with my mac but it does not work. I googled it but I got no satisfactory result. After connecting the devices a message of error appears in the iPad. Can anyone help me with this?

  • Burn DVD (no video tracks defined)

    I am new to iDVD, and just made my first one using a basic theme placing pictures from iPhoto into the drop zones then adding music from iTunes, it looks great but when I try to burn it I get a drop down sign saying, There are no video tracks defined

  • Re: Store big SQL(15000 char+)  in the database.

    I have 2 very big SQL (almost 15000 char each). I have to store them in 2 saperate columns in a database table. After storing them when ever require, sql will be retrieved and executed to get the values. As varchar2 supports only 4000 chars. What wou