Code 1013: The private attribute may be used only on class property definitions.

OK guys, being new to Action script game, I already find myself with errors.  I have studied this for the last few days, and every time I found a solution said, the solution is always the brace.  But for the life of me, I can't find a support missing!  Could someone look at this for me and guide me in the right direction, before losing the rest of my hair. :-)

package 
{
  import flash.display.Sprite;
  import flash.events.MouseEvent;
  public class Main extends Sprite
  {
  var xPos:int; //Stores the initial x position
  var yPos:int; //Stores the initial y position
  }
public function Main():void
  {
  addListeners(alpine,armadillo,battery,blizzard,cactus,carnivoreplant,cloud,coolfire,coral,crystal,dandelion,darkfire); //A function to add the listeners to the clips in the parameters
  }
private function getPosition(target:Object):void
  {
  xPos = target.x;
  yPos = target.y;
  }
private function dragObject(e:MouseEvent):void
  {
  getPosition(e.target);


  e.target.startDrag(true);
  }
private function stopDragObject(e:MouseEvent):void
  {
  if (e.target.hitTestObject(getChildByName(e.target.name + "Target"))) //Checks the correct drop target
  {
  e.target.x = getChildByName(e.target.name + "Target").x; //If its correct, place the clip in the same position as the target
  e.target.y = getChildByName(e.target.name + "Target").y;
  }
  else
  {
  e.target.x = xPos; //If not, return the clip to its original position
  e.target.y = yPos;
  }


  e.target.stopDrag(); //Stop drag
  }   
private function addListeners(... objects):void
  {
  for (var i:int = 0; i < objects.length; i++)
  {
  objects[i].addEventListener(MouseEvent.MOUSE_DOWN, dragObject);
  objects[i].addEventListener(MouseEvent.MOUSE_UP, stopDragObject);
  }
  }
}

Firstly, the Builder must not have return datatype. Builder returns the data type of the class. Sub is certainly unacceptable.

Also, I strongly suggest type you all properties and methods (except for builders, naturally).

You class should look like this:

package
{
    import flash.display.Sprite;
    import flash.events.MouseEvent;

    public class Main extends Sprite
    {
        private var xPos:int; //Stores the initial x position
        private var yPos:int; //Stores the initial y position

        public function Main()
        {
            addListeners(alpine, armadillo, battery, blizzard, cactus, carnivoreplant, cloud, coolfire, coral, crystal, dandelion, darkfire); //A function to add the listeners to the clips in the parameters
        }

        private function getPosition(target:Object):void
        {
            xPos = target.x;
            yPos = target.y;
        }

        private function dragObject(e:MouseEvent):void
        {
            getPosition(e.target);
            e.target.startDrag(true);
        }

        private function stopDragObject(e:MouseEvent):void
        {
            if (e.target.hitTestObject(getChildByName(e.target.name + Target))) //Checks the correct drop target
            {
                e.target.x = getChildByName(e.target.name + Target).x; //If its correct, place the clip in the same position as the target
                e.target.y = getChildByName(e.target.name + Target).y;
            }
            else
            {
                e.target.x = xPos; //If not, return the clip to its original position
                e.target.y = yPos;
            }

            e.target.stopDrag(); //Stop drag
        }

        private function addListeners(... objects):void
        {
            for (var i:int = 0; i < objects.length; i++)
            {
                objects[i].addEventListener(MouseEvent.MOUSE_DOWN, dragObject);
                objects[i].addEventListener(MouseEvent.MOUSE_UP, stopDragObject);
            }
        }
    }
}

Tags: Adobe Animate

