Script to make the button stay on State hit until the other is clicked!

Hello

Got a little problem that I can't solve.

I have a line of 5 buttons including each links to a different page. These buttons are currently in a clip.

However, I would like to create an effect where when a user clicks on it remains highlighted. that is still on the State of success, until the user clicks one of the buttons.

I would have thought it would be somethink that I could find online, but carnt seem to find anywhere.

I found the code to make a point to stay on when you click on it, but it works on its own in the entire movie clip, so it has no effect when you click on other buttons on!

Have tried the script below, but I'm sure that this will not work because it is not a link to the other buttons at all.

on {(press)

if (this ._currentframe == 1) {}
this.gotoAndStop (2);
{ } else {}
this.gotoAndStop (1);
}
}
Thanks for any help!

You are welcome.  Here is a slightly condensed version of the same thing...

var lastBtnUsed;

Btn1.onRelease = btn2.onRelease = btn3.onRelease = btn4.onRelease = function() {}
processBtns (this);
}

function processBtns (newBtn) {}
If (lastBtnUsed! = null & lastBtnUsed! = newBtn) {}
lastBtnUsed.gotoAndStop (1);
}
lastBtnUsed = newBtn;
newBtn.gotoAndStop (2);
}

Tags: Adobe Animate

Similar Questions

  • RH11. Script to make the Next and Prev buttons to work as they do in a standard browser?

    Hello.

    I know the arrows to next and previous button in the navigation pane to take the user to the next or previous section specified in the sequence of browser. This means that the help author has design one or more sequences of navigation, which can be long and difficult to maintain.

    Someone at - he created a script, or know if there is, who can transform the Next and Prev buttons buttons that perform standard browser actions. For example:

    • The user opens the A section.
    • The user opens the topic J.
    • User presses the back button.
    • Help opens the A section.

    At the moment the results depend on the navigation sequence.

    • The user opens the A section.
    • The user opens the topic J.
    • User presses the back button.
    • Help opens the topic I have (the subject which precedes the subject J in the sequence to browse).

    Thank you. [

    Carol Levine

    Hi Carol

    I guess you overlooked this link on the page:

    Here is the link should be clicked: (this way you will not have to return to the page)

    Click here to see

    See you soon... Rick

  • Script to make the list of layer names.

    I wonder if someone could help me make the simple script that take the layer names and the list of their share on the A4 in canvas.

    Now I just got the screenshot of the list of Illustrator and edit it through photoshop to print, but it is too small, because each file have a approximately 25-50 layers.

    Looks like this:

    layer-list.jpg

    I tried to edit the script of John Wundes, which makes the list of the nuances, but it seems difficult for my skills.

    /////////////////////////////////////////////////////////////////
    // Render Swatch Legend v1.1 -- CS, CS2, CS3, CS4, CS5
    //>=--------------------------------------
    //
    //  This script will generate a legend of rectangles for every swatch in the main swatches palette.
    //  You can configure spacing and value display by configuring the variables at the top
    //  of the script. 
    //   update: v1.1 now tests color brightness and renders a white label if the color is dark.
    //>=--------------------------------------
    // JS code (c) copyright: John Wundes ( [email protected] ) www.wundes.com
    // copyright full text here:  http://www.wundes.com/js4ai/copyright.txt
    //
    ////////////////////////////////////////////////////////////////// 
        doc = activeDocument,
        swatches = doc.swatches,
        cols = 4,
        displayAs = "CMYKColor",  //or "RGBColor"
        rectRef=null,
        textRectRef=null,
        textRef=null,
        rgbColor=null,
        w=150;
        h=100,
        h_pad = 10,
        v_pad = 10,
        t_h_pad = 10,
        t_v_pad = 10,
        x=null,
        y=null,
        black = new GrayColor(),
        white = new GrayColor()
        ;
    
    
        black.gray = 100;
        white.gray = 0;
    
    
    activeDocument.layers[0].locked= false;
    var newGroup = doc.groupItems.add();
    newGroup.name = "NewGroup";
    newGroup.move( doc, ElementPlacement.PLACEATBEGINNING );
    
    
    for(var c=0,len=swatches.length;c<len;c++)
    {
            var swatchGroup = doc.groupItems.add();
            swatchGroup.name = swatches[c].name;
           
            x= (w+h_pad)*(c% cols);
            y=(h+v_pad)*(Math.floor((c+.01)/cols))*-1 ;
            rectRef = doc.pathItems.rectangle(y,x, w,h);
            rgbColor = swatches[c].color;
            rectRef.fillColor = rgbColor;
            textRectRef =  doc.pathItems.rectangle(y- t_v_pad,x+ t_h_pad, w-(2*t_h_pad),h-(2*t_v_pad));
            textRef = doc.textFrames.areaText(textRectRef);
            textRef.contents = swatches[c].name+ "\r" + getColorValues(swatches[c].color) ;
            textRef.textRange.fillColor = is_dark(swatches[c].color)? white : black;
            //
            rectRef.move( swatchGroup, ElementPlacement.PLACEATBEGINNING );     
            textRef.move( swatchGroup, ElementPlacement.PLACEATBEGINNING );
            swatchGroup.move( newGroup, ElementPlacement.PLACEATEND );
    }
    
    
    function getColorValues(color)
    {
            if(color.typename)
            {
                switch(color.typename)
                {
                    case "CMYKColor":
                        if(displayAs == "CMYKColor"){
                            return ([Math.floor(color.cyan),Math.floor(color.magenta),Math.floor(color.yellow),Math.floor(color.black)]);}
                        else
                        {
                            color.typename="RGBColor";
                            return  [Math.floor(color.red),Math.floor(color.green),Math.floor(color.blue)] ;
                           
                        }
                    case "RGBColor":
                       
                       if(displayAs == "CMYKColor"){
                            return rgb2cmyk(Math.floor(color.red),Math.floor(color.green),Math.floor(color.blue));
                       }else
                        {
                            return  [Math.floor(color.red),Math.floor(color.green),Math.floor(color.blue)] ;
                        }
                    case "GrayColor":
                        if(displayAs == "CMYKColor"){
                            return rgb2cmyk(Math.floor(color.gray),Math.floor(color.gray),Math.floor(color.gray));
                        }else{
                            return [Math.floor(color.gray),Math.floor(color.gray),Math.floor(color.gray)];
                        }
                    case "SpotColor":
                        return getColorValues(color.spot.color);
                }    
            }
        return "Non Standard Color Type";
    }
    function rgb2cmyk (r,g,b) {
     var computedC = 0;
     var computedM = 0;
     var computedY = 0;
     var computedK = 0;
    
    
     //remove spaces from input RGB values, convert to int
     var r = parseInt( (''+r).replace(/\s/g,''),10 ); 
     var g = parseInt( (''+g).replace(/\s/g,''),10 ); 
     var b = parseInt( (''+b).replace(/\s/g,''),10 ); 
    
    
     if ( r==null || g==null || b==null ||
         isNaN(r) || isNaN(g)|| isNaN(b) )
     {
       alert ('Please enter numeric RGB values!');
       return;
     }
     if (r<0 || g<0 || b<0 || r>255 || g>255 || b>255) {
       alert ('RGB values must be in the range 0 to 255.');
       return;
     }
    
    
     // BLACK
     if (r==0 && g==0 && b==0) {
      computedK = 1;
      return [0,0,0,1];
     }
    
    
     computedC = 1 - (r/255);
     computedM = 1 - (g/255);
     computedY = 1 - (b/255);
    
    
     var minCMY = Math.min(computedC,
                  Math.min(computedM,computedY));
     computedC = (computedC - minCMY) / (1 - minCMY) ;
     computedM = (computedM - minCMY) / (1 - minCMY) ;
     computedY = (computedY - minCMY) / (1 - minCMY) ;
     computedK = minCMY;
    
    
     return [Math.floor(computedC*100),Math.floor(computedM*100),Math.floor(computedY*100),Math.floor(computedK*100)];
    }
    
    
    function is_dark(color){
           if(color.typename)
            {
                switch(color.typename)
                {
                    case "CMYKColor":
                        return (color.black>50 || (color.cyan>50 &&  color.magenta>50)) ? true : false;
                    case "RGBColor":
                        return (color.red<100  && color.green<100 ) ? true : false;
                    case "GrayColor":
                        return color.gray > 50 ? true : false;
                    case "SpotColor":
                        return is_dark(color.spot.color);
                    
                    return false;
                }
            }
    }
    

    arop16461101,

    something like that?

    var theLayers = app.activeDocument.layers;
    var str = new Array ();
    for (i = 0; i < theLayers.length; i++) {
        str.push (theLayers[i].name)
        }
    var tF = theLayers[0].textFrames.add();
    tF.contents = str.join ("\r");
    alert("new text frame with layerlist added on layer " + theLayers[0].name);
    

    Have fun

  • How can I make a button to be interactive so when its checked or clicked, the next tab fields become required field?

    I'm trying to create a form that contains a button to select a credit card or check.  When someone chooses the credit card, I need to become a required credit card information fields.  In the contrary case, it they select check, all the fields of credit card (number, exp. date, security code...) to be non-mandatory field.

    Why use a button. If you have a checkbox or a radio button, you can use the available actions for one of these fields to adjust the properties of the fields depending on what widget in the Group has been selected that can be to make the required, visible and required fields and then reset/clear the other group of fields, do so in read-only and disabled the requirement.

  • makes the other required fields

    If I select a checkbox, I want to do a drop down field required.

    Use this code as the mouse script to the top of the box (adjust the name of the field in the code to match real field name in your file):

    this.getField("Dropdown1").required = (event.target.value!="Off");
    
  • attempt to sync with Android and after typing in the codes given by the unit and the other by clicking on the said msg try... again no explanation

    I tried several times with new codes... seems if it will not work, should I get an error msg!

    You try to synchronize with a desktop computer running Firefox 3.0? First of all, the update Firefox 14.0.1. Update Firefox to the latest version.

    Then try to synchronize again using Firefox Sync client.

  • Is it possible to modify this script to make same width or height objects?

    I found this script that makes the objects selected from the same width AND height. I am very new to scripting. is it possible to change this to an object of the same width, leaving their heights the same?

    mySelection = activeDocument.selection;

    If (mySelection.length > 0) {}

    If {(mySelection instanceof Array)

    goal = mySelection [mySelection.length - 1];

    for (i = 0; i <(mySelection.length-1); i ++) {}

    ratioW = 100/(mySelection[i].width/goal.width);

    ratioH = 100/(mySelection[i].height/goal.height);

    mySelection [i] .resize (ratioW, ratioH)

    }

    }

    } else {}

    Alert ("nothing selected!")

    }

    Thanks in advance

    Yes,

    change this line

    ratioH = 100/(mySelection[i].height/goal.height);
    

    for this

    ratioH = 100;
    
  • How to make the button script in Illustrator?

    Dear all,

    Recently, I always use Illustrator 2 free, script text are: "joinTextFrames" & "divideTextFrame".

    but I lost a lot of step to do

    for example, click: 1. Select text-> 2. File-> 3. Script-> 4. Another script-> load a script

    Fastest way-> Ctrl + F12-> load a script

    But now I want to do is the key 2 'joinTextFrames' & 'divideTextFrame '. The same way "mode button" in stock for faster work.

    How to make or solution to make? I really need it for my work.

    Thanks for your help.

    Save your scripts folder in the scripts, like that they'll show in the file-> Scripts Menu. Then, save the two actions to run each script, each gives a shortcut key (i.e. & F3 F2) or run the Mode button if you want to.

    Note that you need to re - register the action every time that you restart illustrator.

  • Make the load script button?

    I have a form of comment and when you click on the button to submit the form it will take you to another page that runs a script this post is the comment.

    Is it possible for me to run the script when the button is pressed and not to go to the new page and also reload the page that my comment has been submitted the?

    Sure. Just put the script located on the next page on the first page. Then, you must present the form page itself. If you don't want to reload the page, you will need to use ajax.

  • How to make the buttons doesn't work in every scene?

    Hello

    I created four separate buttons (actionscript3) and I coded each button so when one is active, it climbs to a different scene. The four buttons are present on all the stages (I copy - paste all the buttons of the original scene at each additional stage) so I was hoping that, whatever the stage, the user can click on each button to operate. Each button works on the first click (the first stage), but the question is when that one is turned on and the buttons, it climbs to a new scene is no longer are clickable (roll over the State remains functional, but none of them work to be clickable to access another scene). I copy / paste my code used below, I hope this question makes sense, I want to just that my buttons to work independently of the scene. Thank you!

    Here are the codes that I used, I placed it on the first frame of the first scene:

    tulip_btn.addEventListener (MouseEvent.CLICK, onClick);

    function onClick(e:MouseEvent) {}

    gotoAndPlay (1, "scene 2");

    }

    rose_btn.addEventListener (MouseEvent.CLICK, onCami);

    function onCami(e:MouseEvent) {}

    gotoAndPlay (1, "scene 4");

    }

    lily_btn.addEventListener (MouseEvent.Click, onLily);

    function onLily(e:MouseEvent) {}

    gotoAndPlay (1, "scene 5");

    }

    poppy_btn.addEventListener (MouseEvent.CLICK, onPoppy);

    function onPoppy(e:MouseEvent) {}

    gotoAndPlay (1, "scene 6");

    }

    When you go to another scene, it's as if it's a new button, which does not have the mouse listener. If you were using a movieclip instead of a button, you can place the script inside the movieclip. It would be wise add the listener when the movieclip is added to the scene and remove the listener when it is removed.

    There is a different way, you may work well. You can name your buttons and the same scenes. Then, in the intro scene, you could have a script like this:

    import flash.events.MouseEvent;

    Stop();

    stage.addEventListener (MouseEvent.CLICK, clicked);

    function clicked (e:MouseEvent) {}

    gotoAndPlay(1,e.target.name);

    }

    Now you can copy the four buttons, which might be called rose, Lily, Tulip, poppy, and clicking on any one of them would you bring to the scene with the same name.

  • Make the help links - Extended button

    Well, I had a great help earlier with the creation of a button linked to an external page using Flash Builder.

    I have no problem with that... my new number is with 5 buttons.

    Here is the code I'm looking forward to deal with in Flash Builder-

    <? XML version = "1.0" encoding = "utf-8"? >
    " < xmlns:s ="library://ns.adobe.com/flex/spark"xmlns:fx = s:Skin" http://ns.Adobe.com/MXML/2009 "xmlns:d =" " http://ns.Adobe.com/FXG/2008/DT ">
    < s:transitions >
    < s:Transition fromState = "low" toState = "rise" autoReverse = "true" >
    < s:Parallel >
    < s:Parallel target = "{bitmapimage1}" >
    < s:Move autoCenterTransform = "true" duration = "250" / >
    < / s:Parallel >
    < s:Parallel target = "{bitmapimage2}" >
    < s:Move autoCenterTransform = "true" duration = "250" / >
    < / s:Parallel >
    < / s:Parallel >
    < / s:Transition >
    < s:Transition fromState = "rise" toState = "over" autoReverse = "true" >
    < s:Parallel >
    < s:Parallel target = "{bitmapimage2}" >
    < s: Fade duration = "250" / >
    < / s:Parallel >
    < s:Parallel target = "{bitmapimage1}" >
    < s: Fade duration = "250" / >
    < / s:Parallel >
    < / s:Parallel >
    < / s:Transition >
    < s:Transition fromState = "rise" toState = "low" autoReverse = "true" >
    < s:Parallel >
    < s:Parallel target = "{bitmapimage1}" >
    < s:Move autoCenterTransform = "true" duration = "0" / >
    < / s:Parallel >
    < s:Parallel target = "{bitmapimage2}" >
    < s:Move autoCenterTransform = "true" duration = "0" / >
    < / s:Parallel >
    < / s:Parallel >
    < / s:Transition >
    < s:Transition fromState = "over" toState = "mounted" autoReverse = "true" >
    < s:Parallel >
    < s:Parallel target = "{bitmapimage1}" >
    < s: Fade duration = "250" / >

    < / s:Parallel >
    < s:Parallel target = "{bitmapimage2}" >
    < s: Fade duration = "250" / >
    < / s:Parallel >
    < / s:Parallel >
    < / s:Transition >
    < s:Transition fromState = "over" toState = "low" autoReverse = "true" >
    < s:Parallel >
    < s:Parallel target = "{bitmapimage1}" >
    < s: Fade duration = "250" / >
    < s:Move autoCenterTransform = "true" duration = "250" / >
    < / s:Parallel >
    < s:Parallel target = "{bitmapimage2}" >
    < s:Move autoCenterTransform = "true" duration = "0" / >
    < s: Fade duration = "0" / >
    < / s:Parallel >
    < / s:Parallel >
    < / s:Transition >
    < s:Transition fromState = "low" toState = "over" autoReverse = "true" >
    < s:Parallel >
    < s:Parallel target = "{bitmapimage1}" >
    < s:Move autoCenterTransform = "true" duration = "250" / >
    < s: Fade duration = "250" / >
    < / s:Parallel >
    < s:Parallel target = "{bitmapimage2}" >
    < s:Move autoCenterTransform = "true" duration = "250" / >
    < s: Fade duration = "250" / >
    < / s:Parallel >
    < / s:Parallel >
    < / s:Transition >
    < / s:transitions >
    < s: states >
    < name s: State = "mounted" / >
    < name s: State = "over" / >
    < name s: State = "low" / >
    < name s: State = "disabled" / >
    < / s: states >
    < fx:Metadata > [HostComponent ("spark.components.Button")] < / fx:Metadata >
    (< s:BitmapImage source="@Embed('/assets/WolfMotive/Welcome_Mouse_Over.png')" resizeMode = "Scale" d: userLabel = "Welcome Mouse Over" includeIn = "down, more ' id = 'bitmapimage1' y.down =" 2"visible.down ="false"/ >"
    (< s:BitmapImage source="@Embed('/assets/WolfMotive/Welcome_Mouse_Up.png')" resizeMode = "scale" d: userLabel = 'Welcome Mouse Up' visible.over = "false" id = "bitmapimage2" x = '4' y = '9' y.down ="11" / > "
    < / s:Skin >

    I need to know where this (if possible) will make the button link - that's what someone told me

    So, you could do the following:

    < s:Button click = "handleClick ()" / >

    Then, add a script block to your application, after < / fx:DesignLayer > and < / s:Application >, which looks like this:

    < fx:Script >

    <! [CDATA]

    protected function handleClick():void

    {

    navigateToURL ( new URLRequest ("" "http://www.adobe.com"), '_self');

    }

    ]]>

    < / fx:Script >


    So I lost as to where this should go in this section.

    Cause unless I am much more that a noob (that I might have), I'm not sure if she can go here at all.

    The original code has been implemented to go in this code-


    <? XML version = "1.0" encoding = "utf-8"? >
    < s:Application
    ' xmlns:fx = ' http://ns.Adobe.com/MXML/2009 "
    ' xmlns:d = ' http://ns.Adobe.com/FXG/2008/DT "
    xmlns:s = "library://ns.adobe.com/flex/spark".
    width = "720" height = "50" backgroundColor = "#000000" >
    (< s:BitmapImage source="@Embed('/assets/WolfMotive/Top_Menu_Bar.png')" resizeMode = "scale" d: userLabel = "From the top Menu bar" x = "-1" y = "-12" / > ".
    < fx:DesignLayer d: userLabel = 'Text Top mouse Ove' >
    < / fx:DesignLayer >
    < fx:DesignLayer d: userLabel = ' text Top Up Mouse ">
    < s:Button "583" = x y = "12" skinClass = "components. Button5"d: userLabel = 'Button Contacts' / >
    < s:Button '433' = x y = "12" skinClass = "components. Button4"d: userLabel ="Portfolio button"/ >
    < s:Button '303' = x y = "12" skinClass = "components. Button3"d: userLabel ="Projects button"/ >
    < s:Button = "154" x = "12" skinClass = "components. Button2"d: userLabel ="Button Bios"/ >
    < s:Button = "27" x = "12" skinClass = "components. Button1"d: userLabel ="Button welcome"/ >
    < / fx:DesignLayer >
    < / s:Application >

    Please help... once again.

    Perfect, ensuring of the OK.

    If you really want to continue working in the file of the application, with all the buttons.

    On each button, you want to add the 'click = handleClick ('http://www.adobe.com') '. (Make sure that the url is in single quotes)

    Where you replace: www.adobe.com with what URL you wish to navigate.

    For example, you can have the second button: "one click = handleClick ('http://forums.adobe.com')".

    Then, you change your function handleClick, in the block of script as follows:


      protected function handleClick (myURL:String): void
    {
    navigateToURL (new URLRequest (myURL), '_self');
    }

    ]]>

    Gives it a try and let me know how it works for you!

    Thank you

    Tara

  • Script to spell the state abbreviations

    Is there a script to make explicit the state abbreviations? For example, to change that in California and so on.

    The link in this thread is broken. Try it live:

    http://www.InDesignSecrets.com/downloads/forcedl/stateAbbreviations.jsx

  • Make the script shell on command 'srvctn '.

    Hi all

    Hello.

    I want to make the Shell Script on srvctn command,
    research work is not state of the node.
    I'm using the 11g environment.

    For example by using the command "srvctl start database-d."
    showing as follows.


    *******************************************
    example of order <>

    $ srvctl status database-d RAC
    RAC1 instance is not running on the node collabn1
    RAC2 instance is running on the node collabn2
    *******************************************


    As described below, I want to exit
    the is not running on the node list.

    *******************************************
    example of <>output

    collabn1
    collabn3
    collabn5
    *******************************************

    Could you please tell any person or to the statement above, out of shell script?

    I'm grad to send the response.

    Thank you and best regards.

    Hello

    you could do something like the following:

    #!/bin/sh
    
    srvctl status database -d RAC | grep 'not running' | sed -e 's/^.* node //'
    

    and this will give output like that in your example.

    Since you could easily expand your script to actually pronounce on the nodes does not.

    HtH
    Johan

    Published by: Johan Nilsson on December 20, 2011 02:57

  • Help make the text visible so click on the button

    Hello

    I am new to livecycle designer and have very little experience with scripts.

    That's what I want to do:

    I inserted a button on a form. When the button is clicked I want to make a text box read-only containing information useful and visible.

    I don't know about the editor script etc and my form is saved in a dynamic form - I don't know what script to write!  Previously, I managed to make a visible text box when a box is checked, but so far I could not find how to make the text appears when a button is clicked: it's the syntax with which I struggle. Any help is appreciated!

    Thank you very much.

    It comes to FormCalc on the click of the button or checkbox:

    If ($.rawValue == 1) then

    TextField1.presence = "visible".

  • script to make button play mp3 from 01:00 instead of 0:00?

    y at - it a line of script that I can add to make a button open an MP3 from 01:00 instead of beginning? in the box of javascript code for the button that opens the multimedia file, I found the following: / * Player = var * / app.media.openPlayer ({}
    / * events, settings, etc. * /.
    });

    Answered here.

