Simple actionscript code question

I have a project that I'm working and I'm new to actionscript 3.  Here is the code that I have on frame 1 and it works very well for a button.

import flash.events.MouseEvent;
Stop();

-Buttons

buy_btn.addEventListener (MouseEvent.MOUSE_OVER, buyROLL);
buy_btn.addEventListener (MouseEvent.MOUSE_OUT, redemption);

function buyROLL(event:MouseEvent):void {}
buy_mov.gotoAndPlay (2);
}
function buyOUT(event:MouseEvent):void {}
buy_mov.gotoAndPlay (15);
}

When I try to add several buttons like the code below, flash freaks out!  It does not stop even on the first image.  He plays straight through film.  I get these errors "scene 1, layer ' Layer 2', frame 1, line 20 1120: access of undefined property about_mov." and "scene 1, layer ' Layer 2', frame 1, line 23 1120: access of undefined property about_mov.»»»

import flash.events.MouseEvent;
Stop();

-Buttons

buy_btn.addEventListener (MouseEvent.MOUSE_OVER, buyROLL);
buy_btn.addEventListener (MouseEvent.MOUSE_OUT, redemption);

about_btn.addEventListener (MouseEvent.MOUSE_OVER, aboutROLL);
about_btn.addEventListener (MouseEvent.MOUSE_OUT, aboutOUT);

function aboutROLL(event:MouseEvent):void {}
about_mov.gotoAndPlay (2);
}
function aboutOUT(event:MouseEvent):void {}
about_mov.gotoAndPlay (15);
}

I'm doing this right? Is there an easier and more efficient way to do this?

Chances are that you don't have an assigned to the about_mov movieclip instance name.  When there is an error in coding in an AS3 file, erratic behavior you're seeing is normal.

Tags: Adobe Animate

