Remove the problem of the child

Hey there,

I created a simple system foe in a game, I am spawning. Enemies move on the stage, and when they move out of the scene I want to delete them. Here is the code for spawning and remove them:

if (enemyCooldown == 48)
                              {
                                                  var enemy1:MovieClip = new EnemyGoLeft;
                                                  var enemy2:MovieClip = new EnemyGoDown;
                                                  var enemy3:MovieClip = new EnemyGoRight;
                                                  var enemy4:MovieClip = new EnemyGoUp;
                                                  stage.addChild(enemy1);
                                                  stage.addChild(enemy2);
                                                  stage.addChild(enemy3);
                                                  stage.addChild(enemy4);
                                                  enemy1.y = ((Math.random()*700)+50);
                                                  enemy2.x = ((Math.random()*1100)+50);
                                                  enemy3.y = ((Math.random()*700)+50);
                                                  enemy3.x = 1200;
                                                  enemy4.y = 800;
                                                  enemy4.x = ((Math.random()*1100)+50);
                                                  enemyArray.push(enemy1);
                                                  enemyArray.push(enemy2);
                                                  enemyArray.push(enemy3);
                                                  enemyArray.push(enemy4);
                                                  enemyCooldown = 0;
                              }
                              else
                              {
                                        enemyCooldown ++;
                              }

                              for each (var enemy:MovieClip in enemyArray)
                              {
                                        if ((enemy.x > 1250) || (enemy.x < -50) || (enemy.y > 850) || (enemy.y < -50))
                                        {
                                                  stage.removeChild(enemy);
                                        }
                              }

When the enemy goess off stage, I get the error message:

ArgumentError: Error #2025: the supplied DisplayObject must be a child of the caller.

at flash.display::DisplayObjectContainer/removeChild()

referring to this line, of course:

stage.removeChild (enemy);

I tried parent.enemy, stage.parent.enemy, a few other things, you still get the same error. Any ideas?

Thank you

The splice method does not have an object as an argument.  You must provide the index of the object in the array to splice it

Tags: Adobe Animate

