Button ActionScript 2.0

Hello, I have a button and defined 3 different layouts in the states Up, Over and Down. If the user clicks on the button and moves the cursor out of the area after the mouse click, the layout of the cursor should still show the "Down-layout", just to indicate that the user has already clicked the button. This state should be active until the user clicks on another button. How has this to be solved? Thanks in advance for your help. Best regards Ute

Hi Ned,
now I changed my buttons to movieclips, but I don't get that what I want:
when the user - after having clicked on the mc "cereluna_btn_inst" - rolls out his mouse out of the area, then frame 1 is shown.
It is clear for me that I have this behaviour because I use this scripting below. But I don't know how to change the script, so that frame 2 is shown as long as "cereluna" is played.
/* cereluna */
kollektion.cereluna_btn_inst.onRollOver = function(){
    kollektion.cereluna_btn_inst.gotoAndStop(2);
kollektion.cereluna_btn_inst.onRollOut  = function(){
    kollektion.cereluna_btn_inst.gotoAndStop(1);
kollektion.cereluna_btn_inst.onRelease = function(){
    gotoAndPlay("cereluna");
"kollektion" is a mc; in this mc I have "mc-buttons" like "cereluna_btn_inst". These mc buttons have two frames:
frame 1: a grey picture, frame 2 a highlighted picture. The result should be: if "cereluna" is played, frame 2
should be "active" even when the user moves the cursor out of the area.
Best regards,
Ute

Similar Messages

  • Popup Window- Button Actionscript

    Does anyone have the code that combines actionscript w/ java
    in order to create a popup window from a flash button? I couldn't
    get this to work- on (release) {
    getURL
    ("javascript:NewWindow=window.open('index.html','newWin','width=400,height=300,left=0,top =0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');
    NewWindow.focus();void(0);");

    ggshow, I tried your component, but I can't figure out where
    to place the
    my_btn.onPress = function() {
    my_popup.openWindow("
    http://www.ggshow.com",
    "my_window");
    I would be very happy if you, or anyone else could solve this
    trivial problem for me
    thanks
    /magnus

  • Movieclip buttons actionscript errors

    Hi,
    I have tried using this type of button for the first time and
    also ActionScript.
    I have made a movie clip with _up and _over states and it
    works.
    But the onRelease is doing two strange things.
    Firstly, If I click on a button it will go to the page, say
    "Home" but when I click on it again it will make the movieclip for
    the page disapper.
    I then have to click again to get it back.
    Secondly, I am trying to make the buttons work with the
    rollOver when another button is clicked, a button other than the
    one used to show the current page.
    I have it kind of working but its not now I want it.

    For this line of code:
    if (_root.mcHome != "_on")
    You appear to be trying to use what is a frame label as a
    value compare to the movieclip instance... they will never equate.
    One is an object and the other is...??? a label.
    You probably need to set a boolean variable to true/false as
    needed and compare that...
    So when you do whatever makes mcHome goto the _on location,
    at that location you would set the variable to be true...
    mcHomeOn = true;
    Then you could test that value...
    if(mcHomeOn)...

  • Button Actionscript Not Revealing Content help!

    Hi.
    I want my button to goto frame1 of layer 'content' when it is
    clicked.
    in my layer content i have text that i made into a symbol and
    gave the instance name boys_content
    in the last frame of my button, this is what i have as the
    actionscript
    on (release) {
    boys_content.gotoAndPlay(1);
    boys_content.visible = true;
    I'm getting no action output errors but my content is not
    revealing itself upon being clicked.
    Do i need actionscript for the content? please respond here
    or e-mail me at [email protected]
    thanks.

    tutorial
    Ok this may be over egging it but here is a tutorial I did on
    communicating between classes but I use pulling in xml and going
    through the nodes as the example to work from which may help you in
    your task. All AS2

  • Problems with Next and Back Buttons ActionScript 3.0

    Hi,
    I have set up a Back, Play and Next buttons in a slideshow I am making.  The next and back buttons work correctly until it gets to the end. 
    If I press the Next button it goes back to what appears to be Frame 1 and will not go to the next slide. If I press the Back button it will then go to Frame 201 and If I press next again it will go to Frame 1.  It will only go back and forth in between those frames.
    If I press the Back button from the beginning it goes through the slide show correctly then it gets stuck at Frame 1.  If I press next button it goes to Frame 121 and gets stuck in between 121 and 1.
    I can't figure this out please help.
    My code on Frame 1 is:
    stop();
    play_btn.addEventListener(MouseEvent.CLICK,playslideshow);
    function playslideshow(event:MouseEvent) { gotoAndPlay(2); }
    forward_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_2);
    function fl_ClickToGoToAndStopAtFrame_2(event:MouseEvent):void
      gotoAndStop(40);
    back_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_8);
    function fl_ClickToGoToAndStopAtFrame_8(event:MouseEvent):void
      gotoAndStop(281);
    My code on Frame 40 is:
    forward_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_7);
    function fl_ClickToGoToAndStopAtFrame_7(event:MouseEvent):void
      gotoAndStop(121);
    back_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_9);
    function fl_ClickToGoToAndStopAtFrame_9(event:MouseEvent):void
      gotoAndStop(1);
    My code on Frame 121 is:
    forward_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_3);
    function fl_ClickToGoToAndStopAtFrame_3(event:MouseEvent):void
      gotoAndStop(201);
    back_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_10);
    function fl_ClickToGoToAndStopAtFrame_10(event:MouseEvent):void
      gotoAndStop(40);
    My code on Frame 201 is:
    forward_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_4);
    function fl_ClickToGoToAndStopAtFrame_4(event:MouseEvent):void
      gotoAndStop(281);
    back_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_11);
    function fl_ClickToGoToAndStopAtFrame_11(event:MouseEvent):void
      gotoAndStop(121);
    My code on Frame 281 is:
    forward_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_5);
    function fl_ClickToGoToAndStopAtFrame_5(event:MouseEvent):void
      gotoAndStop(1);
    back_btn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_12);
    function fl_ClickToGoToAndStopAtFrame_12(event:MouseEvent):void
      gotoAndStop(201);

    I found the solution!  Flash CS5 Tutorial 6 Click On Button Go To Another Frame.avi - YouTube
    I had to Convert to Keyframes each frames I wanted to jump to on the buttons layer.  Then highlight the button and give each another instance name! Like forward1_btn, forward2_btn, back1_btn, back2_btn...  I did that and adjusted the action-script for each button.
    Frame 1
    stop();
    play_btn.addEventListener(MouseEvent.CLICK,playslideshow);
    function playslideshow(event:MouseEvent)
    gotoAndPlay(2);
    forward1_btn.addEventListener(MouseEvent.CLICK, Shoot_1);
    function Shoot_1(event:MouseEvent):void
      gotoAndStop(40);
    back1_btn.addEventListener(MouseEvent.CLICK, Back_1);
    function Back_1(event:MouseEvent):void
      gotoAndStop(281);
    Frame 40
    forward2_btn.addEventListener(MouseEvent.CLICK, Shoot_2);
    function Shoot_2(event:MouseEvent):void
      gotoAndStop(121);
    back5_btn.addEventListener(MouseEvent.CLICK, Back_5);
    function Back_5(event:MouseEvent):void
      gotoAndStop(1);
    And so on...

  • Help with buttons/actionscript

    I've got a movieclip acting as a button.  Code on the button itself handles roll-over/-out states, and I define an onRelease function in the main timeline as follows:
    backBut.onRelease=function(){
         gotoAndPlay(1);
    This code takes the movie back to the first frame and works on the third frame.  For some reason, though, the same code on the fifth frame has no effect.  The button doesn't do anything.  I have tried using the same button, I tried inserting a new keyframe with a new button, renaming the button, etc. and for some reason I just can't get it to work on the fifth frame.
    If it helps to visualize, I am essentially making a menu.  The first frame contains buttons to take you to submenus, located on following slides.  This button to go back to the original menu is on each frame with a submenu, but for some reason only works on one of them.  Thanks in advance for your help.

    Try moving that button in frame 5 to it's own layer.  If it's the same llibrary symbol, what happens is the name from the preceding instance gets inherited, along with other characteristics.  If frame 4 doesn't do anything, instead of a new layer, just try putting a blank keyframe between the buttons in frames 3 and 5.  This may not be the problem at all, but it's my first guess at the possible problem.

  • Help with flash buttons actionscript 2.0

    Help please, I am not sure what I am doing wrong here. Each button has this script
    on (release) {
    getURL("http://www.mysite.com/index.html");
    Once they work I want to import them to dreamweaver.

    Do you happen to have any kind of rollover code tied to anything that is containing the buttons?  I don't see the sense in having Flash buttons unless you have some form of animation associated with them, possibly triggered by rollover interactions.  If so, the rollover may be blocking access to the on(release) interaction.

  • Sound Button, ActionScript 3.0

    Hi, I am a newbie to ActionScript but I do have an understanding of scripting. I have worked in designing games on a few game engines and now I am looking into ActionScript 3.0
    I created a script by getting some details here and there on the web and this is what Ive come up with,
    var loadSnd:URLRequest = new URLRequest("Sound.wav");
    var thisSnd:Sound = new Sound();
    thisSnd.load(loadSnd);
    Sound_1.addEventListener(MouseEvent.CLICK, playF);
    function playF(event:MouseEvent);void{
              thisSnd:play(); //Line 8
    Output:
    Scene 1, Layer 'Actions', Frame 1, Line 8
    1084: Syntax error: expecting rightbrace before semicolon.
    I dont think this is a difficult error to fix but it is an issue for me at the moment.

    another error in your code:
    kglad wrote:
    use:
    var loadSnd:URLRequest = new URLRequest("Sound.wav");
    var thisSnd:Sound = new Sound();
    thisSnd.load(loadSnd);
    Sound_1.addEventListener(MouseEvent.CLICK, playF);
    function playF(event:MouseEvent):void{
              thisSnd.play(); //Line 8

  • Flash Button Actionscript

    can anyone plz help me code my flash buttons in a drop down
    menu, a basic flash button in order to link my pages within
    dreamweaver.
    now this website has the drop down menu if you look at the
    top, i know how to create everything buttons,dropdown menus in
    flash but somehow i cannot get the buttons to link to my webpage
    within dreamweaver i tried
    the actionscrip
    On(Rollover)}
    getURL("Page")}
    but it doesn't work for my webpages but it does work to
    external pages like google.com
    noW, i know there is way to create this drop down menu or
    button thats why this page has it, im trying to make my website for
    my school and i would love to know how to code it. plz
    help..thanks

    unless your publishing for flash 6 or earlier, flash is
    case-sensitive and your code is incorrect. that should be:
    on(rollOver){
    getURL("Page.html"); // assuming Page.html is correct.
    }

  • Random Button ActionScript 2?

    I'm trying to make a random button in my flash game, and nothing I try works. I can't post the file either becausde it's too big. The button is in a movie clip where everything else is. Someone help please.

    Here's what I'll suggest--I haven't looked at your file yet.  I do't know if having those _global variables is significant, so I am leaving them in, but if they are only for the purpose of indicating which frames the movieclips should go to, then they can go as well.  In either case, you will get rid of the onclipevent code you have attached to each movieclip
    For starters, you will need to assign an instance name to each of the movieclips.  Instance names are assigned in the properties panel.  I will use names that reflect the global variables, with _mc appended....
    on(release){
         _global.Head = Math.floor(Math.random() * 4) + 1;
         head_mc.gotoAndStop( _global.Head );
         _global.Body = Math.floor(Math.random() * 4) + 1;
          body_mc.gotoAndStop( _global.Body );
         _global.Beak = Math.floor(Math.random() * 4) + 1;
          beak_mc.gotoAndStop( _global.Beak );
        etc....
    OR, if you don't need the _globals...
    on(release){
          head_mc.gotoAndStop(Math.floor(Math.random() * 4) + 1);
          body_mc.gotoAndStop(Math.floor(Math.random() * 4) + 1);
          beak_mc.gotoAndStop(Math.floor(Math.random() * 4) + 1);
        etc....
    Note that I have added Math.floor into the mix.  This produces an integer value out of what the Math.random creates.

  • Need a simple email button actionscript 3

    Hi. Does anyone have a simple as3 code that will have a button open up a mail client (outlook, apple mail, etc.)?
    I have found some but they all open up an empty web browser at the same time which isn't exactly professional. Thx.

    The code you found is probably fine.  When you place the file on a server, those empty web pages are unlikely to open.  It will happen in the authoring envirnment when you are testing a Flash file--some things with Flash have to be tested live to confirm proper behavior.
    In any case, you should show the code in case there is something amiss with it.

  • Actionscript for Zoom in and out button

    I create two buttons that allows the user to click the zoom
    in and zoom out buttons to zoom in and out of the publish movie.
    Can anyone share the two buttons actionscript code to me, or tell
    me where can I find the resources?

    Feature has been removed AFAIK. As far as zoom is concerned, the new operating system has been..whatever the opposite of optimized is...pessimized?

  • FAQ: How do I create buttons in Flash Pro?

    There are many different kinds of buttons that can be made in Flash Pro and different ways of creating them.
    Start here: Flash Pro Help > Creating buttons. This article describes the options and provides links to approved videos and tutorials.
    Be aware that all buttons in Flash Pro require at least some ActionScript code.
    For buttons made with the "Button" symbol type, these links provide detailed instructions:
    Video: Creating Buttons (Length: 9:16, tv.adobe.com)
    Video: Button symbols and interactivity in Flash CS4 (Includes some ActionScript 3.0, tv.adobe.com)
    Tutorial: Button symbols in Flash (Includes some ActionScript 3.0, Kirupa.com)
    Example: Animation portfolio piece (Flash Professional) (Adobe.com)
    Example: ActionScript 3.0 for a button to open a web page (Flashthusiast.com)
    Example: ActionScript 2.0 for a button to open an web page (Adobe.com)
    Example: ActionScript 3.0 for buttons to jump to different scenes in the Timeline (Flashthusiast.com)
    Example: ActionScript 3.0 for multiple buttons on the Stage at the same time (Flashthusiast.com)
    TechNote: How to create a simple button (Adobe.com)
    For buttons made with a movie clip symbol, these links provide detailed instructions:
    Tutorial: Movie Clip Buttons (ActionScript 3.0, Schoolofflash.com)
    Video: Creating a Movie Clip Button (ActionScript 2.0, Kirupa.com)

    Is you use the first option, "The field is the product of the following fields:" you should see a result. Just make sure the fields you want multiplied or selected.
    The following links show how to create calculations in various ways.
    How to use basic calculations in PDF forms
    How to do (not so simple) form calculations

  • Flash button to show html layer

    I have embedded a Flash menu into an html doc with a hidden
    layer called player. I want a button in the Flash menu to show that
    layer. I used the instructions on this website:
    http://www.bestflashanimationsite.com/tutorials/1/2/
    But it doesn't work. I made a link on the html page that
    shows the layer, so the Dreamweaver MM_showHideLayers function is
    there in the html head. I tried this in the button actionscript:
    on(press) {
    getURL("javascript:MM_showHideLayers('player','','show')");
    I also tried writing a custom function in the html which does
    work from a button in the html:
    function showPlayer() {
    MM_showHideLayers('player','','show')
    and then putting this in the Flash button:
    on(press) {
    getURL("javascript:showPlayer()");
    Which does not work. (following are the Dreamweaver
    functions)
    Please help!!!!!

    I use externalInterface (instead of getURL). Its a great way
    to call javascript functions from flash and vice-versa.
    http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveD ocs_Parts&file=00002200.html
    There are some links to examples in the comments below the
    description.

  • Loading external SWF in Actionscript 2

    I am creating an animation within Flash CS4 in Actionscript 2.0 / Flash Player 7
    At the moment I have a handler (Movie Clip) called myHolder that is used to play other swf files within one main swf file, when called by a button
    Within a button that load the swf into the main timeline - For Example
    on (press) { loadMovie("BulletTrainDRAFT.swf", myHolder); }
    This works fine with bring other swf files into the main swf file timeline, but when I bring a swf file that has video controls for a video within it, they do not respond within the handler when played, but they do work when that swf file is played within its own external flash player window (The video is within a (Movie Clip) on its own timeline within its design fla)
    Video buttons - ActionScript 2.0
    btnStop.onPress = function(){  _root.vid.stop();  } btnPlay.onPress = function(){  _root.vid.play();  }  btn_fastforward.onPress = function(){  _root.vid.nextFrame();  }  btn_Rewind.onPress = function(){  _root.vid.prevFrame();  }
    I tried ActionScript 3.0 code as well
    Pausebtn.addEventListener(MouseEvent.CLICK,pauseHandler); Stopbtn.addEventListener(MouseEvent.CLICK, stopHandler); Playbtn.addEventListener(MouseEvent.CLICK,playHandler); 
    function stopHandler(event:MouseEvent):void { // Pause the stream and move the playhead back to // the beginning of the stream. video.gotoAndStop(1); } function playHandler(event:MouseEvent):void { // Pause the stream and move the playhead back to // the beginning of the stream. video.play(); } function pauseHandler(event:MouseEvent):void { // Pause the stream and move the playhead back to // the beginning of the stream. video.stop(); }
    Problem I have I think, is that a movie the external swf loads on the existing timeline as a child and doesn't unload the timeline resulting the actionscript not functional, but I can't fix this.

    if the loaded swf with video is an as2 swf, add:
    this._lockroot=true
    to it's main timeline.

Maybe you are looking for