Similar Questions

  • simple actionscript code question order

    Hello everyone. I'm just

    Learing actionscript. I can't find how to insert simple

    commands in my animations, like play() and stop(). I have to do something fundamentally wrong. One thing I noticed in the tutorials that I am studying, it's tutorials seem to be able to create a 'actions' layer and assign an actionscript command to individual images on the line of action of different clips.  When I try to do, I see the same script command action on EACH frame of the movie clip, and of course, the commands do not work.  I want my video to play until the last image and stop, without loop, but it loop just permanently.

    Anyone have any ideas what I am doing wrong?

    Thanks in advance!

    Yes, you must create a 'key' on this last picture image.

    then, return to this movieclip and remove the stop that you added. There is therefore no stop() at all in this timeline.  now, right-click on the last image of the Assembly of your movieclip and click 'insert a keyframe.  now, while this keyfame is still selected in your properties panel, type:

    Stop();

    Repeat the test.

  • button does not have a simple ActionScript code

    I created a new symbol - type of button. Then created a single frame in a timeline, there put my button and put a simple code in the frame:

    mybutt.onRelease = function() {}

    getURL ("www.google.ru");

    };

    So, I would open the url by pressing the button. But it does not work. Any ideas?

    Thanks in advance!

    in the timeline containing your button, click an empty part of the scene (or behind the scenes) and click the button.  on the left side of the properties panel, enter:

    tattoo

    to give your button an instance name corresponding to your code.

    If you have done this and your button still does not work, you probably have code attached to a parent of tattoo mouse Manager.

  • F8as2 - should be simple washer / cursor question

    F8as2

    Hi all

    Background:

    I have a slider / washer that works well and witnesses of the timeline of a movieclip back and forth.

    Lets say I have a movieclip of a bulb on stage which begins in a tour out of State.  When the movieclip broadcast the normally I frame based actionscript to turn a movieclip _on bulb.

    The problem:

    When I use the rubbed to go back into the movieclip based actionscript does nothing to activate the movieclip bulb rear _off...

    The Question:

    Can manage actionscript or do I use keyframes with two different graphics to have the light come on _on and _off?

    Thanks for your comments.

    you shouldn't have any problem with actionscript if you rub it in and after a frame that contains the script.  the script should run as long as the image plays.  If you can rub past actionscript code containing frame, the actionscript code will not run.

  • I can't change the Actionscript code

    I use Flash 5.0 and the difficulty to modify the Actionscript code.

    I can use the Actions of Frame dialog box to enter the simple Actionscripts, but I can't seem to find my way to a fully editable Actionscript. I go about it the wrong way?

    It was a while that I used Flash 5, but I think that in the top right corner of the Actionscript window is an icon with an arrow above. This allows you to select the "expert" mode I think that you can also type the shortcut: 'ctrl' + 'e '.

    I hope this helps!

  • CS4 Actionscript, loadmovie question

    Hi everyone, what is the script in CS4 to make a button to read a movie?

    I have a button that opens each page like a movie. To align the film, I use a blank film.

    I have been using the below... what replaces it in CS4?

    on {(press)
    blank_mc.loadMovie ("aboutus.swf");
    unloadMovie ("mainpagemovie");

    Thanks ScottyC

    Nothing can replace him in CS4.  This is the actionscript code 2, that CS4 will support as it is, so you just set your publication Flash settings based on AS2.

  • ActionScript 2 question: the Menu buttons not being endangered

    Hey everyone, I'm an intern who has been invited to take on a flash project. I have knowledge of HTML, but it's my first flash project, and I think that I am way over my head. I followed a tutorial explaining how to make the menu buttons and I realized that the ActionScript for a menu drop-down should work for what I'm trying to do.  So I finally have everything I want, but I'm sure I've lost some code in there.  Now, my problem is when I play my flash and move my mouse really fast on the flash object sometimes two menu buttons appear. I'm sure it's because of the ._alpha > 0 code that I use, but I don't know another way around it. If you have any advice please! Here is a link to the swf file. http://www.rumeryrefinishing.com/MVS%20Flash%20Project.html

    This is the code (for the two buttons) I use something do disappear when I roll another button:

    calplate_btn.onRollOver = function () {}
    If (scan_large._x > startX) {}
    myTweenB.stop ();
    myTween2.stop ();
    scan_large. Enabled = false
    scan_large._alpha = 0
    scan_large._x = startX
    }
    If (scan_large._alpha > 0) {}
    myTweenB.stop ();
    myTween2.stop ();
    scan_large. Enabled = false
    scan_large._alpha = 0
    scan_large._x = startX
    }

    calplate_large.enabled = true;
    myTweenA = new Tween(calplate_large,"_alpha",Regular.easeOut,0,100,6,false);
    myTween1 = new Tween(calplate_large,"_x",Regulare.easeOut,startX,startX+10,6,false);
    }

    __________________________________________________________________________________

    scan_btn.onRollOver = function () {}
    If (calplate_large._x > startX) {}
    myTweenA.stop ();
    myTween1.stop ();
    calplate_large. Enabled = false
    calplate_large._alpha = 0
    calplate_large._x = startX
    }
    If (calplate_large._alpha > 0) {}
    myTweenA.stop ();
    myTween1.stop ();
    calplate_large. Enabled = false
    calplate_large._alpha = 0
    calplate_large._x = startX
    }

    scan_large.enabled = true;
    myTweenB = new Tween(scan_large,"_alpha",Regular.easeOut,0,100,6,false);
    myTween1 = new Tween(scan_large,"_x",Regulare.easeOut,startX,startX+10,6,false);
    }

    __________________________________________________________________________________

    In addition, if it's not too much trouble, please let me know if I can compress the actionscript code!

    in the overthrow of scan_btn you have:

    myTween1 = new Tween(scan_large,"_x",Regulare.easeOut,startX,startX+10,6,false);

    What's supposed to be:

    myTween2 = new Tween(scan_large,"_x",Regulare.easeOut,startX,startX+10,6,false);

  • Help with a simple break-code function

    For a week I tried to understand a simple break-code function fror AS 3.0. I need something that makes a break as a code of a set amount of time. People have tried to help me on this forum, but I have not always been able to make the code work.

    Here's what I have in this moment of pause-code (does not work):

    var intID;
    intID = setInterval (delay, 3000); This tells flash to wait 3 seconds
    delay() {} function
    clearInterval (intID);
    _root.gotoAndPlay (1); or do something else...
    }

    The person who provided me with this code did not include the first line 'var intID', but as a new user of flash, I wasn't sure how else to declare intID. Could someone with some flash experience to guide me through the steps of creating a pause-code function or add to what I have already provided. When I use the code above in my flash document, the pause feature does not work. Essentially, he jumps on the setInterval and clearInterval functions only and cheek element root in delay(). I need code for AS 3.0 and I'm getting more and more desperate for an answer.

    I hope it's understandable and I thank you for taking a peek
    Sam

    This isn't code as3.

    Use the timer class to delay the execution of code in a function.

  • Simple problem: ActionScript Code for & quot; Permutation of & quot; a SWF file?

    Easy problem, I think. I'm doing a site simple, purely based on Flash. Is it all the same to us will tell onClick change the .swf and load another without busting on a different page?

    For example, when you visit www.mydomain.com/index.html, you see home.swf. Then, in the toolbar in the .swf, you click a "Download" button, replace home.swf by downloads.swf, it allows you to stay on index.html.

    I guess it would be simple, but Google shows up zilch.

    {We (Release)}
    loadMovie ("movie.swf");
    }

  • Question simple Actionscript timeline

    I have a 100 images. I want each image to have the measures applied for example... I want a stop action and then each of them to exercise a function (the function is a script that updates image is on in a dynamic text box). Is it possible to apply it to each of the place of withouth 100 images on each image. I hope that makes sense.

    I have the action on the first frame. To get everyone to stop; I put the stop on each image. I don't know there must be a quicker way less tedious.

    Thanks in advance.

    Luke

    I would not recommend use onEnterFrame for something like that... It's better to just hard try and fix the code for executives. with onEnterFrame running your entire movie is going to hurt its performance.

  • How to find the actionscript code?

    Hello. This seems like it should be a simple enough question, but I can't understand it. How can I find the actioscript associated with a movie clip button in a model? I want to make changes to the actionscript, but I can't. I have a MacBook Pro.

    Thank you - Catherine

    Look in Control Panel actions.   You can find a number of things using the movie Explorer pane.

    but I have yet to see a model that was other than anything a non mixed disorder clearly created by someone who has no idea how to program or is competent but intentionally created a mess to prevent others to modify it.

  • reffering flex simple actionscript effects

    Hello everyone I have 2 question

    1. How can I check if the object is exist?

    {if (is_boject (MyItem))}

    trace ('true')

    }

    2.

    I'm looking for a way to cause element to bend the real effect simple script

    < mx:Parallel id = "eleves1" >

    < duration mx:Zoom = "200" zoomHeightTo = "1" zoomWidthTo = "1" / >

    < / mx:Parallel >

    < mx:Script > <! [CDATA]

    public void itemOver(event:MouseEvent):void {}

    the correct code instead of the following

    myItem.pleaseDoMyEffect ('over1')

    }

    []] > < / mx:Script >

    Thank you!

    1. Try this:
        if(myItem){
            trace('true');
        }
    
    2. Try this:
        over1.play(myItem);
    

    If this post answers your question or assistance, please mark it as such.

    Greg Lafrance - Flex 2 and 3 certified ACE

    www.ChikaraDev.com

    Flex / development, training, AIR and Support Services

  • Helps the good implementation of my actionscript code.

    http://goodielcreative.com/test.html

    Above is a link to the project I'm working on.

    I have some problems with it, but the one that concerns me now is correctly implemented in actionscript.  To be more specific the text Dynamics field functionailty on this page.

    It works great when you click on a graph in the lower right part of the screen, he spits on the correct information and this is like file/code that gets to work:

    package {}

    import flash.display.MovieClip;

    import flash.events.MouseEvent;



    /public class WoodBaluster extends MovieClip { }

    var balusterNumber:String;

    var balusterName:String;

    ; var

    var stringManip1:String;


    public void WoodBaluster() { }

    this.buttonMode = true;

    this.addEventListener (MouseEvent.MOUSE_DOWN, onDown);


    }

    private void onDown(event:MouseEvent):String { }


    MovieClip (root).stairStage_mc.wood2Balusters1_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters2_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters3_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters4_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters5_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters6_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters7_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters8_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters9_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters10_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters11_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters12_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters13_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters14_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters15_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters16_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters17_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters18_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters19_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters20_mc.gotoAndStop (event.target.name);

    MovieClip (root).stairStage_mc.wood2Balusters21_mc.gotoAndStop (event.target.name);

    eventName = event.target.name;

    stringManip1 = eventName.substring (0, eventName.indexOf ("_")); //get the front part of the _

    balusterName = stringManip1.substr (0.2) + "-" + stringManip1.substr (2); //insert has - between the first two characters and the rest

    If (MovieClip (root).stairStage_mc.currentFrame == 1)

    {

    balusterNumber = 'Two baluster';

    }

    ElseIf (MovieClip (root).stairStage_mc.currentFrame == 2)

    {

    balusterNumber = 'Three baluster';

    }

    . Selection_txt.text MovieClip (root) = 'Wood, station to station',

    . Selection_txt.AppendText MovieClip (root) (balusterNumber + ",");

    . Selection_txt.AppendText MovieClip (root) ("using the" + balusterName + "Baulsters");

    return balusterName;

    }


    }

    }

    You start with two baluster and then click a column and fills the text field. Works like it's supposed to. same thing if you click three baluster and then click on a chart to a column he fills the text field correctly.  How ever my question is by clicking on two or three buttons baluster must also fill out the text field where "Baluster two" or 'Three baluster' is not just once the chart of the column is selected.

    I tried a number of different things but encountered a brick wall. Can be so I'm back to her that I'm more thinking that he or I don't have the skills to think of a solution.

    you have only defined this method of onDown() for instances of WoodBaluster.  If 'two or three buttons baluster' are not cases of WoodBaluster, not expected your code to do anything.

  • Definition of hideEffect/showEffect in ActionScript code

    I can't find a way to set the "effects" of any UIComponents in code.

    In mxml, it is a simple matter of definition of the attribute and the value as follows:
    < mx:Image hideEffect = "someEffect" / >

    But as the compiler complains with
    image.hideAffect = someEffect; (it is said of property not defined).

    I guess they are called "behaviors" and can be set in ActionScript behaviors, as if they were 'styles '.

    image.setStyle ("hideEffect", someEffect); actually works.

  • OTP-S590 remote code question

    Just set up my S590 and it works very well.

    I have connected the S590 to my stereo system to Sony DAV - FC7 (via composite) for which I lost the remote control.

    The remote control for the media player that I used until I'm the S590, who was a Philips DVD player with USB connection, allowed me to control the levels of the audio output of the player. This is possible using a custom firmware.

    Now the remote S590 has a volume knob and I have a few questions:

    1. can I program the remote S590 to control the volume of the composite output of the S590 itself?

    2 of universal remote would. what type you recommend which allows me to use the S590, DAV - FC7 and my Sharp TV?

    Thanks in advance!

    Hello Tom

    The volume button on the Blu - ray player's remote control is used to control the TV volume.
    The player's remote control cannot be programmed to control the volume of the car radio.

    You can use the code 18 to program the supplied remote control to the player to control the Sharp TV.

    To buy a universal remote, you can contact the nearest Sony dealer.

    Kind regards

    Colby

