Problem removing child at end game screen

Hi everyone
I am creating an android app for my university corusework and it is based on shooting alien spaceships as they fly in from the right side of the screen. When my gun is shot enough times the game should go to the end screen, the problem is I need to remove the alien bullets as the game ends. However I keep getting an error of an undefined property. Here is the code for my main timeline:
import flash.events.MouseEvent;
import flash.events.Event;
import flash.display.MovieClip;
//gun control
var upButtonIsDown:Boolean;
var downButtonIsDown:Boolean;
var livesLost:Number = 0;
stop();
btn_up.addEventListener(MouseEvent.MOUSE_DOWN,upDown);
btn_down.addEventListener(MouseEvent.MOUSE_DOWN,downDown);
btn_up.addEventListener(MouseEvent.MOUSE_UP,upUp);
btn_down.addEventListener(MouseEvent.MOUSE_UP,downUp);
//bg
var bgButtonIsDown:Boolean;
bg.addEventListener(MouseEvent.MOUSE_UP,upUp);
bg.addEventListener (MouseEvent.MOUSE_UP,downUp);
stage.addEventListener(Event.ENTER_FRAME,pulse);
function pulse(evt:Event)
          if (currentFrame!=2) return;
          if (upButtonIsDown) mc_gun.y-=5;
          if (downButtonIsDown) mc_gun.y+=5;
          checkforHits();
function checkforHits()
          for (var i:Number=0;i<numChildren;i++)
                               if (getChildAt  is alienbullet)
                                         var ab:alienbullet = alienbullet (getChildAt (i));
                                         if (mc_gun.hitTestObject(ab) && ab.currentFrame==1)
                                                   mc_gun.gotoAndStop(mc_gun.currentFrame+1);
                                                   ab.gotoAndStop(2);
                                                   livesLost++;
                                                   if (livesLost>3) endGame();
                                                   return;
function endGame()
          for (var i:Number=numChildren-1;i>=0;i--)
                    if (getChildAt(i) is alienbullet)
                              var ab:alienbullet = alienbullet(getChildAt(i));
                              ab.killMe();
          gotoAndStop(21);
function upDown (evt:MouseEvent)
          upButtonIsDown=true;
function downDown (evt:MouseEvent)
          downButtonIsDown=true;
function upUp (evt:MouseEvent)
          upButtonIsDown=false;
function downUp (evt:MouseEvent)
          downButtonIsDown=false;
//shoot code
mc_gun.addEventListener(MouseEvent.MOUSE_DOWN,shoot);
stage,addEventListener(Event.ENTER_FRAME,alienhit);
var bulletArray:Array = new Array();
bulletArray.push(mc_bullet1);
bulletArray.push(mc_bullet2);
bulletArray.push(mc_bullet3);
bulletArray.push(mc_bullet4);
bulletArray.push(mc_bullet5);
bulletArray.push(mc_bullet6);
var bulletCounter:Number = 0;
function alienhit(evt:Event)
          for (var i:Number=0;i<bulletArray.length;i++)
                              if (mc_alienA1.hitTestObject(bulletArray[i])) trace("alienA1 has been hit" +i);
                              if (mc_alienA2.hitTestObject(bulletArray[i])) trace("alienA2 has been hit" +i);
                              if (mc_alienA3.hitTestObject(bulletArray[i])) trace("alienA3 has been hit" +i);
function shoot(evt:MouseEvent)
          if (bulletCounter<5) bulletCounter++;
          else bulletCounter=0;
          shootmc(bulletArray[bulletCounter]);
function shootmc(mc:MovieClip)
          mc.visible=true;
          mc.x = mc_gun.x;
          mc.y = mc_gun.y;
          mc.gotoAndPlay(2);
Now the endGame function is supposed to call on this code which is in the package file (script for aliens)
public function killMe()
                                        this.removeEventListener(Event.ENTER_FRAME,pulse);
                                        parent.removeChild(this);
