Actionscript 1 to 2 button reverse

Hey guys, i found some nice code on AS1 to use with my Button and MC.
Basically
the MC doesnt play when mouse is not on button
when mouse over button i want the MC to play. (only once then stop)
when mouse off button i want the MC to play in reverse. (and stop when its back to the beginning)
(btw both the MC and Button are in a movie clip - as i need to make many of them)
the code is in AS1 and doesnt seem to work in AS2 which is where i need it.
Maybe someone can see whats wrong and convert parts for me or give me a new code
code for button:
on (rollOver) {
mc1.goBack = false;
mc1.play();
on (rollOut) {
mc1.goBack = true;
code for MC:
onClipEvent (enterFrame) {
    this.rewind();
code for actions layer:
MovieClip.prototype.rewind = function () {
if (goBack && (_currentframe>1)) {
gotoAndStop (_currentframe-1);
thanks i really need this code!!!! appriecate any1s help =)

remove code from your button and assign your button an instance name, say btn:
btn.onRollOver=function(){
mc1.onEnterFrame=function(){
this.nextFrame();
if(this._currentframe==this._totalframes){
delete this.onEnterFrame;
btn.onRollOut=function(){
mc1.onEnterFrame=function(){
this.prevFrame();
if(this._currentframe==1){
delete this.onEnterFrame;

Similar Messages

  • Call stack buttons reversed in CVI 13

    I just noticed that the call stack buttons in CVI 13 are opposite from CVI 12.  When I hit a break point in CVI 12, the Up Call Stack button is selectable and will take me "up" the stack to the function that called the function with the breakpoint.  In CVI 13, when I hit a break point the Up Call Stack button is dimmed.  Clicking on the Down Call Stack button takes me "up" the stack to the previous function.  In other words, their functions are exactly reversed from previous versions of CVI (and opposite to how I think they should be defined).  Is this on purpose, or did my installation get messed up somehow?
    Tony G
    Solved!
    Go to Solution.

    Hi Tony,
    The short answer is this is on purpose. It was decided during developement to change the behavior of the Up/Down Call Stack menu items. A full list of behavior changes in LabWindows/CVI 2013 can be found in this white paper:
    http://www.ni.com/product-documentation/51877/en/
    The reason for the change is to be consistant with how we display the call stack in the Variables and Call Stack window. 
    Steven

  • ActionScript not working for buttons

    I tried making a button in Flash 8 and then I click on the
    button and go into actions and it works fine. But in Adobe CS I
    make a button, click on it and go to actions and all of the
    timeline controls are blanked out. Even if I drag a generic button
    from libraries and try to add actions it won't let me.
    Can anyone help?
    Thanks.

    I'm afraid attaching code to buttons was against
    best
    practice in AS2, and is
    no
    longer available in AS3.
    Have a look at the help - Programming ActionScript 3.0,
    Getting started with ActionScript. The Animation portfolio piece
    introduces buttons.

  • Cancel and OK button reversed?

    In iTunes for Windows, version 12.1.10.71, in the Get Info widget, the Cancel and OK buttons have exchanged place. I am not exactly sure which version I ran before this one, but I am a regular updater.
    This seems to me a change just to annoy regular users.
    Any comments?
    TIA,
    Bart Zorn

    This illustrates the inconsistency - Get Info window from iTunes 12.0:
    and from iTunes 12.1:
    Among the other layout changes, the OK and Cancel buttons are reversed.

  • ActionScript 2 issues: previous button not working

    Hello,
    I am trying to create a slideshow in Flash CS4 using ActionScript 2.
    I have imported "pause" and "play" buttons from the libraries, and I have created "next" and "previous" buttons by using the PolyStar tool.
    Here is my problem: The "previous" button is not working. However, the other buttons (even the "next" button, which only really has the opposite code) do work.
    I am writing all of my code in the frames, which probably isn't the best idea, but it would be hard for me to change now.
    Code (an example code frame)(currently on the 1st frame):
    prev.onPress = function(){
    gotoAndStop("14");
    begin.onPress = function(){
    play();
    pause.onPress = function(){
    stop();
    next.onPress = function(){
    gotoAndStop("2");
    previous.onPress = function(){
    gotoAndStop("14");
    "prev" is an instance of "previous". "begin", "next", and "pause", are instances of a play button, "next", and a pause button. I am using frame labels that go from "1" to "14".
    What am I doing wrong?
    feffer1218

    Thanks for your advice, but it didn't work.
    1. I changed all of my frame labels so that they have the letter "p" in front of all of them. (ex: "p1" instead of "1")
    2. I commented out the "previous.onPress" code.
    2 examples of code:
    //p1 (first photo)
    prev.onPress = function(){
        gotoAndStop("p14");
    begin.onPress = function(){
        play();
    pause.onPress = function(){
        stop();
    next.onPress = function(){
        gotoAndStop("p2");
    /*previous.onPress = function(){
        gotoAndStop("14");
    //p2 (second photo)
    begin.onPress = function(){
        play();
    pause.onPress = function(){
        stop();
    next.onPress = function(){
        gotoAndStop("p3");
    prev.onPress = function(){
            gotoAndStop("p1");
    I don't know what I'm doing wrong! The Properties window says that "prev" is an "instance of: previous."
    Any ideas? Thanks for the attempt, though.
    feffer1218

  • Actionscript to add to buttons to control flv

    Hi,
    I'm trying to create the following:
    1.A play button that plays an flv.
    2.A pause button.
    3.Actionscript that makes movie go to a certain frame on
    timeline when flv finishes playing.
    Any help with the actionscript for these will be much
    appreciated.
    Cheers

    here's the code
    var nsVideo:Netconnection = new NetStream(ncVideo)
    ncVideo.connection(null);
    var nsVideo:NetStream = new NetStream(ncVideo);
    nsVideo.play("video.flv");
    vFlv.attachVideo(nsVideo);
    var nDuration:Number = 0;
    mPlay.press = function():Void {
    nsVideo.pause(flase);
    mPause.onPress = function():Void {
    nsVideo.pause(true);
    mStop.onPress = function():Void {
    nsVideo.pause(true);
    nsVideo.seek(0);
    create buttons for play pause and stop

  • Actionscript 3.0 when button is pressed twice turns on/off

    Alright I am new at actionscript but what I wanna do is when my button it is pressed once it brings up my input text("hiddentext") and when its pressed again it will remove it.
    here is what I got.
    button1_btn.addEventListener(MouseEvent.CLICK, shoot_1);
    function shoot_1(event:MouseEvent):void
              gotoAndStop("hiddentext");{
    and shoot_1 is just the identifier to make them work together.
    Message was edited by: dogmer punchy

    A nice clean way of dealing with this is to put the text inside a movieclip and control the visibility of the movieclip with the button, toggling it to be the opposite of what it currently is.  If you were to assign an instance name to that movieclip like "hiddenText", the code for toggling it could be...
    button1_btn.addEventListener(MouseEvent.CLICK, shoot_1);
    function shoot_1(event:MouseEvent):void
              hiddenText,visible = !hiddenText.visible;
    The use of the " ! " tells it to be what it is not.

  • Trackpad buttons reversed

    I'm having a small problem with Magic Trackpad. Formerly, pressing down on the left side was a primary click. Pressing on the right side was the secondary click. Now they've been reversed in Lion.
    I don't see the prefs to change this in Lion. Any ideas?

    Look at the secondary click line. There is a drop down menu to select the left or right side.

  • Actionscript Help for Simple Button Events

    Hey everyone,
    I'm pretty new to flash and I think this is a fairly simple animation, but I'm not quite sure how to write out the action script for it. I have a website that has very similiar animations to www.cookstreet.net. I have shapes and text that fly in from the bottom when a button is clicked, but I want to get them to fly back out of the top of the screen when any other button is clicked before any new content loads back in from the bottom. What should I add to the action script to tell flash to first check and see if there is content loaded on the screen when a button is clicked, and if there is, to go to the animation that flies that content out of the top and then return to the animation of the new content coming in from the bottom? What I currently have set up for my buttons is:
    function handleClick( pEvent:MouseEvent):void
        if( pEvent.target == reel )
            gotoAndPlay("Reel");
        else if( pEvent.target == home)
            gotoAndPlay("Home");
        else if( pEvent.target == news)
            gotoAndPlay("News");
        else if( pEvent.target == film)
            gotoAndPlay("Film")
        else if( pEvent.target == about)
            gotoAndPlay("About")
        else if( pEvent.target == contact)
            gotoAndPlay("Contact")
    reel. addEventListener(MouseEvent .CLICK, handleClick );
    home. addEventListener(MouseEvent .CLICK, handleClick );
    news. addEventListener(MouseEvent .CLICK, handleClick );
    film. addEventListener(MouseEvent .CLICK, handleClick );
    about. addEventListener(MouseEvent .CLICK, handleClick );
    contact. addEventListener(MouseEvent .CLICK, handleClick );
    Thanks for the help!
    -Sofi

    What you can probably do is have a variable that you use to keep track of who's present on the stage, starting it off as a null value.  That way when you click a button if the value is null is skips processing a moving out scenario and jumps to the moving in one.  So your event listeners would be calling a different handler function that first takes care of the moving out needs, if any, which in turn calls the moving in function after the moving out activity is done (or the timeline for moving out does... I don't know how you plan to implement the moving out stuff).  If it is a functiob to function process, the moving out function could pass the event.target to the moving in function so that wouldn't have to change at all, except to add in somewhere wha the new variable value should be.
    If what I just offered is one big ball of confusion... take your time and inch your way thru it.

  • Num lock button "reversed"

    Hi. Ive only had my new macbook for five days. its been running fine untill this morning when i turned it on. i noticed that num lock was lit up so i just turned it off. anyway was trying to type and only the number buttons work, so put num lock back on and was able to type. caps lock works but does not light up. have tried restarting, removing the battery and resseting the pmu and nothing works. please help.

    Call Apple if you have only had it five days they can replace it. They have a 14 day return policy.
    Mort

  • Trying to simulate button click via ActionScript

    Hello,
    I've got code written to tell if a user is hitting his/her
    left or right arrow keys. I currently have a "next" button named
    realNext, and a "back" button named realBack. Both buttons have
    lots of code written in their on(release) functions. How can I
    utilize ActionScript to simulate a button click?
    Here's my code thus far:

    I have never had success **** this by calling the onRelease
    or onPress event functions. So to get around this I define other
    functions that do all of the work and then just use the onRelease
    and onPress event functions as callers.
    For example.
    button1.onRelease = myFunction;
    function myfunction():Void {
    // code goes here
    Now with this I can either press the button to ge thte code
    executed or I can "simulate" the button being pushed by just
    calling myFunction().
    Tim

  • Once I add my .swf to Dreamweaver, the buttons are not clickable, how can I fix this?

    Hello there,
    I'd just like to start out by saying that this is the first time I have posted on these forums, so if I have done anything wrong, I apologize!
    Anyway, about my question, just like the title says, once I import the .swf into Dreamweaver the buttons are not clickable, however when tested outside of Dreamweaver, they work correctly.
    Basically I have an animated banner with some audio and two buttons, the buttons mute and unmute the music.
    The file consists of two layers, one of which has 2 keyframes, the first keyframe has the Audio with the settings; "Effect: None. Sync: Start, Loop" and a button leading to the next frame.
    The next keyframe (still on layer one) has much of the same but the Audio settings are different; "Effect: None. Sync: Stop, repeat x 1" and this will stop the music.
    Now on the other layer (Rocket) I have a movie clip of a space-themed background and a rocket flying across it, the movie clip is made up of a motion tween and another movie clip which is the rocket.
    I am using Flash CS6 and Dreamweaver CS6 on a Windows 7 computer. I am also using Actionscript 2.0
    I apologize for the amount of information and I'm not very briliant at explaining things, so here are some images of the flash file, hopefully they'll help;
    Layer setup - http://i.imgur.com/iZHwfAw.jpg
    The movie clip - http://i.imgur.com/ayvPJUZ.jpg
    Keyframe one sound settings - http://i.imgur.com/LWbnQhO.jpg
    Keyframe two sound settings - http://i.imgur.com/7kS9dO2.jpg
    Actionscript for the first button/first keyframe - http://i.imgur.com/x6ROqPv.jpg   - (The second button/keyframe has the same code, but obviously the instance name and frame number has been changed)
    Again, I apologise if this all seems confusing!
    Thanks in advance for any answers to this question
    Adam.

    If you did not create this swf yourself then you won't be able to do what I am suggesting.  If you did, then open the fla in Flash and go into the Publish Settings and select the option to publish an html file as an output.  That will create an html page that embeds the Flash file.  Test that file in your browser and see if it plays properly.  IF so, then copy that code in place of whatever Dreamweaver did to embed the Flash.
    Dreamweaver is not a reliable tool for embedding Flash content... why it does not do it the same way Flash does it is anyone's guess.

  • Help with Re-Linking Navigation Buttons

    I have Adobe Flash CS3 Pro.
    I have a navigation header flash file that came with my website template and I am having difficulty making sense of the actionscript. It has a logo section with effects, 5 main nav buttons that move, and two extra link buttons above the navigation bar. Let’s focus on just the Navigation buttons for now. Here is what I have gathered. I have multiple text buttons on one movieclip, and I have successfully edited the text for each button. If I look at the actionscript in the top layer of this movieclip I see:
    “gotoAndStop(parent._parent.num);”
    I also have a separate movieclip symbol (with effects) with 5 buttons layers listed in the actionscript with the following actionscript tied to each button from numbers 1 through 5:
    onClipEvent (load) {
                num=1;
    onClipEvent (load) {
                num=2;
    onClipEvent (load) {
                num=3;
    onClipEvent (load) {
                num=4;
    onClipEvent (load) {
                num=5;
    On the top layer of these 5 buttons I have the following actionscript:
    stop();
    this["item"+_root.button].gotoAndPlay("s1");
    _root.link = _root.button;
    I also have a separate button symbol with the following actionscript:
    on (rollOver) {
                if (_root.link<>1) {
                            menu.item1.gotoAndPlay("s1");
    on (releaseOutside, rollOut) {
                if (_root.link<>1) {
                            menu.item1.gotoAndPlay("s2");
    on (release) {
                if (_root.link<>1) {
                            _root.menu["item"+_root.link].gotoAndPlay("s2");
                            _root.link = 1;
                            getURL("index.html");
    Now my website template came with 5 html pages that my flash navigation buttons correspond to: (index.html, index-1.html, index-2.html, index-3.html, index-4.html, index-5.html). My problem is that I have created new pages (index.html, about.html, featured.html, projects.html, contact.html). I would like each of the 5 buttons to correspond to these pages, not the existing standard “index-n.html” pages. 
    Also, this is probably not relevant, but each html page has something to this affect so I can see how they correspond to each button.
    <script type="text/javascript">
              var fo = new FlashObject("flash/menu_vf8.swf?button=2", "head", "100%", "144", "7", "");
              fo.addParam("quality", "high");
                        fo.addParam("wmode", "transparent");
                            fo.addParam("scale", "noscale");
              fo.write("head");
            </script>
    I guess my real question is: What actionscript do I need to update or remove for the nav button LINKS to work with my new html pages rather than the standard 5 index-n.html pages that it automatically wants to link to?
    When I try and add a “getURL” command to each of the 5 buttons and test preview the movie, the links work, but it messes up the effects of the movieclip. In other words, the buttons don’t move, they are motionless, however the links work. If I added this command to each button in some way, what actionscript would I need to remove so there weren’t any complications? I need some expert help here for it would be much appreciated. I am a novice with Flash script and its killing me that I can’t figure it out. I asked for help from the template support and all they came back with was the following message and it wasn’t helpful:
    You need to duplicate each button you are editing - it is very important.
    2) Update the scripting to look similar way:
    on (release) {
    if (_root.link<>num) {
    _parent["item"+_root.link].gotoAndPlay("s2");
    _root.link = num;
    if (num == 1) {
    getURL("index.html");
    } else {
    getURL("index-"+Number(num-1)+".html");
    Update it to:
    on (release) {
    getURL("http://www.google.com");
    Also, I read through the following discussion, which was helpful to a degree, but it still didn’t answer my questions about getting the links to work.
    http://forums.adobe.com/message/3614092#3614092

    First of all, thank you for showing interest and helping out in my dilemma here. I wish I understood your meaning behind “on” because with my luck there is probably some hidden way of placing script on an object that I don’t understand or haven’t discovered yet.
    This is what I know:
    I have multiple text buttons on one movieclip entitled “textbutton1” (see previous picture), and I have successfully edited the text for each button and created two extra frames/buttons to make 7 total. If I look at the actionscript in the top layer of this movieclip I see:
    “gotoAndStop(parent._parent.num);”
    But there is no action on each individual frame (all 7 of them) on that layer.
    Like I mentioned before I have a separate movieclip symbol (entitled “menu effect”) with 7 button movieclip layers listed in the actionscript with the following actionscript on each layer.
    onClipEvent (load) {
                num=1;
    onClipEvent (load) {
                num=2;
    onClipEvent (load) {
                num=3;
    onClipEvent (load) {
                num=4;
    onClipEvent (load) {
                num=5;
    onClipEvent (load) {
                num=6;
    onClipEvent (load) {
                num=7;
    On the top layer (layer 4 frame 25) of these 5 buttons I have the following actionscript:
    stop();
    this["item"+_root.button].gotoAndPlay("s1");
    _root.link = _root.button;
    I can upload another particular image of the movieclip/actionscript if it would be helpful. Let me know.

  • I can't seem to locate the text and buttons on a flash template I bought

    Hi Everyone,
    I have been working with this flash template I purchased online and can't seem to be able to change the text that is displayed on it's buttons except for the first one. There are four buttons to the side but I can only change the first button's contents as I see them in the "Library". I am new to Flash and learning. Please guide me as to where I can find the other components.
    I can only see and change "WorldWide" and "Call Anytime Anywehre" button.
    Flash source file posted here:
    https://docs.google.com/leaf?id=0B8tFparkP0rKMzliNTcxZDktYmQ3My00ZjJiLWFhMDQtNTEzNWExMWZlN Dgx&hl=en&authkey=CKrQwcwF
    I would also like to add a link to each button and I can't seem to locate the URL Link button. I am using Adobe Flash CS5.
    Much appreciated.    

    What I described is what your file involves.  In your library there is a "text" folder .  In that folder are movieclips named txt_1, and txt_2 which hold the text used in your buttons.  If you open those movieclips for editing you will see each has four frames with different text in each frame.  That is where you need to change your text for the buttons.
    If you look at the actionscript in the top layer of those movieclips, you will see how it uses a value assigned to the button/mc to determine which frame it displays....
    gotoAndStop(_parent._parent.num);
    And if you look at the actionscript applied to the button on the main timeline (select the button with the Actions window open), you will see how that num value gets assigned to each instance...
    onClipEvent (load) {
    num = 1;
    this.hitArea = this.area;

  • My apple wireless keyboard is not responding on all the buttons starting from esc up to the play and pause button,please can u help me on how to solve this problem

    The mission control,launchpad ,two brightness button,reverse &amp; play &amp; pause button are not working on my apple wireless keyboard,please help me

    Try resetting the PRAM (if you are able to do so).
    Otherwise, I would take it in for diagnosis.
    Barry

Maybe you are looking for