Access the function of the other class Document class

I have this Enemy.as code that calls a function playerTurn() in Main.as, which is also the document class.

var rootRef:Main;

rootRef.playerTurn ();

This is playerTurn()

public void playerTurn(): void {}

player_turn = true

menu = battle_men

menu.attackBtn.addEventListener (MouseEvent.CLICK, atkClicked);

}

After this code runs, I get

TypeError: Error #1009: cannot access a property or method of a null object reference.

at CharacterClasses::Enemy/initEnemyTurn() [C:\Users\***\Documents\SonicUltimateSceneCreat or\CharacterClasses\Enemy.as:23]

Line 23 Enemy.as is rootRef.playerTurn ();

Why I get this error?

I got it.

Object (parent) .playerTurn () worked well, but the function in which this line was performed was based on an event listener, as follows

public void initEnemyTurn(evt:Event):void {}

removeEventListener (Event.ENTER_FRAME, initEnemyTurn);

player_turn = Main.player_turn;

{if (player_turn)}

addEventListener (Event.ENTER_FRAME, initEnemyTurn);

}

else {}

Object (parent) .playerTurn ();

}

}

initEnemyTurn is attached to an ENTER_FRAME listener, which was not readded in the else statement, thereby breaking the code.

The reason why it was delete in the first line of initEnemyTurn is so does not run twice while the first tries to determine the player_turn.

So it turns out that none of this had to do with the access to the function...

Thanks for the help!

Tags: Adobe Animate