full script:
package
          import flash.display.MovieClip;
          import flash.events.Event;
          public class alien1 extends MovieClip
                    var yMin = 0;
                    var yMax = stage.stageHeight;
                    var yInc = 10;
                    var maxPulses= Math.round(yMax/yInc);
                    var changeDirectionAt = Math.round(Math.random() * maxPulses);
                    var pulseCount = 0;
                    var fireCount=0;
                    var fireAt = Math.round(Math.random() * maxPulses);
                    public function alien1()
                              this.addEventListener(Event.ENTER_FRAME,apulse);
                    function apulse(evt:Event)
                              pulseCount++;
                              fireCount++;
                              if (pulseCount>=changeDirectionAt)
                                        yInc *=  -1;
                                        pulseCount = 0;
                                        changeDirectionAt = Math.round(Math.random() * maxPulses);
                                        return;
                              if (fireCount>=fireAt)
                                        var bullet:alienbullet = new alienbullet();
                                        bullet.x = this.x;
                                        bullet.y = this.y;
                                        parent.addChild(bullet);
                                        fireCount=0;
                                        fireAt = Math.round(Math.random() * maxPulses);
                              this.y +=  yInc;
                              if (this.y <= yMin)
                                        yInc *=  -1;
                              if (this.y >= yMax)
                                        yInc *=  -1;
                              public function killMe()
                                        this.removeEventListener(Event.ENTER_FRAME,pulse);
                                        parent.removeChild(this);
Would really appreciate any help! Thanks

if (mc_alienA1.hitTestObject(bulletArray[i])) trace("alienA1 has been hit" +i);
this is line 103 and is in the main timeline
another error that shows up is
TypeError: Error #1009: Cannot access a property or method of a null object reference.
          at alien1/apulse()[C:\Users\_____\Desktop\DES B\alien1.as:46]
                                        var bullet:alienbullet = new alienbullet();
                                        bullet.x = this.x;
                                        bullet.y = this.y;
                                        parent.addChild(bullet); <<< line 46
                                        fireCount=0;
                                        fireAt = Math.round(Math.random() * maxPulses);

