Action script 3 onClipEvent

i was reading a tutorial for a little game and when ever i
try to run it, i get the error " 1087: Syntax error: extra
characters found after end of program. onClipEvent (enterFrame) { "
the code is:
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x--;
if (Key.isDown(Key.RIGHT)) {
_x++;
if (Key.isDown(Key.UP)) {
_y--;
if (Key.isDown(Key.DOWN)) {
_y++;
it seems to work for everyone else. Your help is greatly
appreciated.

if you're using as 3, there's is no onClipEvent() and there
is no code that can be attached to an object. read the help files,
programming with actionscript 3.

Similar Messages

  • How to embed html codes for videos games etc... in action script 3.0

    i am trying to embed a chatbox on my action script 3.0 website. but i am having no succes. any help on how to get my chatbox on a page using html code

    Hey thnx Ned.
    this sites are really helpful.but,i have used sound through button.so how it is possible to attavh the link with slider.i have created slider also.
    Below is my slider code for sound.
    onClipEvent (load) {
        mySound1 = new Sound();
        mySound1.loadSound((myScale)+"/"+(myTanpura)+"/"+(myTanpuraSwar)+"/"+(myTanpuraTempo)+".w av", true);
        mySound1.onSoundComplete = function() {
        mySound1.start();
        mySound1.start(0.058,999);
    onClipEvent (enterFrame) {
        downloaded = mySound1.getBytesLoaded();
        total = mySound1.getBytesTotal();
        if (downloaded != total) {
            _root.dl = "You have to buy this software...";
        } else {
            complete = 1;
            _root.dl = "";
        mySound1.setVolume(ratio * 2);
    This code is working for slider.I mean it scrolls the slider.but it dosent make any effect to sound.
    Below is my button code.
    stop();
    mySoundBtn4.onRelease = function () {
              mySoundC = new Sound(this);
              mySoundC.attachSound("mySoundClip4");
              mySoundC.start(0, 300);  //10 represents the number of loops
              gotoAndPlay("play1");
    this is on button's frame.not exactly on button.
    Button and Slider both are on diffrent scene.
    Can you plese help me out?

  • Where do I find anm experienced Action Scripted fast?

    Hi,
    I have a Flash presentation which needs completed. Basically,
    all of the buttons need programmed and as a newbie who is running
    out of time to learn, I need some help.
    First, I'd like to know where you find people who can do this
    (here?)
    Secondly, how long it would take to programme approx 875
    buttons (many of which are repetitions (e.g home button, help
    button, exit button appearing on every screen). There are
    approximately 109 screens which need to be linked.
    Thirdly, what would be a realistic price to expect to pay for
    someone to do this? It is a non-profitmaking project for a
    voluntary organisation.
    Thanks

    nicknamesaretaken,
    > I think I see what the problem is, but still struggling
    to
    > get it to work.
    Okay.
    > I now have:
    >
    > stop(); {
    > on (release)
    > this.gotoAndPlay("CS1"); // this is the correct code.
    > }
    Okay, the on() event handler may not belong here. The on()
    and
    onClipEvent() functions are an older (Flash 5 era) way to
    handle events in
    ActionScript. They're still available in Flash 8, and they
    work just fine,
    even in AS2, but these are applied *directly to* the object
    in question; as
    in, you click your button to select it, then type into the
    Actions panel
    while the button is selected. In such a case, no instance
    name is needed
    for the button (or whatever object). The above code would
    have to be
    attached to each button -- which really gets old with a large
    number of
    buttons -- and the stop(); action would have ben appear
    inside the on()
    function.
    Your earlier approach -- where you referenced the button's
    instance name
    and assign a function to the Button.onRelease event -- is the
    recommended
    best practice, and has been available since Flash MX (aka
    Flash 6). There's
    nothing about your earlier code that shouldn't have worked --
    it's just you
    *might* have been experiencing the Scenes-related bug I
    mentioned.
    I would change your previous code as follows:
    // in a frame script ...
    stop();
    skipintro_btn.onRelease = function() {
    this._parent.gotoAndStop("frame label here");
    That stops the timeline in which this ActionScript appears.
    Then it
    assigns a function literal to the Button.onRelease event of
    the button
    symbol whose instance name is skipintro_btn (if that object
    is actually a
    movie clip, then it assigns a function literal to the
    MovieClip.onRelease
    event of that instance -- funtionally the same thing). Then
    it refers to
    the parent of this object, which is the timeline in which the
    object
    appears, and tells that timeline to gotoAndStop() at the
    named frame label
    you provide -- even if that frame label is in another scene.
    Make sense?
    > Are there any good Action Script books you could
    > recommend?
    There are quite a few good ones on the market lately, but
    the last I can
    think of that I enjoyed -- from a general programming
    standpoint -- is
    Object-Oriented ActionScript For Flash 8 (Friends of ED), by
    Peter Elst and
    Todd Yard.
    > I'm also a bit worried about bug comment. Does it mean
    > that I will have difficulty playing this project in
    Flash Player
    > 9 as it's not written in Action Script 3.0?
    You shouldn't have any problems. As long as you use the
    frame labels
    approach and avoid Scene names, Flash Player 9 will run it
    the same as older
    Players. Flash Player 9 is the first to feature *two* virtual
    machines for
    ActionScript. One is the overhauled AS3-lovin' machine; the
    other maintains
    backward compatability for AS1 and AS2.
    > If so, that's a big problem isn't it as people will need
    to
    > download older versions of Flash Player to view it - or
    > I'll need to include older version on the disc.
    Right, but you don't have to worry about that. :) The Scenes
    issue is
    an old one, and it is a big problem, but at least the
    workaround is easy
    (frame labels).
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • How to create volume slider for flash cs 5 using action script 2.0?

    how to create volume slider for flash cs 5 using action script 2.0?the output should like if user want to hear sound in slow pitch,medium pitch or high pitch(slow to high pitch anything).i have attach this sound to button with using this code:
    stop();
    mySoundBtn.onRelease = function () {
              mySoundC = new Sound(this);
              mySoundC.attachSound("mySoundClip");
              mySoundC.start(0, 10);  //10 represents the number of loops
              gotoAndPlay(2);
    This sound plays till 3-4 scene ahead.
    Can anyone help me?

    Hey thnx Ned.
    this sites are really helpful.but,i have used sound through button.so how it is possible to attavh the link with slider.i have created slider also.
    Below is my slider code for sound.
    onClipEvent (load) {
        mySound1 = new Sound();
        mySound1.loadSound((myScale)+"/"+(myTanpura)+"/"+(myTanpuraSwar)+"/"+(myTanpuraTempo)+".w av", true);
        mySound1.onSoundComplete = function() {
        mySound1.start();
        mySound1.start(0.058,999);
    onClipEvent (enterFrame) {
        downloaded = mySound1.getBytesLoaded();
        total = mySound1.getBytesTotal();
        if (downloaded != total) {
            _root.dl = "You have to buy this software...";
        } else {
            complete = 1;
            _root.dl = "";
        mySound1.setVolume(ratio * 2);
    This code is working for slider.I mean it scrolls the slider.but it dosent make any effect to sound.
    Below is my button code.
    stop();
    mySoundBtn4.onRelease = function () {
              mySoundC = new Sound(this);
              mySoundC.attachSound("mySoundClip4");
              mySoundC.start(0, 300);  //10 represents the number of loops
              gotoAndPlay("play1");
    this is on button's frame.not exactly on button.
    Button and Slider both are on diffrent scene.
    Can you plese help me out?

  • Action script 2 not working

    New to Flash CS4, but could do basic button stuff like this in Flash MX 2004. (Haven't been doing anything with Flash in the meantime, but now have CS4 and am determined to get back into it.)
    I chose Action script 2 when starting, and in the publish settings. Made some very simple buttons and used the action script assistant but cannot figure out why they are not working. i keep going around and around and getting nowhere.
    would someone please take a look and advise? I am STUCK.
    Please?
    the file is too big to attach, but if anybody is willing to help, i'll share the file via my iDisk. Thanks so much.

    I have a few suggestions for you -- not that you asked, but hey it is a free forum with volunteers, so you get what you get!
    First if you really don't know AS2 all that well, but you want to get into coding I would suggest starting with AS3. It is the future and if you have to learn new stuff it might as well be the newest, new stuff. AS3 is the future of Actionscript and Flash. It is a little more complex in some respects, but in many others it isn't that much more difficult and it really helps if you haven't learned all kinds of "bad" ideas from how AS2 was....
    Next, if you decide to stick with AS2, I would suggest learning the latest ways of doing stuff in AS2. Using the on(event) type of coding is really old and it won't serve you well if you want to advance very far with your coding.Here is a great article on the transition to the newer style and why it is a good idea:
    http://www.quip.net/blog/2006/flash/museum-pieces-on-and-onclipevent
    After that, consider ditching buttons all together. They are really twitchy and strange and most people I know gave them up when movieclips could have button events attached to them.
    Finally on the issue of Scenes, they are a great way for timeline animators to organize their content. And they are great when everything is just played back to back. In fact that is what happens to scenes, when you publish the timelines are strung together in sequence and then the "scenes" are deleted. The whole thing becomes just one big long timeline. The problems come in when you start using code to move the playhead around. The documentation seems pretty straight forward and it should work, but there are just several little tricky things where it doesn't work. Sounds can cause problems too. So if you plan to use code I always recommend that you use movieclips to organize your "scenes" and not the actual scenes....

  • Alpha action script error

    I would like to have several movie clips fade with action
    script instead of tediously tweening them all, but am having
    trouble. Action script is certainly not my strong point, maybe
    someone can spot what I am doing wrong, and explain in kindergarten
    terms?
    I opened a new document, created an object, turned it into a
    movie clip, deleted it from the stage, drug it from the library
    back onto the stage and named it myAlpha in the MC instance name
    form. It is sitting in Layer 2. Then I attached the following
    script.
    onClipEvent(load){
    myAlpha=0;
    this._alpha=myAlpha;
    onClipEvent(enterFrame){
    if (myAlpha <=100){
    myAlpha=myAlpha +1;
    this._alpha=myAlpha;
    } else {
    stop();
    However when I test the movie I always get the following
    errors:
    **Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 5:
    Statement block must be terminated by '}'
    onClipEvent(enterFrame){
    **Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 11:
    Syntax error.
    Total ActionScript Errors: 2 Reported Errors: 2

    In kindergarten terms, start counting. Every time you see a {
    add one, every time you see a } subtract one. If you get to the end
    and the total isn't zero you have mismatched braces. Which is
    exactly what the error is telling you.
    In this case just add one more } to the end and they will
    match.

  • How do I use the button states in an action script?

    In my Captivate 8 project I use smart shape as buttons. The buttons have different images presented dependent on the state of the button. I have also created a simple action script that shows what happens when the button is pressed. When the button has been pressed the normal state of the button appear. I, however, want the down state of the button to remain visible util the user presses another button. How do I accomplish this? Is there variables for the buttons different state or how can I create that?
    BR,
    Madeleine

    When you talk about 'actionscript' do you mean advanced or shared actions? You cannot write actionscript within Captivate, only Javascript. If you use advanced/shared actions they'll be converted on runtime to either Actionscript (for SWF output) or Javascript (for HTML5 output).
    The states in shape buttons are the normal way buttons behave (not only in Flash). If you are indeed using shared/advanced actions, and you want the down state to remain until the next shape button is clicked, you'll have to go the way described by iFlashAppsToo. Create shapes that have the look of the down state, make them initially invisible and group all those shapes on one slide. Add two statements to the shared/advanced action (please do use shared actions, you'll save time):
    Hide Group   so that eventual down mimicked states on previously clicked buttons disappear
    Show Im_Downx    to show the down image for that button

  • Adding data to cfgrid using action script

    how can i add data to a grid row called name in action
    script. i have a cfselect control containing name of students and i
    want to add the values of the selected student from the list to
    grid.

    Did you add your instance of SpectrumCanvas to the stage with addChild()?
    If so, you should boil your posted code to a more simple example.
    If this post answered your question or helped, please mark it as such.

  • Error message with Action Script 2.0 file

    Hi,
    I am trying to edit an old flash file that uses Action Script 2.0. I am using CS6 and keep getting the following error message after publishing:
    Scene 1, Layer 'AS', Frame 1, Line 5, Column 29
    1067: Implicit coercion of a value of type int to an unrelated type String.
    Can you suggest any fixes or workarounds? I also have Flash 4.0. Can i downsave the file? If so, how?
    Thanks!

    Thank you. I think that did fix the original two errors. But now upon test of the file, I get some new errors:
    Symbol 'MoneySlider', Layer 'AS', Frame 1, Line 7, Column 3
    1120: Access of undefined property ratio.
    Symbol 'MoneySlider', Layer 'AS', Frame 1, Line 7, Column 20
    1180: Call to a possibly undefined method number.
    Symbol 'MoneySlider', Layer 'AS', Frame 1, Line 7, Column 27
    1120: Access of undefined property _root.
    Symbol 'MoneySlider', Layer 'AS', Frame 1, Line 9, Column 27
    1120: Access of undefined property ratio.
    And on the MoneySlide layer in Actions:
    this.ratio = 0;
    this.loadBar._width = 0;
    this.dragger.ratio.text= "$0";
    dragger.onPress=function(){
              this.startDrag(true,0,0,line._width,0);
              this.onEnterFrame=function(){
                        ratio=Math.round(number(_root.transitBenefitLimit/100)*(this._x/(line._width/10 0)));
                        loadBar._width = Math.round(this._x);
                        dragger.ratio.text= "$"+ratio;
    dragger.onRelease=dragger.onReleaseOutside=stopDrag;

  • Using action script 2 how can i send a variable value to a dynamic textbox on a different keyframe?

    using action script 2 how can i send a variable value to a dynamic textbox on a different keyframe?

    Thanks for your swift response.
    That sounds like a good solution, but the code I have on frame 2 is this
    timer = 0;
    countup = function(){
    timer++;
    countupInterval = setInterval(countup,100);
    If I added the same actionscript to frame 3 which has a dynamic textbox with a variable timer attached wouldn't it just put the timer back to 0? What I want is the last known value that was given when it was in frame 2.
    I am thinking of temple run here, I am trying to caculate the total distance(set in the timer variable) from the previous try.
    Hope this makes sense.
    Chazwick

  • Error while loading an child movieclip if the child has any action script

    Hi
    I am developing an application where I need to load a child.swf . All works fine when I load the mc but as soon as I add Action Script (lets say trace("test")) to the Child.swf I get a Error #1009: Cannot access a property or method of a null object reference. On the addChild line.
    Code
    trace("Toothpaste click");
    var mLoader:Loader = new Loader();
    var mRequest:URLRequest = new URLRequest("Child);
    mLoader.load(mRequest);
    mcContainer.addChild(mLoader);

    Sorry.Thanks
    Typo on the forum.
    I can load the child.swf see the image/text in the child  displayed in the parent but as soon as I add as3 to the child page I receive the above mentioned error. If I run the child.swf from the IDE or by itself everything works fine .
    trace("Toothpaste click");
    var mLoader:Loader = new Loader();
    var mRequest:URLRequest = new URLRequest("Child.swf");
    mLoader.load(mRequest);
    mcContainer.addChild(mLoader);

  • Could someone help me with my action script?

    I followed a tutorial on how to make an interactive photo gallery but for some reason the file isn't working. I am new to flash and no very little about action script.
    Would someone be willing to take a look at my file and advise me?
    Thanks

    Did your tutorial have you download XML from a server to feed the images to the gallery? Many people forget to check for errors loading the XML file or forget to "do something" once the XML is loaded. Common things not to look for are IOErrorEvent.IO_ERROR or SecurotyErrorEvents warning you the XML you're trying to load is on a different domain (a webserver online) and it doesn't have permission (a crossdomain.xml).
    In those situations it can appear like it's doing nothing.
    Did you just take the code of the tutorial at the end and try to play it as you went through the tutorial? If you just copy and pasted it all you'lre going to have a hard time isolating the issue. In that case you can always re-do the tutorial until you start to see issues. Then you know where they are.

  • Setting timeout settings for Action Scripts

    We are using OIM 11gR1 along with the AD and Domino connectors. We are also using Action Scripts to perform some post create actions on the AD and Domino resources that get created by OIM. The action scripts are being invoked with the correct set of parameters and they do their job. However for both connectors, the connector server (Java connector server for Domino, .NET connector server for AD) times out when waiting for the script to complete. Our scripts are expected to take a long time (30+ seconds).
    Based on our testing, the AD connector times out in 30 seconds, and the Domino connector times out in 20 seconds. You would get the below exception in your Java Connector Server log file:
    Dec 4, 2013 2:36:41 PM org.identityconnectors.framework.api.operations.ScriptOnConnectorApiOp runScriptOnConnector
    FINE: Exception:
    java.lang.RuntimeException: Timeout waiting for action, process was terminated
        at org.identityconnectors.domino.WinJni._executeWinCommand(Native Method)
        at org.identityconnectors.domino.WinJni.executeWinCommand(WinJni.java:31)
        at org.identityconnectors.domino.ScriptOnConnector.executeCmdScript(ScriptOnConnector.java:143)
        at org.identityconnectors.domino.ScriptOnConnector.runScriptOnConnector(ScriptOnConnector.java:88)
        at org.identityconnectors.domino.DominoConnector.runScriptOnConnector(DominoConnector.java:316)
    Is there any way to configure OIM so that it waits longer for the action script to complete. The real problem over here is that if 2 users are being provisioned to AD and/or Domino simultaneously (we use access policies to trigger provisioning rules), then the connector (Java or .NET) does NOT invoke the action script for the second user if the action script for the first user times out. It does however create AD/Domino resources for all applicable users. This in itself is a defect - but I need a workaround.
    Looking at some old Sun Identity Manager documentation (which became Oracle Waveset), it seems that the entire OIM concept of action scripts has its origins in Sun Identity Manager/Oracle Waveset. And these products did support the notion of timeouts. Have a look at :
    http://docs.oracle.com/cd/E19225-01/821-0092/bzbuc/index.html
    Does anyone familiar with Oracle OIM code know if custom timeouts are supported by AD and Domino connectors?
    Thanks
    Aspi Engineer

    Change the time for the below under 'Web Intelligence Processing Server'
    Idle Document Timeout (seconds):
    Idle Connection Timeout (minutes):
    If you still have problem then try changing the web.xml under the following war files,
    AdminTools
    PartnerPlatformService
    PerformanceManagement
    PlatformServices

  • I am trying to reinstall Flash CS4 professional as the action script is not working but now I am getting an error: 2 message when I use the original CD to try and reinstall

    I can't get the original disk to work on a reinstall.  I get the message
    AdobeColorCommonSetRGB
    Error:
    Error 2.
    I teach a class using this program on Macintosh computers running 10.9.5 and the action script is not working.  It will work on any program designed using the 10.8 but if you design any animation on 10.9.5 the action script will not work for the buttons

    You would have to manually delete the color profiles in question... Run the cleaner tool and see if it gets you started.
    http://www.adobe.com/support/contact/cscleanertool.html
    Mylenium

  • Error in phase of assigniment Action Script

    Hello Guys!
    I created the following action script named "sketch.as" :
    package
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import com.adobe.images.JPGEncoder;
    public class sketch extends Sprite {
    public function sketch():void {
    //this is your documentclass constructor
    stage.addEventListener(MouseEvent.MOUSE_MOVE, moveCursor);
    Mouse.hide();
    function moveCursor(event:MouseEvent):void
        pencil.x = event.stageX;
        pencil.y = event.stageY;
    var canvas_mc:MovieClip = new MovieClip()
    addChildAt(canvas_mc, 0);
    canvas_mc.swapDepths
    function sketch()
    canvas_mc.graphics.beginFill(0xFFFFFF);
    canvas_mc.graphics.drawRect(0, 0, 600, 500);
    canvas_mc.graphics.endFill();
    canvas_mc.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);
    canvas_mc.addEventListener(MouseEvent.MOUSE_UP, stopDrawing);
    canvas_mc.addEventListener(MouseEvent.MOUSE_MOVE, makeLine);
    function startDrawing(event:MouseEvent):void{
    canvas_mc.graphics.lineStyle(1, 0, 1);
    canvas_mc.graphics.moveTo(mouseX, mouseY);
    canvas_mc.addEventListener(MouseEvent.MOUSE_MOVE, makeLine);
    function stopDrawing(event:MouseEvent):void{
    canvas_mc.removeEventListener(MouseEvent.MOUSE_MOVE, makeLine);
    function makeLine(event:MouseEvent):void{
    canvas_mc.graphics.lineTo(mouseX, mouseY);
    sketch();
    var serverPath:String = "";
    function createJPG(m:MovieClip, q:Number, fileName:String)
    var jpgSource:BitmapData = new BitmapData (m.width, m.height);
    jpgSource.draw(m);
    var jpgEncoder:JPGEncoder = new JPGEncoder(q);
    var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);
    var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream");
    var jpgURLRequest:URLRequest = new URLRequest ( serverPath+"jpg_encoder_download.php?name=" + fileName + ".jpg");
    jpgURLRequest.requestHeaders.push(header);
    jpgURLRequest.method = URLRequestMethod.POST;
    jpgURLRequest.data = jpgStream;
    var jpgURLLoader:URLLoader = new URLLoader();
    //jpgURLLoader.load(jpgURLRequest);
    navigateToURL(jpgURLRequest, "_blank");
    save_btn.addEventListener(MouseEvent.CLICK, saveBtnPress);
    save_btn.addEventListener(MouseEvent.ROLL_OVER, saveBtnOver);
    save_btn.addEventListener(MouseEvent.ROLL_OUT, saveBtnOut);
    function saveBtnPress(e:Event):void
    createJPG(canvas_mc, 90, "sketch");
    function saveBtnOver(e:Event):void
    Mouse.show();
    pencil.visible = false;
    function saveBtnOut(e:Event):void
    Mouse.hide();
    pencil.visible = true;
    Lately I created a file .fla in the same root of the file .as naming it "sketch.fla"
    When I try, in the Adobe Flash CS4 Professional screen, to assign to  ".fla" in the properties Publish my action script, the following message appears:
    “A definition for the document class could not be found in the classpath, so one will be automatically generated in tha SWF file upon export.”
    Obviously, it doesn’t function
    Could somebody help me??

    i don't understand, "When I try, in the Adobe Flash CS4 Professional screen, to assign to   ".fla" in the properties Publish my action script, the following message  appears:"
    but i do understand that error message.  you need to assign the document class for your fla.  in the properties panel with the backstage selected, assign sketch in the class or document class field.

  • Is Import to DRM by action script the only way to build hierarchies?

    Hi,
    If I am getting by source file as a big generation wise excel format and even properties in excel sheet with large number of custom property field values.
    Is making a Import action script out of the excel to load to DRM is the only way, or do we hav any other option to load these hierechies to DRM from excel without going fpr manual efforts in making scripts one by one for large no of dimensions.

    hi, the import functionality can build hierarchies. It has a draw back of only building NEW hierarchies. So if your source master hierarchy is external to DRM, action script or API is best way, if it is to be automated. If this is only be imported/updated once a month the import can be used to create the "new" version. You can use then blend update your old version.

Maybe you are looking for

  • How can i use the apps i have downloaded on itunes

    how can i use the apps i have downloaded on itunes

  • Inventory Management MultiProvider 0IC_MC03 - Where does the WIP Come From

    Hi, I have installed the primary InfoCube 0IC_C03 for Material Movements and noticed that there is a MultiProvider 0IC_MC03 (Material Range of Coverage WIP )  and I'm curious how this would project WIP?  The Documentation doesn't mention any details

  • Problems syncing with iCloud

    This might be a big question. Just upgraded to Lion and iOS 5 on all devices. We run both our accounts from a single iMac. I have managed after lots of button pushing to get iCloud to sync my Calendars but cannot get it to do the same  on my wifes. A

  • Rejected Purchase Requisitions + shopping cart

    Hi, I have this requirement: develop a report to extract (every day) all the rejected Purchase Requisitions and their  items (only items that have status rejected). how to those rejected Purchase Requisitions ? Many thanks

  • Handling Error messages

    When errors occur in my application, I have them displaying in both inline with field and in notification. The notification appears like this 2 errors have occurred *Error 1 *Error 2 Is there any way to have just the 2 errors have occurred appear and