Similar Questions

  • Problem with remove the child to

    I have an empty clip that contains text and media for executives in a lesson called content_mc

    I load dynamically in a text box and then other things such as graphics, videos and other swf files...

    before you begin to insert swf files, it worked very well, but it was just the text on the screen, now that I have other media, it removes "randomly" children and I can't understand why it's what I use:

    for (var c:uint = 0; c < content_mc.numChildren; c ++) {}
    trace (c + ":" + content_mc.getChildAt (c) .name);
    content_mc.removeChildAt (c);
    }

    Anyone know what is happening?

    Figured it out!

    OK, for those of you who want the answer to this, but don't want to pay for it...

    I realized that when you use the removeChildAt() she removes the child of the index number... so the way I did it was like this:

    for (var c:uint = 0; c
    trace ("-" + content_mc.getChildAt (c) .name + "(" + c + "')");
    content_mc.removeChildAt (c);

    doing this, he was first to remove the child at index 0. and what made flash NOW are "slides" down an index... so the element that was at index 1 is now 0, the element at index 2 is now 1, etc... so when I arrived at the last, it would not remove it because it was no longer there...

    but change to it (instead of using the variable c, you have just put 0 in the index box):
    for (var c:uint = 0; c
    trace ("-" + content_mc.getChildAt (0) .name + "(" + c + "')");
    content_mc.removeChildAt (0);

    solved the problem :)

  • Remove the child window Parent using WIN API

    Hi all

    For a parent-child relationship between two screws using the User32.dll I use the SetParent function and pass the handle of the parent VI and VI child to this function. Now, after this relationship has been established, I want to remove the child from the parent window and use it as an independent VI using WIN API. Can someone help me on this?

    Thanks in advance!

    Fragger Fox!

    Hi Fragger Fox,

    I think that it should be possible, if you assign a new parent to the child. Maybe this works if you assign the desktop as a new parent.

    It will be useful.

    Mike

  • doubt everything by removing the child records

    Hi people,
    I have a table with following structured Teg.

    SQL > DESC TEG
    Name Null? Type
    ----------------------------------------------------- -------- ---------------
    A NON NULL NUMBER (38)
    B NUMBER (38)
    C NUMBER (38)


    where A column is the primary key column and column B is foreign key
    According to column A column.


    SQL > select * from teg.

    A, B AND C
    ---------- ---------- ----------
    10 10 30
    20 10 40
    30-20-90

    now, these are the data present in this table.now I want to delete a recording of teg, where A = 10.but I couldn't do because I have child records according to values.so primary key, I decided to delete records by using the statement.

    SQL > delete from the teg where b = 10;
    Remove from the teg where a = 10
    *
    ERROR on line 1:
    ORA-02292: integrity constraint (VID. TEGFK) violated - book of the foundling

    but throws with this error.then I tried to remove another
    Save the Declaration,

    SQL > delete from the teg where b = 20;

    1 line removal.

    but I got that last removed the table.why file I couldn't remove data using State 'WHERE B = 10'.but able to delete the record
    with "WHERE even if the parent record is A found.pls = 20' help me."


    Concerning
    VIDS

    vidusnat wrote:
    SQL > SELECT * FROM TEG.

    A, B AND C
    ---------- ---------- ----------
    10 10 30
    20 10 40
    30-20-90

    as I could delete record of TEG by issuing,

    REMOVE FROM THE TEG WHERE B = 20;

    Yes, this means that you remove a record of a value in column A of 30 (for B = 20) - there is no trace of the child who refers to this record with a value in column A of 30, so you can REMOVE that record without problem.

    vidusnat wrote:

    But why I couldn't delete records to aid,

    REMOVE FROM THE TEG WHERE A = 10;

    10 and 20 are present in the primary key column A.but why am not able to delete the address of the child column B.I don't know no other integrity constraints have been create except between column A and B.pls suggest me.

    There must be a record in the referencing table that has a foreign key value 10 - don't forget on the deletion of a record of the child in column B, you can delete an entire record, not a partial record. The table that references must be another table, it is not another column in the same table -it does not work like that. A foreign key between tables , not within the same table.

    Run this code, and you'll see what other table of the foreign key means:

    SELECT table_name
       FROM ALL_CONSTRAINTS
     WHERE CONSTRAINT_NAME  = 'TEGFK'
    

    That will tell you the other table that has a foreign_key associated with your table TEG.

  • Remove the child as an object Array

    I wrote this little script, because I want to remove some of the fields that are currently listed in the objectives of the display, however she does not see the textfield as varaible name. How to convert the object to a table to become a textfield that can be removed, after have been added through

    addChild()

    This is the script

    var delayHeading:Number = 1500;
    var repeatHeading:int = 1;
    var setShow:Timer = new Timer (delayHeading, repeatHeading);
    setShow.start ();
    setShow.addEventListener (TimerEvent.TIMER_COMPLETE, maybeLater);

    var delayeading:Number = 1500;
    var repeateading:int = 1;
    var sethow:Timer = new Timer (delayeading, repeateading);
    var childnames:Array = new Array();

    var nametxt:TextField;


    function maybeLater(event:TimerEvent):void {}
    var tft:Number = 10;
    for (var i: Number = 0; i < 10; i ++) {}
    nameTxt = new TextField();
    nameTxt.Text = "YouandMe" + i;
    nameTxt.y = tft + 10;
    addChild (nametxt);
    childnames.push ("nameTxt");
    }
    sethow. Start();
    sethow.addEventListener (TimerEvent.TIMER_COMPLETE, removeAllThis);
    }


    function removeAllThis(event:TimerEvent):void {}
    for (var b:Number = 0; b < childnames.length; b ++) {}
    removeChild (childnames [b]).
    childnames.pop ();
    }
    }

    This is the error I get

    TypeError: Error #1034: Type coercion failed: cannot convert "nametxt" in flash.display.DisplayObject.
    at Untitled_fla::MainTimeline/removeAllThis()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.utils::Timer/tick()

    Any suggestions would be beneficial

    Thank you

    You may encounter problems try to pop things from one end while eliminating things from each other.  Try instead the following...

    function removeAllThis(event:TimerEvent):void {}
    var childCount:int = childnames.length;
    for (var b:Number = 0; b< childcount;="" b++)="">

    remove from the scene and the table of a sudden
    removeChild (getChildByName (childnames.pop ()));

    }
    }

  • Remove the child conditional statement

    I have a video added to a mc:

    mc.addChild (video);

    I need to create a conditional statement to see if 'video' is loaded in my mc so I can remove it to add an image in the mc

    If (mc ==... 'video') {}

    removeChild (video);

    mc.addChild (image);

    }

    Don't know how to create the part 'if '.  Any suggestions?

    Try:

    {if (MC. Contains (Video))}
    mc.removeChild (video);
    }

  • Permission of the child

    Summary of the issue
    Other issues of the Windows Live ID

    Please provide your address affected:
    E-mail address is removed from the privacy *.

    Additional details
    I have accounts of electronic mail for my 2 children and had their accounts set to have me give permission whenever they wanted to add a friends email address.  My daughters are now old enough that I would like to remove this feature.  However, I have difficulty finding ways to remove the feature.  I don't remember how I have set up in the first place.  Can someone help me?

    Hi the rules of Softball,

    To remove the account from the child that is managed by Windows Live Family Safety. You must delete the child's account in fss.live.com using the parent account and uninstall the client of Windows Live family safety on their computer. To do this, please follow the steps below:

    A. remove the child in fss.live.com account

    1. connect to http://fss.live.com using the parent account.
    2. click on the remove a member of the family link.
    3. check the box for the account you want to delete.
    4. click on the Remove button and confirm the deletion.

    B. uninstall your Windows Live parental control over the child's computer to delete the current settings.

    Uninstall Windows Live Family Safety

    Let us know if you need more assistance.

    Thank you!

  • Delete form for the child process data

    Hello

    I have a form of child process for my multivalue attributes. I would like to delete one or more entries from the shape of child process via the API data, but the only API that I found was removeProcessFormChildData. But I guess this method deletes all data in the form of child process. Is there an other API I can use? How to remove the child process form data?

    Thank you
    PETREA

    See this thread for an example of code:

    Re: How to remove the child form data table

    For more examples, just look for the api and you should be able to present to a code example.

    -Kevin

  • I have a problem with removing programs from the childs account.

    Original title: how to remove programs from my childs account?  He said that you are not allowed (as it should), but does not other options.

    I was cleaning my sons account and could not uninstall or remove most of the things.

    Its been a problem since I bought this new computer.   Some programs such as Adobe Flash, Chrome, etc. installed on my account, but not on other accounts.       They must be installed on each user account if they choose to use ie: Chrome, Adobe, Java etc.
    When Adobe Flash is installed for IE it is installed only on the user account that is not installed on the computer. So basically 3 accounts 3 downloads.
    Makes no sense.   However, some programs install to all accounts.
    When I uninstall a program from an admin account it does uninstall not other accounts 2 user.
    Logging into his account, I can't remove or uninstall.   I don't really want to delete the entire account.
    How can I accomplish this?
    Thanks, Denise

    Programs may vary in how they handle the installation and the removal of several accounts.
    I suggest to uninstall those that are a problem, temporarily change the account of the child to the administrator, connect you and make uninstalling and then change it back.   Not an elegant solution, but it should work.

  • Problem: one of the members of the child is not aggregate to the Parent cube ASO

    Problem: one of the members of the child is not aggregate to the Parent cube ASO

    Here is the hierarchical structure of the ASO.

    At ~ Labelonly

    b + shared member

    C + Shared member

    Aggregated Expectated result: A = 150 USD

    b contribution 100 USD

    C contribution 50 USD

    But total shwoing associate for A is currently 100 instead of 150 USD.

    Then, I tried to remove members of 'b' then no value does show for A which means Member 'c' does not participate in the aggregation.

    Please let us know if anyone is facing the similar problem

    One member of the label will always be equal to the value of the first child.  You need to remove to get a sum

  • Problem with a VM server: "the virtual disk parent has been changed since the child was created.

    Hello!

    I have a problem with a server that does not start.

    We had a virtual machine running on VMWare Infrastructure 3 with two hard drives and an instant backup of them.

    This machine has been removed from the inventory, but when it has been recreated, the secondary hard drive is mentioned for the basic-disk vmdk
    instead of being referenced to the instant vmdk and used for a few days.

    All changes made after the snapshot, were kept in the delta snapshot file, which is not loaded.

    We are with difficult to reference the secondary disk for the snapshot file. We tried to edit the .vmx and hard disk files
    to correct the CID made reference, but when we try to start the virtual machine, we got this error:

    "The virtual disk parent has been changed since the child was created.

    I think it happens because we made a blow-up of a secondary drive a few weeks after the backup snapshot. We spent 30 GB to 50 GB.
    And because it has been referenced and used in another vm.

    *** Log is attached

    Thank you

    Bruno.

    It is a bad sign

    next step in the usual forest is to use "testdisk" since a LiveCD to set the tables MBR and partition - if possible

  • remove the problem of reclassification of and truncation

    Hi gems... good afternoon...

    problem 1:

    I have several tables with interdependencies... That is, primary key-foreign key relationship.
    now, first I truncate the child table 1...
    -truncate table child_1;
    and it got truncated with success.
    Then, I tried to truncate the corresponding table of the parent 1...
    -truncate table parent_1;
    then it does not allow me to do so because this table is referenced by this child table 1.
    but when I used the command "delete from '...
    -delete from parent_1;
    then he successfully deleted all the records of the parent 1 table.

    WY, this happened? as per my knowledge, delete and truncate do the same...


    problem 2:

    by the above method, I get to make all the empty tables... and I used only "delete from" command after that...
    but after you remove all of the lines of another child, table successfully...
    -delete from child_2;
    When I tried to delete all the records in the corresponding parent table...
    -delete from parent_2;
    He stopped me again... (am hanged)
    then I had to disable foreign key constraints in the child table 2 and then he allowed me to truncate the table parent 2...

    Please help these behaviors... in both cases the children tables are empty... for a parent-child relationship truncation does not, but ' delete of ' works... on the other hand, for an another parent-child relationship the truncate and ' delete of ' do not work if the foreign key constraints are enabled...

    Because the truncation does not check if there are rows in the child table, it checks only "fk there" and if this is the case, it will fail.

  • I can't remove the thunderbird to my computer. Whenever I do and try to reinstall the old problems developed again. I already formatted the computer... what to do

    I can't remove the thunderbird to my computer. Whenever I do and try to reinstall the old problems developed again. I already formatted the computer... what to do

    But what was your question? virus? most of the time its not even located in thunderbirds dirctories. Then it reappears.

  • Recently upgraded to El Capitan, I had that problem for Mail stop unexpectedly when I saw some posts.  I followed the steps and was able to remove the trouble messages.   Now I can't restore the mail window message viewer component.

    Recently upgraded to El Capitan, I had that problem for Mail stop unexpectedly when I saw some posts.  I followed the steps and was able to remove the trouble messages.   Now I can't restore the mail window message viewer component.  When I try to catch the separator bar to go back to the left, only half of the small arrow icon and line appears, and it cannot be moved.   Can open the message by double clicking a message viewer.

    Hi there, alicefrompa!

    Thank you for using communities Support from Apple. From your post, I understand that you do not see the Message Viewer box which allows you to read your e-mails; only see you the Inbox that includes a brief overview of the message and are unable to restore access using the separator bars. I have had this happen to my own Mail app and am happy to let you know how I could fix!

    You are really on the right track - you want to roll your mouse over the divider between the Inbox and sections Message Viewer (which should now be on the extreme right edge of your mail window) and drag it to the left.  When you click on the receipt/Message Viewer box, the cursor turns into a line continuous black with a single arrow pointing to the left. When you see the cursor change, click with the left button of the mouse and (while holding down the mouse button in) drag the combination line / arrow to the left. You may need to drag a little further than before to get it. I had to hang mine almost completely in the middle of my Mail app before the display of the message box appeared.

    From there, you should be able to adjust the boxes to your widths you want as expected.

    If you are still not able to get the display of the messages visible after have try this, here are a few more things that you can do.

    1. Press command + O on your keyboard.
    2. Exit the Mail application, and then press on and hold the SHIFT key on your keyboard while reopening.
    3. Restart your Mac by selecting the menu  Apple in the upper right of your screen restart from the menu drop down.

    See you soon!

  • After removing the feature new tab, I get a message "problem loading page" instead of a blank page.

    I followed the steps on the help page to remove the feature new tab I hate. So now there is "subject: white ' in the address bar as before, but now, I get this message of 'problem' and I want to just my white back page.

    Hello

    You can try to reset by clicking right on it. You can also try to enter Subject: empty as the value.

  • I removed the toolbars so I could see below thinking that I could easily get them back, but I can't. How can I get back them? I can't even put a new web address now. Or refresh a page. Or go to the front/back. How can I solve this problem?

    I removed the toolbars so I could see below thinking that I could easily get them back, but I can't. How can I get back them? I can't even put a new web address now. Or refresh a page. Or go to the front/back. How can I solve this problem?

    It depends on how you

    1. Choose the Mode "full screen" or
    2. unchecked toolbars

    The F11 key activates / turns off Mode full screen or not. Full screen, you have no toolbars, no tab and no bar Add on (bottom).

    If unchecked you your toolbars (checked = displayed; UN - check = not displayed), and then do one of the following, then click on those you want to check/uncheck:

    If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.

Maybe you are looking for

  • Re: Download Toshiba Bulletin Board for Windows 8

    My wife has a 18V L870 Satellite running Windows 8.She noticed me using my bulletin board on my rather old Toshiba Satellite L650-12 q (with Windows 7) and wants a! Is it possible to download Bulletin Board on his computer, because it is not preloade

  • questions about the message of the user

    I use TS to run a sequence of audit scope nor and want to display measurement in the user interface developed with LV I want just fresh my chart of waveform of the user interface after a measurement is complete if I use the method postusermessageex a

  • Xbox to PC external hard drive sharing

    I have my xbox connected to my pc wireless and when I use the video player for the xbox 360 I can access to the my videos folder but shortcuts to my external hard drive are not displayed. How would I be able to use the connection to access my hard dr

  • Pavilion dv7t-3300: install the kit for SSD dv7t

    You want to install an SSD.  Have the naked reader.  Need for cables, screws, software cloning.  Recommendations?

  • Run DLL error C:\User\Admin\AppData\localLow\quoC2C4.tmp

    C:\User\Admin\AppData\localLow\quoC2C4.tmpRunDLL error is displayed. How to fix it. Photo will be attached below: -.