Similar Messages

  • GE620DX gets really hot while playing high end games

    Hi, i just got a notebook GE620DX it works great and performance is really worth it.
    However, my only problem is that it gets really hot while playing high end games.
    It feels so hot that it is like burning your hand if you put it just right the exhaust vent.
    Is this normal with any gaming laptop or there is problem?
    Thanks Very Much!

    Laptop computers naturally run hot (or at least very warm), and if they stay hot for prolonged periods of time they may overheat and cause serious damage. Whether or not you're experiencing the warning signs and dangers of your laptop overheating, the simple and inexpensive protective measures below will help keep your laptop cooler and make it work more reliably.
    5 easy tips to cool a hot laptop
    1. Adjust your power settings from "high performance" to a more "balanced" or "power saver" plan. This will tell the system to only use the power required to run your applications, rather than always using the maximum processor speed; if you need to play games or other intensive work, you can switch back to the high performance plan as necessary.
    2. Use dust remover spray to clean out of the laptop's vents. Dust can accumulate in and block the laptop's fan vents -- a problem easily solved with a can of compressed gas (~$10). Turn off your laptop and spray the vent to remove the dust.
    3. Use a laptop cooling pad that has a fan or two. Laptop pads that have vents but no fans can also increase the air flow around your laptop and they're very portable, but for stronger cooling needs, a fan is the best way to go. For this test, I used a Belkin F5L055 (under $30), but there are also several others selected by this site's previous guide that you can explore or you could even custom build a laptop cooling system if you're so inclined.
    4. Keep your working environment or computer room as comfortably cool as possible. Computers, like most people, work much better in air conditioned environments. Most server rooms or data centers operate at 70 degrees or below, according to Server Fault, and that seems like an ideal temperature recommendation for home offices as well.
    5. Shut down your computer when not in use, and especially when you are not at home. The last thing you need when you get home is to find out your laptop was a fire hazard (one of the dangers of overheating laptops).
    Taking the steps above brought down the internal temperature of an old and dangerously hot laptop from 181° Fahrenheit (83° Celsius) to 106° F (41° C) -- a difference of 41% after one hour of using the active laptop cooling pad and bringing the room temperature down to 68 degrees.
    View more at: http://www.techyv.com/questions/my-laptop-gets-too-hot

  • The file to download the app for Android is not working from my phone--it says that the file isn't there. However it does see the one for the Iphone (even though it can't use it). I'm very computer literate and am pretty sure the problem is on your end.

    The file to download the app for Android is not working from my phone--it says that the file isn't there. However it does see the one for the Iphone (even though it can't use it). I've tried it multiple times and continue to get the same message: "NOT FOUND The requested item could not be found". I also tried through the Market application on the phone but ended-up with the same result.
    I'm very computer literate and am pretty sure the problem is on your end. If this is the case then no one can download the app. I considered that perhaps because it's still in Beta that it was removed due to some other type of software issue. I would really like to use Firefox on my new Droid (2.0); when with this be available?

    Firefox will not appear in the Market for most phones with incompatible hardware. You can check if your phone is supported here:
    https://wiki.mozilla.org/Mobile/Platforms/Android
    Even on some supported devices, a bug in the Market software prevents Firefox from showing up. This may be related to the fairly recent Android Market app update. If you go to Settings/Applications/Market and choose "Uninstall" you can uninstall the update, and then search for and install Firefox from the marketplace.
    Or, if you have a supported phone, you can download the app directly by typing this address into your phone's browser: http://bit.ly/fxbeta3
    (Note: To download the app directly for an AT&T phone, you will have to search for instructions on "sideloading" the APK file, since AT&T disables the option to install from non-Market sources.)

  • Problem removing Zombie GS

    Hey all. Having a problem removing Zombie Gunship from my Game Center. Basically, I want to delete my current progress and start over, thanks to my nephew messing up my config.
    So, I've deleted Zombie GS and it prompts me to remove the data and that my progess will be removed from the leader boards. So I do all that, restart it, blah blah blah. After I've reinstalled the app, my old config/progress/money is still there.
    I've emailed the game company and of course no response. So what am I missing or doing wrong? Or is this a situation where I can never start over?
    Thanks in advance for the help.

    I've got the same problem. I am revisiting the game and I want to start again from scratch but it seems Game Center has other plans for me. Dammit Apple gestapo!

  • Problem removing focused object from a table

    Hi.
    I have a problem removing a component that is focused from a table. The
    whole row is removed except a single component (JSpinner) in one row.
    My table has three columns, the first two are String fields
    (not editable) and the last is a JSpinner. Since there is no
    Default cell renderer or cell editor for JSpinner I had to
    create them.
    So, if no element of the row is focused then calling the function:
    public void clearTable() {
    setVisible(false);
    dataVector.removeAllElements(); // clear data vector
    setVisible(true);
    works just fine
    but if a spinner in a row is focused them that spinner is left alone "floating" on an otherwise empty table.
    Questions:
    1) Any one has an ideia of what might be the problem?
    2) Do I have to play with Focus to solve this? (hate the idea,
    since always been told to avoid messing with focus, because
    of the problems it normally brings)
    Thanks in advance for the help,
    Rgds,
    Jorge

    The problem is that you need to properly stop the editing operation first.if( myTable.isEditing() ) {
        // If you want to throw away any edits use...
        myTable.getCellEditor().cancelCellEditing();
        // If you want to apply any edits, then end use...
        myTable.getCellEditor().stopCellEditing();

  • Need help removing child

    Sorry to bring problems but i am trying to learn some as3 and so far i can not resolve this situation ,,,,,,
    this is the script i am using ,,,,,,,,,,,,,,
    Ent.buttonMode = true;
    Bio.buttonMode = true;
    ent.addEventListener(MouseEvent.CLICK, goEnt);
    function goEnt (e:MouseEvent):void
    var new Ent:MovieClip = new firstIntro();
    this.addChild(newEnt);
    newEnt.x = 659;
    newEnt.y = 428;
    Bio.addEventListener(MouseEvent.CLICK, goBio);
    function goBio (e:MouseEvent):void
    var newBio:MovieClip = new bioIntro();
    this.addChild(newBio);
    newBio.x = 659;
    newBio.y = 428;
    the problem is that when i click on first button the Movie Clip does load ok but when i click on second button the first movie cliip is visible ,,,, i have try everything i have read here but no luck ,,,,,,, i want to learn how to remove first child and allow only the second child to show up ,,,,,,, i am looking forward to add more buttons so the remove child should be for multiple buttons ,,,,, i am learning and so far did purchase a online tutorial but did not help me with this situation ,,,, thank you all in advance ,,,,,

    Create a variable to hold a reference to any child object that is added to the display list, then when any given button is used to add a new movieclip to the display list, use removeChild to get rid if any existing movie clip that was added through the reference in the variable. After the new movie clip is added to the display list, add a reference to that movie clip to the variable so that it can be used when the next movie clip will be added.
    Ent.buttonMode = true;
    Bio.buttonMode = true;
    // create a variable to hold a reference to the currently added child, if any...
    var currentChild: MovieClip;
    ent.addEventListener(MouseEvent.CLICK, goEnt);
    function goEnt (e:MouseEvent):void
    var new Ent:MovieClip = new firstIntro();
    // remove any child object currently in the display list...
    if(currentChild != null) {
    removeChild(currentChild);
    this.addChild(newEnt);
    // put a reference to the added child to the variable...
    currentChild = newEnt;
    newEnt.x = 659;
    newEnt.y = 428;
    Bio.addEventListener(MouseEvent.CLICK, goBio);
    function goBio (e:MouseEvent):void
    var newBio:MovieClip = new bioIntro();
    // remove any child object currently in the display list...
    if(currentChild != null) {
    removeChild(currentChild);
    this.addChild(newBio);
    // put a reference to the added child to the variable...
    currentChild = newBio;
    newBio.x = 659;
    newBio.y = 428;

  • I was trying to move my photos from the iPhoto library to an external hard drive.  I now have a desktop display of thousands of cascading photos.  How do I remove them from my desktop screen?

    I was trying to move my photos from the iPhoto library to an external hard drive.  I now have a desktop display of thousands of cascading photos.  How do I remove them from my desktop screen?

    Strangely enough we can not see you so it really helps if you share with use exactly what you have, exactly what you did and details about the problem
    what version of iPhoto and of the OS? What exact steps did you do? where are you seeing these "thousands of cascading photos" now and using what software and what exactly did you want to accomplish
    The correct way to move your iphoto library to an external drive is to verify the drive is formatted Mac OS extended (journal) and then drag the iphotl library intact as a single entity to is
    The correct way to move some or all of your photos is to select them in iphoto and export 9file menu ==> export  --  https://discussions.apple.com/docs/DOC-4921 ) to the external drive
    LN

  • Squares appearing over game screens

    I have been running code using a Graphics object for over 2 years now without any problems. I havent used any Graphics2d objects and I use double buffering to paint the objects to the screen.
    I use Netbeans and the game can be launched from the web site using webstart.
    The game gets soundfiles when needed from the web site too.
    For the last week there have been ugly texturedsquares moving all over the game screens. This only happens on my development machine.
    If I copy the dist folder with no changes to another pc it runs without any problems. Similarly when the game is launched with webstart from the web site there are no problems on my other machines.
    The sprites look like they belong to some other game and I have at no time written code like this in any of my applications. There are no viruses or malware on the machine and the caches have been emptied, old java versions uninstalled and Netbeans has been updated to latest version.
    The problems started when I visited an IRC channel and I am sure that somehow, something on my pc was changed. I can find no evidence of this and my code has not changed.
    I use classes that paint themselves using image files mostly but these sprites look like they are being drawn using the Graphics2D class.
    The images seen to appear randomly and they change colour and pattern. They dont appear where a repaint is needed and they are larger than my own sprites,
    Does anyone know how I can detect this problem's source?
    I have been writing the game for over 3 years now and I can see no reason why this is happening.
    I dont want to have to format my development machine but it looks like I might have to.
    I would be really grateful for any help with this!

    Have you recently upgraded to 1.6.0 update 10? Are your graphics drivers up to date?
    I ask because update 10 uses more hardware acceleration, and your issue appears to be a graphics card memory glitch, rather than in the Java application layer.

  • Removing the Adobe Captivate loading screen

    Hi,
    Is it possible to remove the Adobe Captivate loading screen on exported .swf files?
    Or if not to remove the loading screen create my own?
    Any help would be appreciated, as a total newbie to captivate!
    Thanks

    Hi there
    Sure is!
    Depending on your version of Captivate things may be worded slightly differently. But here is for version 4:
    Click Edit > Preferences...
    Click the Project node and the Start and End node.
    To turn it off, clear the check mark for the check box labeled Preloader.
    To choose a different preloader, click the ellipsis icon and choose one.
    Hope this helps... Rick
    Click here for Adobe Authorized Captivate and RoboHelp HTML Training
    Click here for the SorcerStone Blog
    Click here for RoboHelp and Captivate eBooks

  • After an update my game screens shrunk

    Firefox did an update. After doing so now all my game screens are shrunk and I cannot see all of the game options and tabs to play them. How do I fix this so I can play my games.

    Reset the page zoom on pages that cause problems: <b>View > Zoom > Reset</b> (Ctrl+0 (zero); Cmd+0 on Mac)
    * http://kb.mozillazine.org/Zoom_text_of_web_pages

  • Removing child records

    Hi,
    I am using below code to delete the child records for a particular parent record in the Controller:
    But the problem is, it is going in the loop and says deleting records...but data is still present in detail table.
    Please help!
    if ("delete".equals(pageContext.getParameter(EVENT_PARAM)))
    MollyAMImpl am = (MollyAMImpl)pageContext.getApplicationModule(webBean);
    MollyUserDetailsVOImpl voChild = am.getMollyUserDetailsVO1();
    String rowReference = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    System.out.println("ROW Reference =="+rowReference);
    MollyUsersVORowImpl voRow = (MollyUsersVORowImpl)am.findRowByRef(rowReference);
    String parentID = "" + voRow.getId();
    System.out.println("The Id value to be removed from child table is "+ parentID);
    voChild.setWhereClause("");
    voChild.setWhereClause("ID =" + parentID);
    System.out.println("Child VO Query to execute : "+voChild.getQuery());
    voChild.executeQuery();
    System.out.println("Remove - Child Query was sucessfull");
    int childRecords = voChild.getRowCount();
    System.out.println("Remove - child records to delete: "+ childRecords);
    Row childRow=voChild.first();
    for(int i=1;i<=childRecords;i++)
    childRow.remove();
    System.out.println("Deleting child record "+ i);
    childRow=voChild.next();
    am.getTransaction().commit();
    System.out.println("committed.....");
    System.out.println("All child deleted successfully");
    }

    Hi Gyan,
    Thanks for the reply. Please find below SOP values. I have checked the Query, Ids is correct there...
    ROW Reference ==MollyAM.MollyUsersVO1:MollyUsersVO1{74}
    The Id value to be removed from child table is 74
    Child VO Query to execute : SELECT MollyUserDetailsEO.ID, MollyUserDetailsEO.PKG_NAME, MollyUserDetailsEO.PKG_CASE, MollyUserDetailsEO.CREATION_DATE, MollyUserDetailsEO.CREATED_BY, MollyUserDetailsEO.LAST_UPDATE_DATE, MollyUserDetailsEO.LAST_UPDATE_LOGIN, MollyUserDetailsEO.LAST_UPDATED_BY, MollyUserDetailsEO.DETAIL_ID FROM XXE_FXX_USER_DETAILS MollyUserDetailsEO WHERE (ID =74)
    Remove - Child Query was sucessfull
    Remove - child records to delete: 5
    Deleting child record 1
    Deleting child record 2
    Deleting child record 3
    Deleting child record 4
    Deleting child record 5
    committed.....
    All child deleted successfully

  • After upgrading to latest IOS while playing games screen is flickering

    While playing games screen is flickering after upgrading to latest IOS.

    I have taken it out of the case - I figured it would obstruct the sensor (also have no screen protector).
    Only thing I haven't tried from the Basic troubleshooting steps you mentioned was to "restore as new".
    That I did try it tonight (succesffully restored), BUT my problem still exists.
    You mentioned to go in the MAC store > Would they replace it (for free) if they reach the conclusion it's some sort of manufacturer faulty wiring even if it's a 3Gs (as an old model)?
    Would they still if phone had water damage (this I'm just curious - the phone didn't)?

  • Hi I am having problems removing mail from trash folder. Can anyone help please

    Hi I am having problems removing mail from trash folder. I can send mails to the folder but cannot delete them permanently from the trash folder. I am using Iphone 3G and anm up to date with OS. Can anyone help please

    Check that there isn't a different Trash folder to the one with the proper Trash symbol on it.
    If you see one in your list of folders rather than a separate one, highlight it, then click on Mailbox...Use this mailbox for...Trash

  • I am having a Startup problem. Someone comes on the screen with Open Firmware to Startup. How can I reset the PRAM myself to solve this problem?

    I am having a Startup problem. Someone comes on the screen with Open Firmware to Startup. How can I reset the PRAM myself to solve this problem?

    Read these.
    http://support.apple.com/kb/HT1431
    http://reviews.cnet.com/8301-13727_7-10330118-263.html

  • Problem in passing data from 1 screen to another using BBP_DOC_CHANGE_BADI.

    Hi Experts,
    i am new to the SRM, i am facing problem in passing data from one screen to another.
    my requirement is that when we select one shopping cart and press the PROPOSE SOURCES OF SUPPLY button, we will fetch all the contracts that are attached to the shopping cart.
    we have implemented a BADI implementation of BBP_SOS_BADI (method BBP_SOS_CHECK) for passing some changed values to the contracts of the shopping cart into the popup screen that is displayed when we press PROPOSE SOURCES OF SUPPLY button and when we select any contract and press ASSIGN ONLY button in the popup screen the badi BBP_DOC_CHANGE_BADI is triggered.
    i have implemented another BADI implementation of BBP_DOC_CHANGE_BADI for fetching the selected contract and pass the values to another screen, but the problem is that when we select one contract and press the assign only button we are fetching the wrong contract number ( that is in the BADI method BB_SC_CHANGE parameter IT_ITEM we are fetching the wrong contract), if we again do the same procedure for the second time we are getting the correct contract.
    i am unable to understand why we are getting the wrong contract in the first time( that is we are getting contract other than the selected one).
    as per my understanding i think when we are passing data to the popup screen using BBP_DOC_CHANGE_BADI we are not updating the shopping cart with the changed data.
    can anyone tell me how we can update the SHOPPING CART with the changed contracts data, i have used BBP_PD_SC_UPDATE, BBP_PD_SC_SAVE and other shopping cart FM but nothing is happening.
    Thanks
    Tanveer

    Hello,
    What version of SRM are you on?  Have you check for OSS Notes?  I have had trouble with BBP_DOC_CHANGE_BADI but it was because of other issues.  The BADI works pretty well and it is called almost every time something happens to the shopping cart.
    I have noticed that sometimes that values are not changed til the second calling of the BADI.  I have yet understand why but I think it has to do with prompt processing. Usually, we train our requisitioners to click the 'Check'  button to flush things out.
    I don't know if I was helpful.... another thought.... could there be an error caught by BBP_DOC_CHECK_BADI that is preventing change in BBP_DOC_CHANGE_BADI?
    Regards, Dean.

Maybe you are looking for

  • Moved Itunes to a new hardrive on my network and now.....

    I cannot access my purchased songs. I can access songs I put on from my cd's but I have several hundred I cannot access that i have paid for. Here are the facts: 1. hard drive went bad on computer with itunes. 2. i moved the entire library to a buffa

  • Can I install from a shared drive?

    I have about 25 people who need to install Technical Communication Suite 4. Does each person need to copy the installation files (exe and 7z files) to their local environment before running the install, or can they run the install files from a shared

  • AD Redesign / R​estructure / Tools which further Improve / Enhance Active Directory's USABILITY-CONSUMERIZATION

    Hello, This Study/Discussion can be beneficial for all of us, As we will be able to know or find out what all is best from the both Business as well as Technical aspects to in terms : AD as a Service. AD as an Application. Checking IPD for AD does pr

  • Administrator Tab not visible

    Hi all, I'm using OBIEE 11.1.1.5. I'm unable to view the ADMINISTRATOR Tab on the right top corner. Can anybody suggest me the reason and how to solve it? My OS is XP SP3. Thanks in adv. Edited by: SwapnaPrerana on Sep 27, 2011 4:57 PM

  • Cannot load login module class

    Hi, i'm working on customizing Login Module now. i have bulit the project and deploy the SDA file follow this link "[sap help|http://help.sap.com/saphelp_nw70/helpdata/en/76/08b34095070361e10000000a155106/frameset.htm]". My Java project name is: MyLo