Maybe you are looking for

  • CDs ripped/imported all missed the first song.

    I only bought my iMac Friday last week; and I hate it already. When I copy a CD in the library he adds to the library without the first song of each CD. the first song is sometimes in an album of his own, and iTunes will not let me merge. No Apple kn

  • (Re) Enable Intel Rapid start technolgy (RST) &amp; RAID @U310

    Dear community, I've been frustrated about it since a long time. Got U310 with win8 (24 GB SSD + 500 GB HDD). No one said I should set RAID in the BIOS. But I got only error and cannot perform a recovery. So I put back to the mode of DCIS and system

  • Driver for original Xbox controller in x 64 premium

    original title: controller x 64 premium Xbox Original I searched everywhere for a suitable driver for my xbox controller (the mini MS) ive tried several things and none have worked. I am running W7 x 64 pemium and it dosent recognize the controller.

  • Cisco IOS SSL VPN does not-Internet Explorer

    Hi all I seem to have a strange issue of SSL VPN.  I have a Cisco 877 router with c870-advsecurityk9 - mz.124 - 24.T4.bin and I can't get the SSL VPN (VPN Web) works with Internet Explorer (tried IE8 on XP and IE9 on Windows 7).  When I go to https:/

  • Is there a calculator in adobe?

    Is there a calculator in adobe?