Similar Questions

  • To access the other account via external hard drive

    MacBook Pro (13 inch, early 2011)

    V.10.11.6 El Capitan (15G 31)

    To summarize what I've lived, I got a kernel panic, by connecting to any account. So I tried to fix it by zapping the PRAM and NVRAM, tried the reset SMC, and both did not work. So I installed El Capitan on my external hard drive and it works, I just need to access the other account on the Mac to recover photos and then do a clean set install.

    The problem is that I do not know how to access the other account on the mac like I did not move any info from another acc to my external hard drive. Is it possible to do more than to reconfigure my HD post and return to the new installation procedure? Or I'm able to get pictures on the other account with the photo software?

    Open the drive containing, then the folder users, your record of departure, and photos. If you encounter a file that you don't have access permission, either drag it to the office supply your administrator password, or select the entire disk, choose get the information in the file menu and set to ignore permissions or ownership.

    (143739)

  • I have 2 different accounts on the same sites. Whenever I go on this site, one of my usernames prefills the field of the United Nations, and I can't access the other account. I can't replace my pre-filled username. Ideas?

    I have 2 different accounts on the same sites. Whenever I go on this site, one of my two (always the same) identifiers pre fills in the username field and I can't access the other account. The Web site legitimately refuse my password. I can't replace my username pre-populated because the second I hit enter to open a session, the initial username is rewritten in its field. Or user names is registered by firefox anywhere in the "Tools"; Options, security, advanced, or fields from the privacy menu.

    I noticed that this Web site has installed a cookie on my computer called "_rememberme" that contains the user name plaguing me.

    This is a Web site that I have access to very sensitive and important information, and I have to have two accounts available at different times.

    Thanks, Joshua
    XP, sp3; FF3.6.3

    This has happened

    A few times a week

    == I added the second account on this Web site.

    You will need to disable that remember me cookie, and make sure that you remove a tick to remember you on this Web site.
    Tools > Options > privacy > Cookies: "show the Cookies".

    You can disable the automatic filling of a name and a password.

    See:
    http://KB.mozillazine.org/Password_only_filled_after_entering_user_name
    http://KB.mozillazine.org/signon.autofillForms

    To open the topic: config page, type Subject: config in the address bar (address) and press the Enter key, as you type the url of a Web site to open a Web site.
    If you see a warning then you can confirm that you want to access this page.

  • Cannot access the other ICC profiles in LIghtroom CC 2015

    All of a sudden I am not able to access the other ICC profiles in soft proofing mode or in the print job module. It does not list the last ICC profile that I used and I cannot have access to the 'other', the list of the largest. When I try Lightroom just hangs.

    I know that the complete list of profiles is loaded into Photoshop and they appeared all when I select other profiles there. Any suggestions?

    The other list of printer profiles appeared on the other screen.

  • Hello I would like to create a Muse site with homepage and a member area with access code to access the other page of the site is possible this? Thank you

    Hello I would like to create a Muse site with homepage and a member area with access code to access the other page of the site is possible this? Thank you

    No. you're looking completely in the wrong place. These things requires a dynamic system that is appropriate like Wordpress, Joomla and so on. That or a paid Business Catalyst Pro account.

    Mylenium

  • Instance of MovieClip Access on stage in the other classes

    Hello.

    I have the instance of movieclip on the stage.  Instance name qwe of the shiptype.

    I want to access it in other classes EnemyShip.as.

    I tried this.

    MovieClip (this.parent) .getChildByName ("qwe")

    but I got

    TypeError: Error #1034: Type coercion failed: cannot convert flash.display::Stage@26d03041 to flash.display.MovieClip.

    I don't have any class of document.

    Publish settings controlled on automatically declare stage instances.

    y at - it access qwe in EnemyShip.as anyway?

    And here is the link to my flash project:

    http://www.mediafire.com/?kf6uiunys20cyzz

    If the ship is created the instance of the enemy, you can pass the instance of the ship in the object of the enemy when you create it using something like...

    var enemyship: EnemyShip = new EnemyShip (this);

    and in your EnemyShip.as receive you and assign it to a variable, so that you can reference it beyond the EnemyShip function

    public var _qwe:MovieClip;

    public void EnemyShip(ship:MovieClip)

    {

    _qwe = ship;

  • Access the ArrayCollection class MXML ActionScript collection?

    I have a MXML file that has a collection for my tree component arraycollection. I am overriding the updateDisplayList function to add lines to all of my nodes in the tree... However, I can't seem to understand how to access this ArrayCollection collection of inside the actionscript class?

    I tried the methods used to pass variables between two MXML files (like a popup window - which I've used in the past and it works very well).

    My actionscript class code is almost identical to this example here:

    http://www.iepl.NET/treeControlSample/treeControlSample.html

    In the example above, the data is static, but sometimes my data's going to change and I need to access the set dataProvider (collection ArrayCollection) in order to make the lines work well... This has been very frustrating for me! :)

    If someone knows a better way to reach gettign lines for brothers and sisters in a tree... Please let me know!

    Any help would be super duper awesome!

    I found the solution to this. My problem was similar to cheftimo was seen in this post:

    http://www.Adobe.com/cfusion/webforums/Forum/MessageView.cfm?forumid=60&CATID=585&ThreadId = 1367784 & enterthread = y

    The answer is to import the component you are trying to access the variable from and then call using mx.core.Application ' Application.application.'

    Thanks to Greg Lafrance!

  • Windows XP: My hard drive failed in part and I can't access the folder "my documents"...

    Windows XP SP2 from the CACLS
    Windows XP: My hard drive failed in part and I can't access the 'My documents' folder, windows it says ACCESS_DENIED. I tried grant permissions through CACLS and switches appropriate, but I still get messages ACCESS_DENIED. Can someone help me please I have 60 GB of data on it to be recovered. I backup this but is 3 weeks old. Regards Alan

    Hi Malkeleah
    Thanks for the reply, the reader had not failed, but windows had use of the access denied files because I was on a separate computer with a new master drive. Now recovered data and support to the high new outside. Thanks again for your help. Alan

  • ReadOnly user can access the other schema and change them

    Hello everyone,

    I created a readonly as this user in oracle 11g r2

    SQL > CREATE USER IDENTIFIED BY readonly readonly;
    SQL > GRANT CREATE SESSION, CREATE a SYNONYM to readonly.
    SQL > GRANT SELECT ON SA.vCustomerService TO readonly.

    But when I connect to the database and do a select like:
    SQL > SELECT * FROM ACC;
    I get the data in this table, even if I do an update on that table it works.

    What I am doing wrong that my readonly user always has full access to the other schema?

    Thank you in advance for your help!

    Best regards
    GIL GOMES Dany

    Dan_lu wrote:
    Hello everyone,

    I created a readonly as this user in oracle 11g r2

    SQL > CREATE USER IDENTIFIED BY readonly readonly;
    SQL > GRANT CREATE SESSION, CREATE a SYNONYM to readonly.
    SQL > GRANT SELECT ON SA.vCustomerService TO readonly.

    But when I connect to the database and do a select like:
    SQL > SELECT * FROM ACC;
    I get the data in this table, even if I do an update on that table it works.

    Check the permissions for this table - maybe some operations on this table are granted to the publc?

  • To access the upper class instance variables

    Hello

    See the code provided below. If home * variable 'i' is not set to 4, the output will be 3, if it is set, it will be 4.
    My question is... Well, I don't know exactly, there would be a lot. All this is strange to me.
    (For example, it seems that for the super class constructor runs when I access an instance of her variable).
    Could someone explain this topic or maybe help me to direct to an article?
    public class TryThis {
        
        public static void main (String args[]){
    
             Child c = new Child();
             c.seeSuper();   
        }
    }
    
    public class Parent {
    
         int i;
         
         Parent(){
              i = 3;
         }
    }
    
    public class Child extends Parent{
    
         Child(){
              //i = 4;  //***
         }
         
         public void seeSuper(){
              System.out.println(super.i);
         }
                        
    }
    Note: Parent could also simply look like this:
    public class Parent {
         int i = 3;
    }

    I see now that it is wrong to use the word 'object '.

    No, it isn't.

    they are there for the child to use, object

    That's where you're going wrong. Don't think about "the parent" and "child object. There is only one object, and it is mentioned by "this". You should think about members of the base or the classes and members of the (current) derived class. They are all members of the 'object', but the members of the base class can be hidden by the current members of class with the same name. That's all. Nothing too special about it.

    but they aren't the fields of it.

    Yes they are, but if they are hidden by local declarations that they are not visible to 'this', only to 'super '.

  • How to access the static class variable calendar / singleton?

    How can I access a timeline of a static class variable / singleton?

    You can pass any object to display list to your class when instantiating it.  all objects in the display list has a placement property that allows access to the stage and them you can use the correct path/name to your variable.

  • How to access the inner class fields in refleciton?

    I have:
    class Outer {
        class Inner {
            int field;
        }
        Inner inner;
    }
    I use reflection to get the Outer.field field and recognize that it is a reference to the inner class. What should I do to get the inner.field (or something that looks remotely like this at Inner.field)?

    We would like to

    Well, precedent is too messy for me even follow my example. I've simplified it, and I think I found where my error was. I suspect that you were doing a similar error:

    package scratch;
    
    import java.lang.reflect.Field;
    
    public class Scratch {
    
      public static void main(String[] args) throws Exception {
        new Scratch().go();
      }
    
      void go() {
        Outer1 o1;
    
        Field[] fields = Outer1.class.getDeclaredFields ();
    
        for (Field field : fields) {
    
          final String fn = field.getName ();
          final Class ft = field.getType ();
          final Class fc = field.getClass ();
          final Class fdc = field.getDeclaringClass ();
    
          System.out.println ();
    
          System.out.println ("Outer1 field : " + fn);
    
          System.out.println ();
    
          System.out.println ("field's class (field.getType()) : " + ft.getName());
          System.out.println ("field.getType().isMemberClass() (" + ft.getName() +" isMemberClass()) : " + ft.isMemberClass ());
          System.out.println ("field.getType(). getDeclaringClass() (" + ft.getName() + "'s declaring class) : " + fdc);
    
          System.out.println ();
    
          System.out.println ("field.getClass()) : " + fc.getName());
          System.out.println ("field.getClass().isMemberClass() (" + fc.getName() +" isMemberClass()) : " + fc.isMemberClass ());
          System.out.println ("field.getClass().getDeclaringClass() (" + fc.getName() + "'s declaring class) : " + fc.getDeclaringClass ());
    
          System.out.println ();
    
          System.out.println ("Note the difference between Field.getClass() (" + field.getClass () + ") and Field.getType() (" + field.getType() + ")");
    
          System.out.println ();
        }
      }
    }
    
    class Outer1 {
      class Inner1 {
      }
    
      Inner1 i1;
    }
    
    Outer1 field : i1
    
    field's class (field.getType()) : scratch.Outer1$Inner1
    field.getType().isMemberClass() (scratch.Outer1$Inner1 isMemberClass()) : true
    field.getType(). getDeclaringClass() (scratch.Outer1$Inner1's declaring class) : class scratch.Outer1
    
    field.getClass()) : java.lang.reflect.Field
    field.getClass().isMemberClass() (java.lang.reflect.Field isMemberClass()) : false
    field.getClass().getDeclaringClass() (java.lang.reflect.Field's declaring class) : null
    
    Note the difference between Field.getClass() (class java.lang.reflect.Field) and Field.getType() (class scratch.Outer1$Inner1)
    

    field.getClass () does NOT get the class of the field. It get the class of the field object that points to the field reference variable, which is always java.lang.reflect.Field. To get the class of the field, use field.getType ().

    Do you see the difference?

    Edited by: jverd February 5, 2011 17:18

  • Access the parent class function

    Hey guys

    I have a .fla with little code file in the control panel actions.

    A bit of code calls a function in a class of the Panel actions

    Run the function in the class, but I want to be able to call a function in the Panel code main actions of the function in this category

    The class is not anything extend (parent as MovieClip) .function () does not work

    Any ideas?

    Thank you

    Chris

    There is code in your class:

    private var tl:MovieClip;  import the class mc.

    public YourClass(mc:MovieClip) {} funciton

    TL = mc;

    .

    .

    }

  • Windows 7 won't let me access the files (my documents, my downloads), but the programs work very well!

    Currently, I am running windows 7 Ultimate on my desktop I built. My computer starts up fine, no problem when I connect and I can run all my programs like itunes, security suite norton, chrome, Picasa and Microsoft word work completely fine. There is no problem to save things on Word view my photos on Picasa (which is on the C drive) or by playing songs on itunes (which means that I can access my hard drive through programs), but when I try to open the downloads folder, it shows a popup that says: "this operation has been cancelled due to restrictions in effect on this computer. Please contact your system administrator. "and does not open the file. The problem is that I AM the administrator account on the computer! However, when I open things in my libraries such as My Documents or my music, there just a blank page, saying that I have no files in this folder, but I have files in all of these files: photos, all my music itunes and documents.

    The interesting thing is that I can save documents to the word to My Documents and it will be displayed at the beginning, but when I close the My Documents window and reopen it, the file disappeared and the folder is 'empty' again.

    Currently. I have 2 hard drives connected, a seagate 1 TB and a supplement of 250 GB. Both of these drives appear in disk management, so that the computer knows and is able to see are how many gb on them. Apart from this recognition, when I open the start menu and press computer, it only shows my USB and my CD player, nor of my hard drives. I know that computers are connected correctly as they hum and dry as usual. I am very worried about what is, be it a virus, bad connection, settings that have been changed for any reason any.

    Please help me understand why Windows 7 won't let me access my files through programs, but not in Finder Windows, I have very important files on this computer that I can't lose!

    Windows 7 has a feature of self defense which is a pain.

    He doesn't like files from other computers,

    Right-click on the folder and select properties and see if there is a release button.

    Repeat for external drives.

  • Problem accessing the Web Analysis Document


    Hello

    I created a document for web analytics users can open the workspace. I am trying to assing correct users supply so that they can open the document, but I am not able to do. Users already have access to the folder where the document (they are able to open other files that are in the same folder). Statement of Directors are able to open the document. How to configure all other users of the database (not adinistrators)?

    Basic users have the following reports, assigned shared services roles: Analyst, Viewer to dynamic, Explorer, runner work, personal page editor, editor of personal settings, Viewer.

    Administrative users have the following roles for reporting: reporting and analysis administrator.

    Basic users are not supposed to be able to delete and move documents.

    The minimum base users need to open the Web analysis report seems to be "Content Manager".

Maybe you are looking for