Making a button rollover change a movie clip's frame

Hi again everyone,
I knew how to do this in AS2 but now I am having problems
with making a button on the stage goto a frame in a movie clip on
the stage.
I've attached a sample of my code below, hopefully you'll see
the error and be able to point it out to me?
I have a movie clip on the stage that has different
information in different frames. I want to make it so that when
someone rolls over the button, the movie clip fades in and goes to
the correct frame to display the information.
With this setup the way it is below, I keep getting "Warning:
3590: void used where a Boolean value was expected. The expression
will be type coerced to Boolean.
I know where the problem is happening, "function
XXX(event:MouseEvent):void {navigateToURL(XXXweb)}"
How can I write this differently and eliminate this problem?
Thanks,
Jeremiah

I'll give that a shot, thanks!
A follow up question to that one, is there a way to make it
so that I can have one rolled over function applied to several
buttons / frames in the movie clip? This movie clip has 50+ frames
in it and if I could reduce my coding, it would make life a lot
easier.
Thanks,
Jeremiah

Similar Messages

  • Making Button links within a movie clip

    I am attempting to learn more Flash in general and
    actionscript in particular. I have created a flash piece that
    consists of 4 buttons within a movie clip that is being masked by
    another movie clip. One movie is the set of 4 buttons. The other
    movie is a "spotlight" that moves with the cursor. As the spotlight
    shines on each button, the button's text changes color and is "lit
    up".The Over state of each button is set to cause the button to
    change color. When I put a keyframe in the Down state of each
    button in order to add actionscript to create the action that makes
    the button clickable to take the viewer to a web page, it tells me
    that no actions can be given to this Down state. If I try using
    Behaviors to accomplish the same thing, it tells me that Behaviors
    are not supported. If I put actionscript into the actions layer of
    the timeline, it does not do the required action, i.e. clicking on
    the buttons leads nowhere. I have tried moving the actionscript
    before, between, and after the setInterval and setMasker
    actionscript that controls the interaction between the two movie
    clips (which work perfectly). I have tried inserting an actions
    layer into the button movie clip--same result--nothing. I have
    tried putting the actionscript in the second frame of the actions
    layer (both in the main timeline and in the movie clip), all to no
    avail. I did give each button an instance name and used them in the
    actionscript.
    Here is the actionscript I am using for one of the buttons:
    book.onPress = function(){
    book.getURL("http.//www.bainbridge.wednet.edu");
    I do not get an error message with this actionscript. I just
    don't get sent to the web page. I am using Flash 8.
    What else I should be doing? Is this a problem because the
    cursor is already attached to an action? I am sure that this must
    be possible, if only I knew more.
    Thanks for helping.

    do you have the actual mc identified as ( book ) on the root
    as well as the code i posted above? if so, are the code and the mc
    on the same frame? also you should note that the code posted above
    is meant to be placed on your root time line, not directly on the
    mc identified as ( book ). one more thing: you must target your mc
    ( book ) correctly.
    target like this:
    IF YOU ARE ON THE MAIN TIME LINE ( _root ):
    // if ( book ) is setting on the _root already then your
    target path is simply book.onRelease.
    // if ( book ) is setting inside another movieclip on the
    _root, find out what movieclip ( book )
    // resides in. that will now be the first part of your target
    path.
    // next find out if ( book ) resides in yet another
    movieclip. if so, that will be the next part of
    // your target path.
    // continue this until you reach ( book ). the entire path
    you took to reach ( book ) is your
    // target path.
    // you can also click on the target icon in your actionscript
    pane to insert a target path for
    // your movieclip.
    here is an example in which ( book ) resides inside another
    movie clip ( yourMovieClip ) on your _root:
    yourMovieClip.book.onRelease = function () {
    getURL("
    http://www.cnn.com/");

  • Rollover buttons that play a movie clip.

    Hello,
       I am new to Flash and I am trying to accomplish a simulation such as this example, http://www.its-about-time.com/investinesart/coalplantvirtualtour.swf. I have all of my movie clips done, but how do I tell a rollover button to play a specific movie clip? I also want to have all the movie clips to play simultaneously via a rollover button as shown in the example. I've attached a captured image of my timeline, if that helps. I've tried everything so far, but nothing is working! What is the simplest way of doing this?
    I have this inside one of the movie clips (mc_2) in a seperate layer under - (actions)
    RO_btn.onRollover = function(){
    mc_2.play();
    On the main timeline I have an actions layer with this:
    stop();
    Thinking that this may stop all of my movie clips but it doesn't.
    Should I make an actions layer in each movie clip with this syntax huh? stop();?
    I'm frustrated!!
    Thanks, if you can help!
    MG

    Hi,
    I have made something that you are looking for.
    It will be of help to you.
    basically you will have to create a few movie clips namely:
    2 buttons: (name them a_btn, b_btn, c_btn, d_btn, e_btn)
    3 movie clips (I am taking example image1_mc, image2_mc, image3_mc)
    in each of these movieclips.place 2 frames and on second frame put your movieclip(one in one).on both the frames put stop()
    now click on a_btn and write this script
    on (rollOver) {
    _root.image1_mc.gotoAndPlay(2);
    _root.image2_mc.gotoAndPlay(2);
    _root.image3_mc.gotoAndPlay(2);
    on (rollOut) {
        _root.image1_mc.gotoAndPlay(1);
        _root.image2_mc.gotoAndPlay(1);
        _root.image3_mc.gotoAndPlay(1);
    with this all 3 animations will work simultaneously. if you need to run any one of the movieclips at a time the you can address that mc in particular
    .Say if you want only 1 mc to move at a time then put this on  btn 2
    on (rollOver) {
    _root.image1_mc.gotoAndPlay(2);
    on (rollOut) {
        _root.image1_mc.gotoAndPlay(1);
    .Dont forget to give proper instance names to movieclips.(they are in properties panel.)
    Cheers!

  • 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

  • Making a loadmovie in an empty movie clip

    Hi. I'm making a new as3 file, and there i made an animation, like an intro for my website, in a movie clip. But what i want is, when this animation or this movie clip ends, automatically it charges another swf with my website, without having to press any button. I read some tutorials on internet that i can make this, creating a new empty movie clip, and then writing some code, but it didn`t work me. Please can anybody help me with the exact code i have to write? I will appreciate so much that, because i'm new in this as3 topic. Thanks so much for ur time.

    All you need to do is pull the code out of the function...
    stop();
    var loader:Loader =new Loader() ;
    addChild(loader) ;
    loader.load(new URLRequest("whatever.swf"));
    loader.x =0
    loader.y =0
    And you mentioned adding the loaded object to a movieclip, so if you still plan to do that then give the movieclip an instance name and use it's name to add the loader to it instead of what your code does above...
    Change: addChild(loader);
    To:  mcName.addChild(loader);

  • Animated drop down buttons not working in movie clip

    Hi,
    I am working on this site: (AS2)
    http://www.steamandclean.com/Index_w_1.html
    I have two types of drop down menu. One under Commercial and one under Technical
    The buttons are movie clips. The drop downs are also movie clips that start in frame 2 and are triggered on rollover.
    The child buttons are buttons living on the drop down movie clips. They are set to getURL
    As you see they are not willing to neither link to any url or will they run their move clip animation. One is a button and one is a movie clip.
    The left movie clip has a mask, but it makes no difference if I remove the mask . It also has a emboss filter and no difference is I take that away either.
    All of it is in one flash movie right now, but I will be splitting it up in a master navigation movie and individual swf's soon.
    Right now I have the main movie, then the button MC then the dropdown MC and in the drop down MC I have placed either a animated (button) MC or a button. So it nested in nested in.......
    In both cases I scripting the child buttons like this:
    on (rollOver) {
    gotoAndPlay(2);
    on (rollOut) {
    gotoAndPlay(6);
    on (release) {
    getURL("http://steamandclean.com");
    I have also tried to use
    _parent.getURL and _root.getURL in stead of just get URL, but it does not work.
    The drop down buttons seem to be buried. In the left side the whole drop down panel seems to act like a link?
    What am I doing wrong?
    Can you help?
    ggaarde

    Hi Ned
    Thank you for your reply again.
    I figured it out.
    Your reply prompted me to have my main button on rollover to go to a frame number on the main time line and then move the content of the drop down movie clip to that frame.
    The drop down panel now work and the child buttons animation now work as well. I just had to find a way to make the drop down panel disappear on rollout. Since I could not script the actual drop down panel I created three skinny invisible buttons and placed them on the right, left and button of the drop down panel. I scripted them to go back to frame 1 on both rollover and rollout. Done.
    See the result there:
    http://www.steamandclean.com/Index_w_1.html
    (Left side only)
    Thank you for your help.
    ggaarde

  • Access Button contained in a movie clip

    This is for beginners or those not familiar or having
    diffculty with getting embedded buttons to work.
    This is a how to on using actionscript in your main time line
    that listens for events for button(s) located inside of a
    movieclip.
    I spent hours trying to figure out why I could not access my
    button that was inside of a movie clip from the main ROOT or
    _level0 of my scene. When I placed the AS inside the movieclip that
    the button was inside of, the button worked but when I put the same
    code, no changes, on the main timeline nothing happened.
    myMovie_mc.myButton_btn.onRelease = function() {
    trace("The Button Works!");
    Your can also use onPress, onRollOver or any of the button
    actions you would if you created the AS on the button itself.
    myMovie_mc.myButton_btn.onRelease = function() {
    function() part of the code can also be function():Void
    First you tell flash where the button is located. Starting
    from the main timeline you start with the name of the movie. This
    is where I had trouble and why my buttons did not work. This part
    of the code is the INSTANCE name NOT the label you named the movie
    that displays in the library.
    CREATE AN INSTANCE NAME on the movie clip. Select the movie,
    in the properties bar you will see a field where you place the
    instance name. I always end the name with _mc, or _btn to tell me
    that it is a movie or a button so when I go back through the AS I
    know what that object is that is being referenced.
    myMovie_mc <-- This is the INSTANCE NAME of the movie clip
    myButton_btn <-- This is the name of the button INSTANCE
    NAME that resides inside the myMovie_mc movie clip
    onRelease <-- This is the event listened for, it could
    also be onPress, onRollOver or any other button events
    = function() <-- This is needed and tells flash that this
    code is treated as a function so that when the event happens, in
    this case onRelease, the code inside the { } is executed. This
    could also be = function():Void
    All the parts before the set to symbol or the = sign needs to
    be seperated with a period, though NOT between the event listened
    for and the set to symbol or = sign.
    myMovie_mc.myButton_btn.onRelease = function():Void
    Put your code here that you want performed when button is
    Released...
    The reason my code didn't work was because I did not give an
    instance name to the movie clip. You must give instance names to
    ANYTHING you call within AS code. Including buttons, MC's, symbols
    etc... or else nothing will happen.
    Now, if you are having same problem I had, the AS worked on
    the same time line level as the button was on but NOT when placed
    in parent or main time line, you now know how to fix it.
    This works in AS2, Flash8 and Flash9. I don't have AS3 yet
    but the code should work in AS3 also.
    Hope this helps someone, I searched for this info in the
    forums and could NOT find it. I stumbled upon my error after many
    hours of trial and error. So next time if I have this problem
    again, a forum search will bring this post up in the results. LOL
    Thanks.

    Nice post. One small addition to this is that you can also
    just specify a function name instead of using "=function() {".
    For example:
    myMovie_mc.myButton_btn.onRelease = myFunction;
    function myFunction():Void
    Put your code here that you want performed when button is
    Released...
    This could be used in a couple of ways. First, the way you
    mentioned in your post. Second, you can use this method to have the
    program simulate a button press (even if the user does not click on
    the button). Since the function will execute even if you just call
    it like: myFunction();
    Just my 2 cents.
    Tim

  • Button in a nested movie clip-Help!

    Hello!
    I have an issue that I have never been able to solve and need
    to now since I am on a tight deadline.
    I have a movie clip button on my main timeline. The code
    works fine (up, over and out). Inside that movie I have an
    animation where a bubble appears with text, our mission. If I use
    the URL link for text it works fine. The problem is I need, when
    clicked on, a UILoader to load a file. If I put the correct code on
    the main timeline I get an error since that pop-up has not loaded
    yet. If I put the correct code(I used before on main timeline only)
    in the movie where the pop-up is I also get an error which send the
    file into an eternal loop. What am I doing wrong??
    I would greatly appreciate any help with this.
    Thanks.
    Rob

    Hi Ned,
    Thank for the quick response. The button does have an instance name of "myreserve_btn" and it only seats on page layer in frame 3. and I changed publish settings and got this output message:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at SpaLuvicebestmassageoptionintown_fla::MainTimeline/frame3()[SpaLuvicebestmassageoptionint own_fla.MainTimeline::frame3:1]
        at flash.display::Sprite/constructChildren()
        at flash.display::Sprite()
        at flash.display::MovieClip()
        at SpaLuvicebestmassageoptionintown_fla::innnerbody_25()
        at flash.display::Sprite/constructChildren()
        at flash.display::Sprite()
        at flash.display::MovieClip()
        at flash.display::MovieClip/gotoAndStop()
        at SpaLuvicebestmassageoptionintown_fla::MainTimeline/bodymassagebtn_clicked()[SpaLuvicebest massageoptionintown_fla.MainTimeline::frame1:12]
    Is there a way around this?
    thanx in advance

  • Buttons not working in movie clips

    I have multiple movie clips on stage (all in separate layers, of course) as well as buttons on stage to play each movie clip. There are buttons inside each movie clip. The problem is that the buttons inside the top layered movie clip work, but the others in the movie clips below don't.
    This is frustrating!! Can anyone help???

    It shouldn't matter which layer things are on.  If they are separate movielcips, one should not impact another.  What version of actionscript are you using?  Do any of the movieclips have mouse interactive code assigned to them?

  • Button not working in Movie Clip

    I'm building a small 'table builder' app for a client. This
    is my first major project in flash and I've encountered something I
    cannot figure out for the life of me.
    In the .fla below there's a movie clip 'scroller' it has
    buttons in it which load .png's to the main stage. Some of the
    buttons work, some don't.... I can't figure out why. Even when I
    duplicate a button sometimes it doesn't work.??? If I take a button
    that's not working in the movie clip and cut/paste onto the main
    timeline it ALWAYS works. I've been pulling my hair out over this
    for the last two days . I have even started the whole project from
    scratch just to try and find out where I went wrong... but to no
    avail..... Any help would be GREATLY appreciated. I'm stuck on a
    hump and I need some help to get off of it.
    Here's a link to my file. I've stripped away all the styling
    elements so it should be pretty clean cut when you see it. Thanks
    for any help or guidance!
    http://www.buddyscampfire.com/tableBuilder.zip

    A few errors: Scene 1 frame 1 Actions layer. You are
    referring to buttons inside of the scroller, and you don't have
    too. They aren't doing anything. All you need on that frame is:
    function startLoading(whichImage) {
    loadMovie(whichImage, "imageLoader");
    _root.onEnterFrame = function() {
    infoLoaded = imageLoader.getBytesLoaded();
    infoTotal = imageLoader.getBytesTotal();
    percentage = Math.floor(infoLoaded/infoTotal*100);
    infoField.text = percentage+"%";
    if (percentage>=100) {
    delete this.onEnterFrame;
    infoField._visible = false;
    Then on the Scroller you have that function again. Remove it
    from the scroller, as it does nothing there. Inside of the scroller
    all you need is code to attach png files from pressing the buttons.
    Make sure each button has a unique instance name, which isn't the
    case right now. You have like three buttons called imgbtn1. Fix
    that.

  • Buttons actioning in different movie clips?

    So ive set up some buttons into a movie clip, but i want to get them performing actions in a movie clip that is within another clip.
    For example, the code below is what I have attached to one of my buttons. The Movieclip 2photosMC2 is inside a DIFFERENT movie clip to the ones where the buttons are stored. How can I script so that the button actions activate the correct clip?
    on(release){
        photosMC.gotoAndPlay("img 02");
    With the code above, photosMC is the movie clip i want to play and img 02 is within this. The button with this code in is in a different movie clip to the one in which photosMC is held
    Any ideas?
    Many Thanks
    Dave

    If you get away from attaching code to buttons you might find it easier to manage that targeting you will need to do.  If you assign instance names to your buttons and movieclips, then you can have your code in the main timeline and assign the interaction to the objects from there.  As an example, le's say you have a button named "gtn" inside a movieclip named "btnHolder" that sits on the main timeline.  And you want to have that button tell a movieclip named "mc" that sits inside another movieclip named "mcHolder" that is also on the main timeline.  Then in the main timeline you could use...
    btnHolder.btn.onRelease = function(){
         mcHolder.mc.gotoAndPlay("img02");
    To do it the way you want would require using  _root or _parent targets, which is usually better to avoid...
    on(release){
         _root.mcHolder.mc.gotoAndPlay("img 02");
    or maybe...
    on(release){
         _parent.mcHolder.mc.gotoAndPlay("img 02");

  • Flash Buttons and a nested movie clip

    I have made my movie clip and now I want to nest it into a
    button. I am not sure what code I need to use for this and how to
    nest it. I want, when a person rolls over the button for the movie
    clip to run. When they roll off of the button the movie clip stops.
    When they click on the button it takes them to a link. If anyone
    can please help me with this, I would SO greatly apprecaite it.
    Thank You ahead of time.

    Thank You SOOOO Much for replying to this. I can't tell you
    how much I appreciate your help.
    I just assumed that was the only way I could do it, (nest
    it.) So, my MC is called jiggle.
    So everywhere you have the my_mc. Should I replace it with
    jiggle.onRollOver etc....?
    ALso you say to attach the code to the action layer in the
    frame the MC appears, not in the MC itself.
    So, in the timeline that I have my MC , I have an actions
    layer. Do I not want an actions layer there? Should I just save the
    timeline with my MC and then cut and paste it into another timeline
    that has the actions layer?
    I actually have 5 of these MC.that all need to do the same
    thing, they are each for a different button.

  • Time line change with Movie Clip!

    Help, I want a movie clip to interact with another to change the scene.
    this is my code on the "Door":
    onClipEvent(enterframe) {
         if (_root.char.hitTest(this)) {
              _root.gotoAndStop("Game2", 1);
    Game2 is my next scene name.
    but it is not working!
    Why is that!
    the other movie clip's instance is "char":

    Take the code off of the object and place it in the main timeline, modifying it as shown...
    this.onEnterFrame = function(){
         if (char.hitTest(Door)) {   // replace "Door" with the instance name you gave it
               delete this.onEnterFrame;
               gotoAndStop("Game2", 1);

  • Button rollover changes backgorund

    Is there a way to make it so when you rollover a button it changes the background in muse? I'm wanting an opening page that lets users go to three main pages based on what they are initially looking for. My major idea is, when the button has rollover the whole background and color scheme of the page changes to fit the style of that particular topic (i.e. Business look and picture of a guy in a suit for the "Professional" selection, laid back feel and picture of someone in their home for a "Personal" selection, ect.). If this is possible please help me out.

    You can try tabbed panel with show content on roll over action, 100% width can be applied on tabbed panel.
    Thanks,
    Sanjit

  • Save movie  Clip in frame as jpeg

    We Are Developing A web Application as the following :
    the Client Can select A template then Write words on over it
    and Save the Template as Jpeg format ,we did the first part ,how we
    can save the movie Clip as JPEG format ,I looked in the Bitmap
    class and i did not found any Solution,also I used the PHP to send
    Data to It From Flash but it is very Slow Proccess is there any way
    to do this from Flash

    this my Code i olny load image in a movieClip and I changed
    the width and height of the movie
    myimage= movieClip
    import flash.display.BitmapData;
    import com.quasimondo.display.BitmapExporter;
    myimage.loadMovie("1.jpg") ;
    var snapshot:BitmapData = new BitmapData(500,400,false);
    // You will have to change the gatewayURL to your server
    // except if you are testing this locally:
    BitmapExporter.gatewayURL = "
    http://www.7everyweek.com/BitmapExporter.php";
    // It is a good idea to listen to the various events that
    // BitmapExporter provides:
    BitmapExporter.addEventListener( "progress", this);
    BitmapExporter.addEventListener( "status", this);
    BitmapExporter.addEventListener( "error", this);
    //BitmapExporter.addEventListener( "complete", this);
    function save():Void
    // Check if there is still an export going on:
    if (BitmapExporter.getStatus() == "idle") {
    // update the bitmap with the latest camera image:
    snapshot.draw(myimage);
    progress_back._visible = progressbar._visible=true;
    // this is only to compare the different speeds
    timer = getTimer();
    onEnterFrame = updateTimer;
    // Since the webcam image is very small we can get away with
    turboscan here:
    BitmapExporter.saveBitmap(snapshot, "testsnapshot.jpg",
    "turboscan", 0 );
    // Usually it is receommended to use one of the other modes:
    // BitmapExporter.saveBitmap(snapshot, "snapshot.jpg",
    "fastscan", 0, 70);
    // BitmapExporter.saveBitmap(snapshot, "snapshot.jpg",
    "default", 0, 70);
    // BitmapExporter.saveBitmap(snapshot, "snapshot.jpg",
    "palette", 0, 70);
    // BitmapExporter.saveBitmap(snapshot, "snapshot.jpg",
    "rgb_rle", 0, 70);
    function updateTimer(){
    time.text = getTimer() - timer;
    function progress(evt:Object):Void {
    progressbar.setProgress(evt.current, evt.total);
    progressbar.label = evt.message+" (%3%%)";
    function error(evt:Object):Void {
    errormsg.text += evt.message+"\n";
    delete onEnterFrame;
    trace( evt.message )
    function status(evt:Object):Void {
    trace( evt.status );
    switch (evt.status) {
    case "contacting server" :
    save_btn._visible = false;
    save_btn.enabled = false;
    cancel_btn._visible = true;
    cancel_btn.enabled = true;
    break;
    case "idle" :
    progress_back._visible = progressbar._visible=false;
    save_btn.enabled = true;
    save_btn._visible = true;
    //cancel_btn.enabled = false;
    cancel_btn._visible = false;
    onEnterFrame = null;
    break;
    case "retrieving":
    onEnterFrame = null;
    break;
    save_btn.onPress = function() {
    this._parent.save();
    progress_back._visible = progressbar._visible=false;
    //cancel_btn._visible = false;
    //save_btn._visible = true;
    progressbar.minimum = 0;
    //cancel_btn.enabled = false;
    var timer:Number
    var errormsg:TextField;
    ////////////////

Maybe you are looking for

  • Apple TV and 3D Content

    I have an Apple TV 2nd Generation, and am considering getting a 3D TV. What I am wondering is about the Half Side By Side Format. There are some of these on YouTube, and I have some videos I am considering processing to Half Side By Side. What I want

  • What does the ac power cord hook up to?

    im a new mbp user. i recently got it. it came with the ac power cord and the ac plug. i know how to use the plug. but i dont know what the power cord goes to. help please? lol

  • Stretched QT Export

    I've imported into FCExpress 2 from a Sony Digital 8 Handycam through Firewire. All looks good in FCExp (regular non-HD, TV-like aspect ratio). But when I export to QT Movie and play back in QT Player, the image is stretched horizontally (everyone be

  • How does the newest Iphone work with Ford Sync?

    How does the new Iphone work with Ford Sync? I was thinking of purchasing the 4s but may go elsewhere if there is a better phone for the equipment in my vehicle.

  • Sales line items

    Hi All, we are posting sales invoice. for FI document 1800 line items are there.  It is giving message" Maximum number of line items reached for FI document. please tell me what is process. while posting more than 999 line items? Thanks