Give a name of addChilded object instance

I'm AS newbie and I'm in trouble with instance names, classes, methods, and object addChilded...

Here's my code:

-J' have a class that (whenever the function is called by the timer) adding an object (class "Monster") to the scene.

public void onTick(timerEvent:TimerEvent):void

{

var newEnemy:Monster = new Monster();

Army.push (newEnemy);                              the army is an array

addChild (newEnemy);


for each (var enemy: Monster in the army)

{

//move the object

etc.etc.

}

}

- and I have another class called 'Base' that add to the scene a (class 'Weapon') object whenever the function is called by a timer. 'Weapon' has another function which is called by another clock, which moves the object in the scene.

IN THE Base CLASS:

public void Launch(timerEvent:TimerEvent):void

{

weapon var = new Weapon(sinX,sinY,power,65,240);

stage.addChild (gun);

}

IN a weapon of CLASS:

public void MoveWeapon(timerEvent:TimerEvent):void

{

     x = x + Vx;

     y = y - Vy;

COLLISION

}

Ok... Probably I have posted the code more ugly and bad, you've never seen, but now I want to explain what I want to do:

I want to insert the hitTestObject in the MoveWeapon function to have during a weapons launched hit one of the generated enemy weapon and the enemy will crash removed from the scene.

Sounds easy when I immaginated, but when I went to write the code I didn't know what to pass to the method (this.hitTestObject (?)).

I only know that my enemies are gathered within a table, but how do I call them? What is the name of the instance?

I also tried to avoid the problem by changing my point of view; so I inserted the hitTestObject test in the loop for each (var enemy: Monster in the army) , but the same problem occurred, I have a lot of bullets that does not have an instance name (or they have a).

That's what I've created so far (if you can): http://www.box.net/files#/files/0/f/64218257/1/f_594818839

Can someone help me?

You can simply use the army to target enemies.  Impossible to assign instance names to dynamically added content.  You can add a value to the name property, but this isn't an instance name, and it is unnecessary, since you don't have a direct access to the via the table... as in...

this.hitTestObject (army [index])

Tags: Adobe Animate