Similar Questions

  • 1013: the private attribute may be used only on class property definitions.

    In the following code, I get an error. How to solve this problem?

    Line 301013: the private attribute may be used only on class property definitions.

    package

    {

    import flash.display.MovieClip;

    import flash.events.Event;

    Caesar/public class extends MovieClip

    {

    var speed: Number;

    public void Caesar()

    {

    addEventListener ("enterFrame"), move;

    }

    public void move(e:Event)

    {

    This.x = mouseX;

    This.y = mouseY;

    If (caesar.hitTestObject (MainClip.instance.enemyList [i]))

    {

    trace ('Caesar should');

    removeSelf();

    MainClip.instance.finishedMainClip ();

    }

    }

    }

    private function removeSelf (): void

    {

    removeEventListener (Event.ENTER_FRAME, move);

    If (stage.contains (this))

    {

    this.parent.removeChild (this);

    }

    }

    }

    Check your dash... Your removeSelf function is outside the definition of the class... that closing brace entered should be after him.

  • How the identity if one table used only by synonyms and not by any other subprogrammes in a schema?

    Hi people

    How the identity if one table used only by synonyms and not by any other subprogrammes within a schema. I see in the TOAD describe objects tab used by, but I would like to identify hundreds of table so I would like to know if there would be any SQL or Meta Data Tables?

    How the identity if one table used only by synonyms and not by any other subprogrammes within a schema. I see in the TOAD describe objects tab used by, but I would like to identify hundreds of table so I would like to know if there would be any SQL or Meta Data Tables?

    The ALL_DEPENDENCIES view has hierarchical information based on object_id

    The view object has the object_type.

    Create a hierarchical query on the first view and attach it to the second view.

    Or you can use the utldtree.sql file in the installation of the DB admin folder. Comments initially show you how a hierarchical query based on the object type.

  • 8E5E0408 and Error 8000FFFF codes keep occurring when I try to use windows update. Defender definitions are the only thing that updates. I have Win 7 Ultimate, build 7100

    I get 8000FFFF error 8E5E0408, an update of the ATI driver codes and a Dell monitor succeeded. All the Defender definition update have been good.

    I moved and reloaded Win 7. Everything in the update works correctly. I am current in all. The Norton came from my motherboard software. Thanks for your time.

  • Adobe Lightroom 6 launches the application, but may not use it

    Whenever I try to open six Lightroom the application loaded, but he needs to be force quit every time because nothing can load. rotation icon appears and does not disappear.

    IM on a mac

    Yes - details contribute to an answer.

    It could be "Authorizations" - LR requires a permission of full read/write for multiple folder locations.

    Solutions to the Lightroom error problems of user permissions

  • I had Mac Air in the month of April, now using only Safari DR.celaner shows me that I have use all RUM - 4GB. and mac gets hot. is this normal?

    It is quite new machine a few weeks it started to get hotter, Dr. cleaner shows me that I have use 4 GB of memory when I just use Safari nothing else, sometimes performance becomes very slow. I don't know what is happening.

    Dr. cleaner

    The first step is to get rid of it. If you still have a problem, please see below.

    Apps can affect the performance of Mac, battery, temperature and fan activity - Apple Support

  • Private attributes &amp; errors in class definition property

    I'll implement the functions in a document class file, and then from there I'm going to call this function from a movieclip in flash.  For some reason, maybe I have set up many things, but he gives me errors like below:

    Line 37 1013: attribute private may be used only on class property definitions.

    What I do wrong here and is there something I don't understand?
    Here is my as code.
    modal. ACE >
    package {
    
         import flash.display.*;
    
         import flash.events.Event;
         import flash.events.MouseEvent;
         import flash.display.*;
         import flash.events.*;
         import flash.net.URLRequest;
    
         public class modal extends MovieClip {
              
              public function modal() {
    
         private var currentlyShowing:MovieClip=null;
    
              public function showModalContent(clip:MovieClip):void {
                   if (currentlyShowing!=null) {
                        removeChild(currentlyShowing);
                   }
                   currentlyShowing=clip;
                   addChild(currentlyShowing);
              }
    
              public function removeModalContent():void {
                   if (currentlyShowing!=null) {
                        removeChild(currentlyShowing);
                        currentlyShowing=null;
                   }
    
              }
              }
         
    
    
         }
    
    }
    
    And here is my code which is on the timeline:
    slideshowimages_mc.one_mc.addEventListener(MouseEvent.CLICK, oneClick);
    
    function oneClick(event:MouseEvent):void {
         var bigimagebg_mc=new mc_bigimagebg  ;
         showModalContent(bigimagebg_mc);
         bigimagebg_mc.x=200;
         bigimagebg_mc.y=170;
    }
    
     
    

    UNNEST all named functions and this variable:

    package {}

    import flash.display. *;

    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.display. *;
    import flash.events. *;
    import flash.net.URLRequest;

    modal/public class extends MovieClip {}

    private var currentlyShowing:MovieClip = null;

    public void modal() {}

    }

    public void showModalContent(clip:MovieClip):void {}
    If (currentlyShowing! = null) {}
    removeChild (currentlyShowing);
    }
    currentlyShowing = clip;
    addChild (currentlyShowing);
    }

    public function removeModalContent (): void {}
    If (currentlyShowing! = null) {}
    removeChild (currentlyShowing);
    currentlyShowing = null;
    }

    }
    }

    }

  • Is it possible to get the activation code of the older PC so that I can use it in my class?

    Original title: Activation of Windows 8.

    If there is some time I had windows 8 pro to use in my construction of future games. Not knowing I could install it on 1 computer (thought it would be at least 2) I installed it as a test on my desktop PC previos where it has not yet run properly cause it was an older model (and if you haven't used since then, cause I have a laptop with Windows7). But now my PC gaming is finished and I suddenly find I could activate only on 1 PC.

    So my question is. Is it possible to get the activation code of the older PCs (that I use even more, maybe even remove it) so that I can use it in my class? Or that the activation code and the money just went in the toilet?
    I could install Windows 7 to 2 different PC-s(didn't try more cause there was no need) with no problems and it wasen can't pack family, why is Windows 8 different? Sometimes errors occur.
    Ask cause I went all on buy the parts, I have no money to buy a new copy of windows 8.
    Awayting for your answers.
    Thank you
    Edit! Maybe I'm a solution. Going to try it out after I return to work.
    It's the solution

    "I have Windows 8/8 Pro is installed on my PC." If I replace with another PC, can I install my copy of Windows 8 on my new PC until I remove it from the other? »

    Yes. The highest point is the one you mentioned: you must remove Windows 8 from your old computer before you activate on the new. In other words, you can have your copy of Windows 8 or Windows 8 Pro running on a single computer at a time.

    Another thing to keep in mind is that if you have installed an upgrade copy under license of Windows 8 on a computer and then you want to use it on another computer, the same 'upgrade' rules apply: you must have a previous version of Windows on the computer before you install Windows 8. You can ignore this rule, if you started with Windows 8.1

    Important: You can't "move" Windows 8 or Windows 8 Pro on another computer if your computer is pre-installed with Windows 8. Your copy of Windows 8 is what OEM licensed which means that you are allowed to use Windows 8 on the computer on which he came already installed on.

    "How many times can I reinstall Windows 8 on another computer? Assuming I follow the rule 'uninstall old installation', peux I keep installing Windows 8 on different computers? »

    There is no limit to the number of computers that you reinstall Windows 8 on as long as you follow the rules, that I discussed in the last question.
     

    Hi NeemeK,

    We appreciate the research you have done to find more information on this issue. The information you found were correct.

    OEM product key can only be used with the computer on which it is installed on.

    When the operating system is not active (uninstalled) in the old computer, you can install it on the new computer. This applies to any number of computers you use.

    If you get any errors, you can perform the activation of the phone.

    http://support.Microsoft.com/kb/950929/en-us

    Hope that the information provided is useful. Do not respond if you need more help.

  • BlackBerry smartphones, enter the Postal Code in the address book

    Bold 9700 - O.S. 5.0.0.344 (Platform 5.1.0.96)

    When you enter a new contact the software does not allow me to enter a zip code of alpha-numeric Canadian style - in this area, that the keyboard is configured to use only the numeric keypad.  Even if I show the canada of the country of the contact field does not change.

    I can, however, enter contacts in the Contact Manager in Outlook can synchronize address book - and postal code appears correctly.

    A glitch but frustrating...

    The indices of anyone?

    Do you have you press and hold while typing the Alpha part?, cause it worked on my 9700...

    EDITED...

    UH I mean left ALT does not affect the Shift key...

  • Is it possible to order the right recovery disk set by using only the serial number?

    Hello

    I'm trying to order a set of recovery disc for what is customized for VAIO laptop. I would like to be able to put it back exactly the same way that they were shipped originally. For some strange reason, because I was not asked for S/N, I know that I will not ship the correct game.

    Since there is no return on the software, how can I be sure it's the correct game before ordering? Is their way to get the part number control myself using only S/N, if not, how about raising via serial number?

    I've already tried this https://servicesales.sel.sony.com/ecom/accessories/web/categorySearch.do?operation=subCategorySearch... but do not recover my particular model because it is Canadian model purchased.

    Your help is really appreciated.

    Thank you for your support.

    They are here:

    MODEL: PCG - 31112L

    MODEL NAME: VPCZ1390S (was a personal shopping via the online order of Sony of Canada with additional features and applications added - more than the Basic with the same model name model).

    Please consult this site raw and obsolete from where it was originally custom. Although it is more useful, but it can provide an idea of what I mean, the link is http://store.sony.ca/webapp/wcs/stores/servlet/SYCTOProcess?storeId=20153&langId=200&catalogId=10080...

    I think the specific set of recovery disks only who would be able to restore this address to his State of origin as the day, it was shipped via Sony, should be stopped by S/N and perhaps along the ST as well. If it is ordered using just the model and or the name of the template, the result would be a generic RDS used on all of the same model and would not now for his counterpart custom, with still the same exact model information.

    SERIAL NUMBER: J004DSU8

    SERIAL NUMBER: 54047221-0000247

  • How to activate the license .lic on ASA using the CLI

    Is it possible to activate the license eDel (.lic file) using only a CLI with SSH (without ASDM) on ASA5512-X connection?

    Activation or deactivation of the keys

  • Why use an abstract class?

    I am new to Java, and for some reason I can't get my head around why use an abstract class. I understand that an abstract class is something like:
    public abstract class Food{ // abstract class
    
    public void eat(){
    // stub
    }
    
    }
    
    public class Apple extends Food{
    
    public void eat(){
    // Eat an apple code
    }
    
    }
    So basically the idea above is that you can eat a "Apple", but you can't eat "food" because you cannot instantiate an abstract class.

    I understand what an abstract class is and how to write a. What I don't understand is why you would use it? It seems to me I might just create a normal class, called 'Food' and just do not instantiated. What are the benefits of using an abstract class?

    807479 wrote:
    If an abstract class should be used when you can implement fully some of the methods, but the other method can only be defined as heels?

    Fix.

    Note that Java abstract classes aren't necessary, but they add comfort and a way to correctly model the ideas we try to represent.

    That is why it must be abstract because you can not instantiate the class because not all methods are completely formed?

    Yes pretty close.

    So basically in an example of a mammal, I might have a breath() method entirely defined in the abstract class because all breath of mammals.
    But I should only do a method stub for speak() like any mammal makes a different sound.

    Right.

    Now I can not instantiate a mammal because it has only a stub for the speak() method so it must be an abstract class.

    Fix. There is no common way speak all mammals.

    But if I create a class called cow and extend the class mammal I only need to write the speak() method as I can inherit the breath() method completely trained.

    Is this correct? I am an abstract class if I can't entirely make up together the method. But I use an abstract class when I can form some of the methods?

    Your terminology is a little off, but, Yes, it seems that you have understood the concepts.

  • (I am in China and on the front is partly in Chinese.) I use Astrill which is a virtual private network and the code of the Australia, but still the Mandarin appears.

    Dear Firefox support, I am in China, and the first page of my Firefox screen is partly in Chinese. I use Astrill which is a virtual private network and the code of the Australia, but still the Mandarin appears. I downloaded a new version 5, but the mandarin (and the associated statement bar) still come in Mandarin. How can I download a really English version?

    You can choose your language installation of this list: http://www.mozilla.com/firefox/all.html

  • Error: "it is not possible to disable the connection at this time. "This connection may be using one or more protocols that don't support Plug-and-play, or it may have been initiated by another user or the system account.

    Original title: unable to disable my lan connection

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas:

    • I turn off my connection to the local network, it is showing message.

      It is not possible to disable the connection at this time. This connection may be using one or more protocols that don't support Plug-and-play, or it may have been initiated by another user or the system account.

      Please answer soon

      You have problems with programs

    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    Hi MVTDA,

    You can try the following methods and check to see if it helps:

    Method 1:

    a. Click Start and select run, type cmd and click OK.

    b. type net stop cryptsvc and press ENTER.

    c. type ren %systemroot%\System32\Catroot2 oldcatroot2, and then press the Enter key.

    d. restart the computer.

    e. open new command prompt and Type net start cryptsvc, and press ENTER.

    Method 2:

    If the same problem persists then you can try to uninstall the network drivers and check.

    a. click the Start button. Select run, type devmgmt.msc and press OK.

    b. Select the network card and right click on it.

    c. now, select Properties.

    d. in the Properties window, on the driver tab, click Uninstall.

    e. After you have uninstalled the drivers, restart the computer.

    Hope this information is useful.

    Jeremy K
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • of the Assembly's strong name validation failed "c:\windows\home\ehshell.exe". the file may have been tampered with or it was partially signed but not fully signed with the private key, what should I do?

    After I update to Windows XP SP 3 my media center has completely stopped working and it gives me following e: validation failure of strong name for the assembly 'c:\windows\home\ehshell.exe '. the file may have been tampered with or it was partially signed but not fully signed with the private key.

    What I would do.  I was grinding a lot and nothing has worked so far.

    Stone

    Please answer questions following diagnosis in a numbered list type in your very next answer (no need to quote this post):

    1. What is the full name of your application or the installed antivirus security suite and when (date about) is your subscription current expires?  What (other than Defender) anti-spyware applications are installed?  What third-party firewall (if applicable)?

    2 a Norton or McAfee application ALREADY installed on the computer?

    3. do you have a free trial Norton, or a test of free McAfee [a] come preinstalled on the computer when you bought it? (No matter if you have never used or activated).

    4. why has not been installed SP3 years?

Maybe you are looking for