Attaching Scripts to Buttons

I have a button displayed as Zoom In in the Basket panel:
HERE
When I attach this script to the button:
on (release, keyPress "<Space>") {
gotoAndPlay(2);
The mouse release works fine but when I try the keyboard for
keyPress, nothing happens. Anyone got any ideas as to what I am
doing wrong?

hi,
i think handling keyboard-input works different ->
1. there is (as far as i know) no Event "keyPress" (they are
"onKeyDown" and "onKeyUp")
2.You´ll first have to create a Listener-Object which
has functions "onKeyDown" or "onKeyUp" or both:
var objListener = new Object();
objListener.onKeyDown = function(){
if(Key.isDown(Key.SPACE){
// do whatever
3. You have to register that Obj as Listener to the Keyboard:
Key.addListener(objListener);
that should do.
cheers,
tom

Similar Messages

  • Error in action script and button

    I have a page that i have designed for practice. i have three
    buttons on each page and have been tring to get them to link to the
    proper page/frame. For instance the button for ABOUT US should link
    to the second page/frame. The code i am using is as follows.
    on (release) {gotoAndStop(2);
    This should have it go to page/frame 2 and stop but when i
    test it it gives me this error.
    Scene 1, Layer 'about', Frame 1, ... 1087: Syntax error:
    extra characters fou... on (release) {gotoAndStop(2);
    I am using action script 1.0 & 2.0. I am not sure what to
    do.

    The way that this function is written, on (release), it
    should be
    directly attached to a button or movieClip instance. However,
    the
    gotoAndStop(2) command is telling the button or clip to go to
    frame 2,
    not the main timeline. If you change that line to
    _parent.gotoAndStop(2), you'll get the playback head on the
    main
    timeline to move, not the playback head in that button or
    clip.
    A far better method is to assign instance names to each
    button or
    movieClip that you want to react to actionscript. Then you
    can write the
    function(s) for those instance names. You would write the
    actionscript
    to a frame instead of directly on the button or clip. This
    makes the
    actionscript much easier to find when you need to edit.
    So, for instance, you could then write a set of functions to
    move the
    playback head. Something like this:
    // we'll assume that the buttons are named button1, button2,
    button3
    button1.onRelease = function() {
    gotoAndStop(X);
    button2.onRelease = function() {
    gotoAndStop(Y);
    button3.onRelease = function() {
    gotoAndStop(Z);
    // where X,Y and Z are the frame numbers that you want to
    move to
    // you don't need an explicit reference for the timeline for
    the
    playback head to use here. The code and the objects are all
    on the same
    timeline.

  • KEEPING the ACTOR but DELETING the attached SCRIPT on ENTERFRAME

    Hi, new in this forum.
    Lets put it that way...On frame 50, I've got on the score 25
    buttons that are handled by 25 different(but similar) property
    scripts. These buttons could be enabled(checked) or unchecked. Now,
    when i'm going on frame 100, I compile in a linear list all the
    sprites that have been clicked. Then, using those sprite numbers,
    i'm trying to keep the actor(button) on the scene(score) on their
    checkep state, but i want that the checked buttons would be now
    impossible to click for the user. (like once you've clicked and
    pass the frame 101, the state of the button won't change even if
    you click on it.
    Please find here an example of a script that is attached to a
    button in the Attached Code.
    Thank you for helping me...kind of a big headache for
    me.

    Sorry, don't have time to read through all your code, but
    what you want
    to do sounds pretty simple. If I understand you correctly,
    simply set a
    global variable in frame 100 to tell the other sprites
    they're no longer
    active. Something like this for your frame script:
    global gclickable
    on exitFrame me
    gclickable = false
    end
    Then in each button have it look for that same global
    variable.
    Something like this:
    global gclickable
    on mouseUp me
    if gclickable = true then
    do whatever you want here
    end if
    end
    Then you'd just need to remember to set gclickable to true up
    near frame
    50 so that the buttons would actually do something when you
    wanted them to.
    Hope that helps.

  • Making 'attach to email' button as a hyperlink has disappeared in acrobat X pro

    hi
    I have upgraded to Acobat X pro from Acrobat 8 (CS3). I make brochures in indesign and then add some buttons in acrobat that can't be done in indesign. One button I nake is a 'attach to email' button. I can no longer see this option in create a link/custom link/actions/add
    can someone please advise how I can still do this as my client still wants this button on the back page of all their brochures so they customers can easily pass the brochure onto someone else

    no, this is not what I need
    Your screen dumps are to show where you can attach a pdf to an email from the file menu in a pdf. This is not what I want
    I use the draw a button using the 'link' tool in acrobat
    this tool opens a dialogue box called create a link and I choose
    custom link which opens another dialogue box and I choose
    the action tab, selct an action 'add' and choose from the options here except pro x has had the 'attach to email' action removed
    I need to get this in order to make a button on the pdf that a customer can click and then send the pdf to an email address that they enter

  • How to know the program attached to each button ?

    Hello,
    When I press on various buttons in SAP various ABAP programs/functions are launched/executed. How can I know the name of the program/functions that is attached to these buttons? I want to debug through these programs/functions because they have functionalities similar to the ones I want to implement so I want to get access to these ABAP programs but how?

    Hi,
    You can debug and identify..
    Before pressing the button..Press /h in the command field to start the debugger..
    Then press the button..
    It will take you in the degugging mode..
    Thanks,
    Naren

  • I have five buttons with audio attached to each button. When I publish in html5 and test the buttons the audio cuts out at random times. Any suggestions. I have the latest version of Adobe Captivate 7

    Can someone please help me with this problem I cannot see how simply attaching audio to a button can be so problematic. I have no idea how to fix this.

    I am using CP8 and have found similar issues. When using the responsive project, my slides with multiple buttons have audio attached via advanced actions that will cut out if a user attempts to click another button before the first has finished playing. When the user listens to the entire audio file attached to the button, there are no issues with audio btw. I have tried attaching it to the button, but it plays when the button appears rather than on success. Furthermore, setting it to play audio on success is a problem because there are multiple actions that must be completed for each button. I have also found that setting audio any other way besides through advanced actions can create an audio overlap of more than one audio file. I haven't been able to find a way to time the advanced action or slide so that the user cannot click through the buttons without hearing all of the audio first.
    Any ideas on how to get around this problem would be fantastic if it doesn't require an entire rewrite. If I wasn't already 86% through the course development, I would use buttons to initiate branching scenarios which would fix a lot of my issues, but don't want to start over at this point.

  • Script single button to play frames, then skip some, and continue play?

    Just as the topic says, I want to script a button to go to
    and play through a motion tween, but then skip some frames to then
    play another motion tween all in one button press. For example,
    play frame 1 which plays the tween and ends at frame 10 (I have
    that part down fine) but then for it to skip ahead to continue to
    play frame 20 and then of course stop once it finishes that motion
    tween.
    Tried a few searches but its too many words to explain so I
    wasnt finding anything. Its probably a simple command im just not
    familiar with yet. Can anyone help?

    I probably should have been more specific. I cant add
    anything to the timeline because I have multiple buttons using the
    first tween, which is a fade out. Thats why I need a script to add
    to each button only to play through that first common tween, and
    then skip to play an individual tween set for each button. Like
    button 1 goes through the first common tween, a fade out (plays
    frames 41 - 53) and its individual tween is frames 54 - 66. This
    works fine of course because the tweens are next to each other.
    Button 2's individual tween starts on frame 67, so it needs to play
    through the common tween fade (41 - 53) skip Button 1's frames, and
    continue play on 67. These buttons are located on frame 1 (main
    menu) so is it even possible to script a button to do such a thing?
    I figured there would be but nothing im trying or seeing online is
    working. Heh... does this make sense? :o
    The only other way I know it will work is if I copy and paste
    all the information in the layers before each section but that
    causes me to have to push a lot of information further down the
    timeline, kinda making a big mess and causing me to rescript all
    frames there.

  • [svn:fx-trunk] 5579: Be consistent with the scripts for Button sample

    Revision: 5579
    Author: [email protected]
    Date: 2009-03-26 11:06:44 -0700 (Thu, 26 Mar 2009)
    Log Message:
    Be consistent with the scripts for Button sample
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/flex4/asdoc/en_US/mx/components/examples/FxButtonExamp le.mxml

  • Attaching sound to button

    Hello, am entirely new to java .I pick up an interest sometimes last year and had been willing to produce my first set of work on a project but i dont seem to know what to do.
    I want to attach sound to button 0 - 9 in my project, can anyone help me with what to do please!
    Am eagerly awiting all suggestion.
    Regards
    Temi

    check out Java Media Framework (JMF) to play music.
    attaching sound to button?
    do you mean play the sound when user click on the button?
    if so, attach an ActionListener to the button and use JMF to play your music file.
    here's an example to help you get started:
    JButton mediaButton1 = new JButton("Media 1");
    mediaButton1.addActionListener(new MediaButtonListener());
    class MediaButtonListener implements ActionListener,  ControllerListener{
        public void actionPeformed(ActionEvent e){
            // you should kick this off in a separate Thread
            Player player = null;
            MediaLocator media = new MediaLocator("file:" + "mySound.wav");
            try {
                player = Manager.createPlayer(media);
                player.addControllerListener(this);
                player.realize();
            catch(Exception e) {
                e.printStackTrace();
                System.exit(1);
        public synchronized void controllerUpdate(ControllerEvent evt) {
            if (evt instanceof EndOfMediaEvent) {
                System.out.println("Play finished");
            else {
                System.out.println(evt.toString());
    }

  • Enable/view subs - pre-scripts or button properties?

    You have a number of ways in DVDSP to enable/disable subtitles for a Track.
    Mostly, I use SetSystemStream in a pre-script for a Track, and then I use SPRM8/GPRM5.
    But, given that you have separate buttons (play with subs, play without subs) you can also use button properties for the subs.
    Somewhere way back, I was told by HalMcLean that pre-scripts sometimes can cause problems - but I don't remember if that was particularly with subs or rather other parameters.
    What way would you guys go? Script or button?

    Hal,
    Nice to see you again.
    So, what do you suggest? Setting the subs in the button properties, or rather use a script with a jump to the Track (where you set the system stream before the jump)?
    For this qick job I actually used a pre-script in the single Track (systemstrrem sub on/off) and it seemed to work fine in both Simulator, Apple DVD player and three different hardware DVD players.
    Fingers crossed....

  • Attach script to a button/tool

    I accidentally posted this in the photoshop list. oops. anyway...
    I have several scripts that I use all the time and I was wondering if I
    could create custom buttons/tools that would execute these scripts,
    rather than going through the file>scripts menu?
    sam

    No, not like in InDesign, for example.
    The workaround is to include the scripts inside an action, but then - as a special service - you will lose the scripts in that action as soon as you quit and relaunch Illustrator.

  • Problem with action script to button

    Hello all.
    I'm having a problem with my adobe flash CS3 action script. My button cant link to the other URL. I tried to put an action script but i fail. anyone can help me? here the attachment for my flash document.

    HELLO,
                  just check       navigateToURL()

  • Need help placing tracking script on button click

    Howdy.
    We're trying to track the button clicks on a landing page we're producing. I've got the "landing page" script in the header via the page properties but now I need to put script on a button that fires when the person clicks the button. Any help would be greatly appreciated!
    website: maysweb.tamu.edu/open-enrollment
    script:
    <script type='text/javascript'>
    // Conversion Name: Finance & Accounting - Non-Finance Managers button
    var ebRand = Math.random()+'';
    ebRand = ebRand * 1000000;
    //<![CDATA[
    document.write('<scr'+'ipt src="HTTP://bs.serving-sys.com/Serving/ActivityServer.bs?cn=as&ActivityID=1&rnd=' + ebRand + '"></scr' + 'ipt>');
    //]]>
    </script>
    <noscript>
    <img width="1" height="1" style="border:0" src="HTTP://bs.serving-sys.com/Serving/ActivityServer.bs?cn=as&ActivityID=1&ns=1"/>
    </noscript>

    Anyone got any ideas on this?

  • The attach a file button (in netzero e-mail) does not work in firefox but does in explorer

    The "attach file button" (in net zero e-mail) does not work in firefox but does in explorer.
    == URL of affected sites ==
    http://

    *Tools > Options > Privacy > History: Firefox will: "Use custom settings for history"
    *Tools > Options > Privacy > History: "Remember search and form history"
    See also [[Form autocomplete]]

  • Possible to Parse on(...) Script in Buttons ?

    Hi everyone,
    I've a "little" Problem that goes beyond my ActionsScript 2 Knowledge so I hope anybody has an Idea or can confirm that what I need to do isn’t possible.
    I got an existing Flash-Project written with ActionScript 2 in this Project is a Graphic with lots of Buttons on it. Each Button has "on(...) {}" Script's assigned, in this Script are "getURL"-Functions that call JavaScript and within that JavaScript-Function-Call (a String passed to getURL) the JavaScript Function get's an ID as Parameter.
    Now, I ‘am supposed to write a Script that "walks" recursively trough this Flash-Project and collects all these ID's that are Parameters of the JavaScript-Function-Call.
    So what I've done so far is a Function that can recursively walk through the Flash-Project and find every Button this way. But now I don't know (and don't think it's possible) how to get the ID out of the JavaScript-Function-Call.
    To get you in the Picture, here is an Example Code that is associated to one of these Buttons:
    on(release) {
    getURL("javascript:do_something_with_id(275)");
    My Script knows that Button but, I don't know if I can somehow find out that there is a "275" as ID.
    Any Ideas or at last a "This is not Possible" ?
    greetz b.Schreiber

    Not really but you can combine text and images on pages in the book tool or in a pinch use the local adjustment brushes to "draw" rudimentary things via radical exposure or curves adjustments.
    RB

Maybe you are looking for

  • The project could not be prepared for publishing because an error occurred.

    I have just loaded iLife 09 on my MAC. I've edited a movie and now want to export it, put it in iTunes, whatever I can do to move it beyond my laptop. No matter what option I choose under Share I get the same error message, "The project could not be

  • SQL Server 2012 with SP1 on Windows 8.1 Pro

    Can I install "out-of-the-box" SQL Server 2012 with Service Pack 1 Enterprise Edition or SQL Server 2012 Developer Edition on my Windows 8.1 VM? Thanks.

  • Upgrade 9i to 10g Performance Issue

    Hi All, DBA team recently upgraded the database from 9i to 10g (Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi). There is a process as follows Mainframe --> Flat file --> (Informatica) --> Oracle DB --> (processing through SPs) -->

  • How do you confirm the hard drive speed

    I am trying to confirm my hard drive speed.  I have looked at "about this mac" but can't seem to find it.  New MBP 15 inch running Lion

  • Adobe - Triggering workflow in ABAP

    Hi, From the Adobe offline form - submission I want to trigger a workflow in R/3 system. I also want the same adobe form to be sent as an attachment. so that after checking the workflow the key user can edit the form and resubmit it again which will