Similar Questions

  • Is it possible the give a name to an object of decoration?

    Hello world

    I would like to change the colors of some squares of decoration (not too sure what is the English word for this but I don't know who are indicators or commands and objects that serve just decoration) on my front pannel. The problem I have already met a year ago was that, when I add a new object of decoration, all the parameters related to the my provious objects are shifted... And it's very annoying when constantly adding new items...

    Has this changed? Is it possible to give a name to an object so that it not be moved...?

    If there is no change, I have to use the backgroung of an indicator, but it will seem not as good...

    Thank you very much

    Kind regards

    User

    http://decibel.NI.com/content/docs/doc-6496

  • View object instance read cache - from anywhere in the application?

    Hello. All,

    This seems to be a difficult question.

    I have a table of user information and have defined the subject entity and object view for him. I have also written a method reduceToOneUser which reduces the instance of the view object for that one line, based on user input.

    1. they are made, as in the flowchart on page of struts - config.xml, starting the flow by a loginDataPage, who passes to the dataAction_1.

    2 dataAction_1 called the reduceToOneUser, which effectively reduces the view to a single line object instance. dataAction_1 is transferred to the dataAction_2.

    3. now dataAction_2 is not just before a next node, but must send to one of SEVERAL nodes according to the values of the attributes in the instance of the view object.

    And the challenge is here. I know that the instance of the view object is there, the cache is there, but how to get the values of the attributes of the object instance in the cache of the view view when I'm in the DataAction java object? (I created the class of AuthenticationAction by double clicking on the authenticationDA icon in the page flow diagram.)


    < pre >

    package zb.view;
    to import java.util.Enumeration;
    to import javax.servlet.http.HttpServletRequest;
    Import oracle.adf.controller.struts.actions.DataAction;
    Import oracle.adf.controller.struts.actions.DataActionContext;
    Import zb.model.BillViewImpl;
    Import zb.model.ZBModuleImpl;

    SerializableAttribute public class AuthenticationAction extends DataAction
    {
    protected void findForward (DataActionContext actionContext) throws Exception
    {
    I can get the user entry OK:
    HttpServletRequest request = actionContext.getHttpServletRequest ();
    The ID of the string (String) = request.getParameter ("id");
    Chain pin (String) = request.getParameter ("pin");
    System.out.println ("ID:" + id + ", PIN:" + pin);

    Here the findForward ("toValidate") works fine and passes it to the page that the
    before toValidate points to. But in the logic of my profession, one of the attributes of the view object
    instance must meet certain conditions before the user is forwarded to this page. So I have
    need to get the attributes. - But how?
    actionContext.setActionForward (actionContext.getActionMapping () .findForward ("toValidate"));
    }
    }

    < / pre >


    I am a newbie. My approach here is appropriate? Is there a better way? It is very appreciated if someone can help out me. Thank you very much!




    Newman

    Newman,
    Now you have a configuration problem. I told you that the code comes from an earlier version of struts and may not work in your case.
    The good news is that google is your friend :-)

    This document gives an overview on your version adf data binding.

      protected void findForward(DataActionContext ctx) throws Exception {
        /*
         * "EmpService" is the name of the application module
         */
        EmpService svc = (EmpService)ctx.getBindingContext()
                                         .findDataControl("EmpServiceDataControl")
                                         .getDataProvider();
    
            // use the application module as you like ...
      }
    

    The code above show how to get the application module that is associated with a data control (from the doc above).

    Here are a few links: [link1 | http://forums.oracle.com/forums/thread.jspa?messageID=670290򣩒] and [Link2 | http://forums.oracle.com/forums/thread.jspa?messageID=719824򯯐]

    If you like some more try [this research | http://forums.oracle.com/forums/search.jspa?threadID=&q=%2Bdataaction+%2Bapplication+%2Bmodule&objID=f83&dateRange=all&userID=&numResults=15&rankBy=10001]

    Timo

  • Retrieve the name of the App Instance in the adapter

    Hello

    I'm trying to get the name of the App Instance in the adapter, it was not able to do this using a standard adapter set Variable.

    Could someone provide your comments on this. I tried mapping using information request, but was not able to get through it.  Appreciate your comments on this.

    I'm looking for is, I have a connected Instance of App created attached to RO / res IT. I have attached a custom adapter, I try to get the name of the App Instance I ask in the adapter.

    Use case is as below:

    1. the user requests App Instance in the catalog search screen

    2. from the successful presentation of the request, I invoke adapter where I need to get the instance of the application that the user requests.

    Thank you

    REDA

    Using the key to process Instance and the name of the object resource:

    Instance of account = null;

    Research of SearchCriteria = new SearchCriteria (ProvisioningConstants.AccountSearchAttribute.OBJ_NAME.getId (), resourceName, SearchCriteria.Operator.EQUAL);

    List accountsProvisionedToUser = getProvSvc () .getAccountsProvisionedToUser (take, true null, search),

    ACCOUNTS:

    for (account: accountsProvisionedToUser) {}

    If (account.getProcessInstanceKey () .equalsIgnoreCase (processInstanceKey)) {}

    instance = account;

    LOGGER.log (Level.INFO, "account Instance Found: Ouedraogo Key:"+ account.getAccountID () ');

    ACCOUNTS of break;

    }

    }

    The name is instance.getAppInstance () .getApplicationInstanceName)

    -Kevin

  • How the names of the objects are defined for the getAnnotRichMedia() to use?

    I have seen several examples in which accesses the getAnnotRichMedia(0,name) a SWF or FLV file by using the name of the object. Rm1 seems to be the automatic value for the first time in the array of objects accessible through getAnnotsRichMedia (0) [0].

    I imagined the name field is defined in the file SWF or FLV. to be defined as one layer in the PDF file. to be set as a parameter when the object is placed in the file; a property of the object defined during construction and, finally, to be fixed by a script of the iterate document objects rich media on the page.

    Unfortunately, the SDK gives a lot of description but does not give the simple example I need.

    Can someone tell me how it's done?

    The name is automatically assigned when the annotation is created. It's an internal concept, so it is read-only - you can not change it with scripts and it is not collected all parameters of the media file or via the dialog boxes.

  • linking the name of the object to the object outside the scope

    In the first function homeL adds the text field "restMenu", when it is called. In another function, the hideTarget method is called and it checks to see if the name of the objects is "instance5" which is the name of homeL. Is it possible to connect a name of objects to the object because I get:

    The supplied DisplayObject must be a child of the caller.

    at flash.display::DisplayObjectContainer/removeChild()

    When I try to use the line in bold. BTW, little code has been removed to illustrate the point.

    function showTarget(obj:Object):void {}

    var i: int = getTarget (obj);

    var restMenu:TextField;

         j++;

    If (I == 0 & & j == 4) {}

    restMenu = getRest ("home"); the rest of the menu shows

         }

    getter.menuObject = restMenu;

    If (restMenu! = null) {}

              if (j == 4) {

    homeL.addChild (getter.menuObject);

              }

    }

    }

    function hideTarget(obj:Object):void {}

    If (getter.menuObject! = null & & obj.name == "instance5") {}

    homeL.removeChild (getter.menuObject);

         }

    }

    You can use getChildByName() applied to the parent of objects to retrieve an object for the name property reference.

  • Can I change the name of the object to measure report

    Hi, I'm new to TS! Can I change the name of the object to measure report? Who can help me. Thanks in advance!

    «Under normal circumstances, I finished the test USE, TS generated the report like this "report [13-29-06] [4F492CAB04] [2012-11-28] .html'.»

    Can I change something, when TS report will like this"report [13-29] [4F492CAB04] [2012-11-28] .html' without seconds!

    One way is to modify the process template.

    Locals.ReportFilePath saves the name of the report. You can access only functions (such as SerachAndReplace) to create the new ReportFilePath.

    In the model sequential process step determine the path of the report file provides the path to the report file using the report options settings. Custom code can be placed after this step.

  • What is the name of the object that I use to put in properties when setting up my acer built in webcam

    name of the object to set properties for built in webcam

    Hello

    Check with the Acer Support, their documentation and online drivers.

    Acer - USA - Service and support
    http://us.Acer.com/AC/en/us/content/support

    Acer - drivers and downloads
    http://us.Acer.com/AC/en/us/content/drivers

    Acer - worldwide
    http://www.Acer.com/worldwide/selection.html

    ============================

    Troubleshoot camera connection
    http://Windows.Microsoft.com/en-us/Windows7/Troubleshoot-camera-connection-problems

    The methods below are for Windows 7 - Vista and XP are similar.

    Vista references apply to Windows 7.

    You probably need to recharge the device drivers and any software control of the 'IF' camera, there is
    everything for Windows 7.

    Login as an administrator.

    Double-click Control Panel / Device Manager - Imaging - writing down of the brand and model of camera.
    on this subject and on the tab of the driver is version. Now, click on update drivers (who are unable to do anything as MS
    is far behind the pilots of certification). RIGHT click on the camera - UNINSTALL - REBOOT - it
    will update the driver stack.

    Now, go to the system manufacturer's website and download the latest driver for the camera and the other related camera
    software (if not more recent get the same).

    Download - SAVE - go to them and RIGHT CLICK - RUN AS ADMIN - reboot after each driver.

    Look at the sites of the manufacturer for drivers - and the manufacturer of the device manually.
    http://pcsupport.about.com/od/driverssupport/HT/driverdlmfgr.htm

    Installation and update of drivers to 7 (update drivers manually using the methods above is preferred
    to make sure that the latest drivers from the manufacturer of system and device manufacturers are located)
    http://www.SevenForums.com/tutorials/43216-installing-updating-drivers-7-a.html

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • Track of the names of the objects for stocks?

    Can someone provide organizational practices, that I can use to keep track of the many names given to objects that will be used in advanced Actions? Here's something that you would print with a screenshot? I can see how it's easy to lose track of the names as I build in Captivate.

    Thank you

    I always label each object, group to be used in Advanced/shared actions. Match by naming: I'll start each name with 1/2 characters identifying the nature of the object: T_ (for containers of text), Bt (for buttons), SB (for form buttons), I_ (for images), Gr_ for groups.

    Don't you know that you can filter in the drop-down lists in the advanced Actions dialog box and in the settings dialog box. Type a sequence of characters that appear anywhere in the name, and the list is filtered on the objects with this sequence. Example: type "co" and objects with name 'v_counter', 'T_Code', 'I_cow' will remain in the list.

  • I tried to re - install Adobe reader on my Mac several times. Ask my PW and give my name. I just got a new PW without success. I have delete my name and put my email address. No help.

    Cannot re - install the Adobe reader software. Says "Adobe reader wants to make changes" and gives my name not Correo electronico then asks a PW. I received a new PW and may sign on Adobe.com, but am unable to install Adobe reader on my Mac.

    Enter the password of your Mac.

  • Feature request: provide the option to display the names of the objects instead of MoRef in the generated code

    Currently, the generated code contains the value MoRef.

    We can't provide an option to display the name of the object?

    ____________

    Blog: LucD notes

    Twitter: lucd22

    Hi LucD,

    Thanks for the suggestion!

    Indeed, it will be very useful. However, its implementation is not trivial. Onyx is currently working as a passive proxy between the server and the client. And information on the names of the objects are not available in SOAP messages. This means that Onyx will generate calls to the server to retrieve the name for help be MoRef, i.e. Onyx will be not only proxy, but also a customer. Despite this us will search if there is a way to implement this or a similar feature.

    I did your suggestion as a feature request in our database, and it will be considered for a future version.

    Kind regards

    Ignat

  • Print the name of the object

    Hi all

    I am new to Java, I would print the name of the object below apprenticeship program.

    Output should look like

    velo1 rate: 40 speed: 12 gear: 1
    bike2 Cadence: 50 speed: 60 Gear: 2

    What are the changes that I have to do to get the desired result.
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package abbhilash;
    
    /**
     *
     * @author admin
     */
    
    class Bicycle {
        int cadence = 0;
        int speed   = 0;
        int gear    = 1;
        
        void changeCadence(int newValue)
        {
            cadence = newValue;
        }
       
        void changeGear(int newValue)
        {
            gear =newValue;
        }
        
         void increaseSpeed(int increment)
        {
            speed = speed + increment;
        }
         
          void decreaseSpeed(int decrement)
        {
            speed = speed - decrement;
        }
          
          void printStatus()
          {
              System.out.println("Cadence :" + cadence + " speed :" + speed
                      + " Gear :" + gear);
          }
        
    } 
    
     class BicycleDemo {
         
         public static void main(String[] args)
         {
             //create two bicylce objects
             Bicycle bike1 = new Bicycle();
             Bicycle bike2 = new Bicycle();
             
             bike1.changeCadence(40);
             bike1.changeGear(1);
             bike1.increaseSpeed(12);
             bike1.printStatus();      
             
             bike2.changeCadence(50);
             bike2.changeGear(2);
             bike2.increaseSpeed(60);
             bike2.printStatus();
             
         }
        
    }
    Thank you
    Rambeau

    Hi Raghu,

    Here, you already have the object, in order to have the name of the object. All you need is to print name. For example, you can pass the name of object as a parameter to the printStatus() method and you're done. Code changes are below:

    void printStatus(String name)// here String parameter is added
          {
              System.out.println(name + " Cadence :" + cadence + " speed :" + speed
                      + " Gear :" + gear);
          }
    

    And inside the method main calls the method printStatus() with the name of the object.

    bike2.printStatus("bike1 ");      // calling with the name of object
    bike2.printStatus("bike2 ");
    

    Amit

  • Cannot change the name of the objects

    I have several problems with a great Captivate 7 project. Especially for that matter...

    I can't change the name of my objects (text of legend, smart shape, etc.). When I change the name, it restores the original name assigned. I left Captivate, cleared cache, restarted...

    Any ideas?

    Jack

    Have you tried to delete the Preferences folder? It may be damaged... You will lose any customization, but could be the solution here. Customize you a lot?

    Lilybiri

  • name of the object in a string

    I want to create an XML file I can change for different languages.  It contains the names of the fields that have the text and the text that they should be replaced by: for example. < name lang = "titleLabel" value = "This is the title of the app" / >.  I can read the XML rows in a table, but I can't understand how to use the name as object name:

    var labels: Array = new Array();
    var lblNumber:int = 0;
    for each (var lbl:XML of in langFile.children ())
    {
    Labels [lblNumber] = lbl.@name;

    How to use what is contained in the labels [1] under the name of the object? for example (labels[1].@name) .text = labels[1].@value

    }

    Use the scoreboard operator to force the flash to fix ropes to objects:

    This [[lblNumber] labels] .text =

  • By assigning a name to an object timeline (CP4)

    Is it possible to name the layers/objects in Captivate 4 scenario? I am aware that each item in the timeline is a separate object. For example, I create a slide of a software interface with several legends of rollover slidelets. When looking on the timeline, they are all called rollover area or slidelet. Because they all share the same name on the timeline, I don't know which Rollover is in front of an another reversal. I want to provide each turnaround a distinctive name to make it easier to identify each item.

    Hello

    I'm sorry, but do not know a way. One new features less spoken in CP5, which I appreciate, is that now the marked objects will appear with their label on the timeline (and also in the view of Advanced Interaction). As you can see from this screenshot, it's probably what you want and what is not possible in CP4. Hope you don't mind this response, which is not really an answer (and I do not work for Adobe, don't forget).

    Lilybiri

Maybe you are looking for

  • Illegal transfer of SSL error

    When you use a site Web that I have not had any problems with it, as soon as I click to enter the secure section I get this message:An error occurred during a connection to ols2.rta.nsw.gov.au. Even SSL rejected a unacceptable content handshake messa

  • How the switch "selector selection" cut

    Hello I would like to ask if anyone knows how to disable the tip in the case selector or a sequence of structures. The tip window always appears and hides the parts under him. I don't have the trick with no specific information. (see photo) Greetings

  • Windows XP - monitor not turns off, power turns off after 5 minutes options the Auto value not

    sys is xp * original title - I can't disable the monitor in auto. power options are set to turn off monitor after 5 min, but it never turs of when I stop using the unit *.

  • Why can I not set my printer as printer defaoult?

    I have Windows 7 on my comp. Office and may not have to allow my Canon MX472 to the default printer.  I tried to go through the start-up devices. / default printer and it always gives me an error code "operation failed" and the code 0 x 00000709.  I

  • What should I do if it tells me that the serial number is not fair?

    I'm trying to move my computer to a new adobe software. I disabled it on the old computer and connected with my Adobe this identification code is asking me a serial number and I went to the not-for-profit that I get my license to and got the serial n