Maybe you are looking for

  • I can't locate the "search bar" when I type ctrl-f. Where is he?

    I display the AVG Security toolbars, Navigation and editing, running Windows XP Pro. I don't know what looks like the search bar, so I can't seem to find it anywhere.

  • Album "Recently deleted" disappeared... Help please!

    Hi, my "recently deleted" folder just disappeared from my sidebar in photos. I had just deleted a large number of photos and I wanted to delete them permanently, but when I clicked on return was not in the sidebar, where it had been when I did the sa

  • Presario cq60-430SA: System disabled [05006]

    I received a cq60 and when lit from that bios starts to load it emits the sound warning and request password (which I don't have) and after that 3 tests see the message 'system disabled [05006]' is because he needs a bios password? can it be reset. ?

  • M125a: I can't change the format of paper copy in HP M125a

    Hi all I bought a printer HP M125a (print, copy, scan), but I have a problem with the copy of Pages A4. When I put my A4 paper in the scanner to copy, laser scan only my printer from start position LTR (letter) is the result of 2CM at the bottom of m

  • Support of connection string. Works fine in VS, not SQL.

    Attempt to create server SQL 2008 r2 link our AS400. I have a connection string that has been tested in Visual Studio that works: Driver = {Client Access ODBC (32-bit) driver}; XUID = xupd44xxx; System = QSERVER; DBQ = QGPL; dftpkglib = QGPL; Languag