Duplicated MovieClips disappearing during play

am making my own version of a spaceship fighting game. At one point I want to randomly spawn enemies. Here is what I am doing.
I have a movieclip in the library called enemyShip, AS-Linkage is normalEnemy. Object not placed on the scene. On the actionScipt on that frame, I have the code bellow, which does that for me. What is happening is this: when I publish and run the swf file, the first two enemies spwan properly, starting from the third each new spawn 'hides', but does not delete, the one before it. the second enemy is the first to disappear. The first enemy stays visible. Ideas please? I have tried duplicateMovieClip and attachMovieClip and they both have the same result. Sorry for the long question!
var origEnemy:MovieClip = _root.attachMovie("normalEnemy", "origEnemy",  this.getNextHighestDepth();
var numberOfEnemies:Number = 1;
var enemyIndex:Number = 0;
_root.onLoad();
  spawnEnemy();
  interval = setInterval(spawnEnemy,1000 + Math.random() * 2000);
// Spawns new enemies
function spawnEnemy()
   if (numberOfEnemies > 10)
  clearInterval(interval);
   // Randomly calculate the starting coordinates of newly spawned enemy 
   var x_position = Math.random() * 50;
   var y_position = Math.random() * 700;
   // spawn a new enemy and assign random location 
  enemiesArray.push(origEnemy.duplicateMovieClip("enemy" + enemyIndex, this.getNextHighestDepth()));
   //_root.attachMovie("normalEnemy","enemy" + enemyIndex,this.getNextHighestDepth());
   // assign random location
  enemiesArray[enemyIndex]._x = x_position;
  enemiesArray[enemyIndex]._y = y_position;
   // incerement number of enemies
  numberOfEnemies++;
   // Increment enemy Index
  enemyIndex++;

if 'this' is not the same as _root, the following line is problematic:
var origEnemy:MovieClip = _root.attachMovie("normalEnemy", "origEnemy",  this.getNextHighestDepth();
ie, use:
var origEnemy:MovieClip = _root.attachMovie("normalEnemy", "origEnemy",  _root.getNextHighestDepth();

Similar Messages

  • Loud crack noise during playing

    I'm getting an extremely loud noise like a Pop or Crack randomly during playing of a video from the timeline. It's not in the audio files and it never happens in the same place and it doesn't happen in the exported Quicktime file. Just during playback in Final Cut Express. If I unplug my Klipsch external speakers and play thru the iMac's built-in speakers, it sounds more like a loud one-time beep, then the audio disappears until I stop play and start play again and it plays fine again. Any ideas on what's causing this and how to eliminate it? It scares the crap out of me every time it happens!

    It just happens when playing an edited timeline. The noise is not in the audio. It just make a random loud "crack" randomly when playing the video in the timeline whether everything is rendered or not.

  • Zen Micro Freezes during play and sometimes won't turn on at

    I have been having some issues with my micro and wondered if anyone could help. I didn't drop it or do anything I can recall to cause these issues, it just seemed to start out of the blue. 2 things are happening. Sometimes it will freeze during play and "buzz" (it's really just transmitting a countinuous sound of a millisecond of what it was playing like if the guy was saying apple, and it freezes when he starts to say it it will sound like "aaaaaaaaaaaaaaaaaaaaaaaa" but in a completely illegible buzz way). Second, it will sometimes not turn on at all, no creative logo, no lights, no nothing. Once I take out the battery and replace it, it will always then start no problem. The battery does not seem to be loose at all as the above mentioned buzzin will not stop until I remove the battery, and as I have repeatedly removed the back of the micro during these buzz session?the battery remains firmly seated and the buzzing continues until I remove it. So far I have updated the firmware to 2.2.02 (which I believe reformatted) which didn't stop it from freezing up during play, and just now did a disk clean up (which I can't imagine will have any change?if a complete format didn't). I haven't had the start up problem since the firmware update, but I haven't turned it on and off that many times yet. Any ideas? Sorry to be so verbose but I wanted to explain as best as I could what's wrong, and what I've done so far.

    Remove SIM and miniSD card first. Try to boot.
    The try hooking it up to the PC again. And see if you might be able to redo the update process.
    You can also try a hard reset. As described in a different tread. (Or read below).
    Othervise, I afraid you will have to take it to a Service Center.
    -- Quote from djassa1 (Re: N80 won't start up!)--
    Just reset to factory default.
    You will need your 2 hands to do that: While the phone is off press and hold the [Green call Button] + [3 digit button] + [* button] and power on and hold the powwer button. Do that until the phone asks you for the local city reference.
    -- End Quote --
    Best of luck!

  • Creative cloud installer just disappears during install

    I had creative cloud and on last update most of the applications are gone along with the desktop icon.
    I have tried to install creative cloud again - but it just stops halfway and disappears during install.
    I've tried safe mode install
    Ive renamed OOBE folders in both librarys
    I've tried the adobe application manager and that crashes on install
    I've tried the Adobe clean up tool
    Nothing is working to get creative cloud to reinstall on the computer - I've lost about 4 applications in creative cloud
    Working on a Mac - Yosemite OS

    Hi!  The cleaner failed - simply could not detect any creative cloud products. ( It did find a previous CS6 installation, long since uninstalled, actually).
    Didn't get a chance to try ROOT, as an Adobe tech (Loveneesh) remoted in and did some 'known fixes'... basically he cleaned up the failed CC desktop installation ( deleted a couple of folders) - and then gave "wide open" permissions to a couple of sets of library folders ( One for machine, and one for user). I believe they were
    /library/application support/
    /library/application support/Adobe/
    /users/[username]/library/application support/
    /users/[username]/library/application support/Adobe/
    Still couldn't install CC desktop, (failed twice!) BUT that at least allowed  the installation of "Adobe App Manager" - which was subsequently UPGRADED to CC Desktop. Something of a clever workaround, if you ask me!
    And now its all working OK again.
    I'm a bit bothered by the somewhat cavalier ""Everybody" permissions applied to library folders, but as I understand this is the quick fix when nobody quite knows what the heck is going on with permissions... (I suppose ROOT access gives much the same effect for installations)

  • HELP! Does anyone know a "Data Recovery Expert" for I-Phone? - My calender disappeared during transfer of data from my old I-Phone 4 to my new I-Phone 5s. It was on both I-Phones then vanished. (It was evidently not syncing during back-ups on the laptop)

    HELP! Does anyone know a "Data Recovery Expert" for I-Phone? - My calender disappeared during transfer of data from my old I-Phone 4 to my new I-Phone 5s. It was on both I-Phones then vanished. (It was evidently not syncing during back-ups on the laptop)

    What calendar were you syning to? Outlook? Google? Something else? The directions on how to resync vary a bit.

  • HELP! Does anyone know a Data Recovery Expert for I-CIoud? -My calender disappeared during I-Cloud transfer of data from old I-Phone 4 to new I-Phone 5s. It was on both I-Phones then vanished. (It was evidently not syncing during back-ups on the laptop)

    HELP! Does anyone know a "Data Recovery Expert" for I-Cloud & I-Phone? - My calender disappeared during I-Cloud transfer of data from my old I-Phone 4 to my new I-Phone 5s. It was on both I-Phones then vanished. (It was evidently not syncing during back-ups on the laptop)

    HELP! Does anyone know a "Data Recovery Expert" for I-Cloud & I-Phone? - My calendar disappeared during I-Cloud transfer of data from my old I-Phone 4 to my new I-Phone 5s. It was on both I-Phones then vanished. (It was evidently not syncing during back-ups on the laptop)
    The Apple techs are looking. But they can't find it. Nor can they find a back up on my laptop, Evidently when I backed up my Iphone to computer the calendar wasn't syncing. Since I only use the calander on my phone - I never noticed.
    The Apple store rep that sold me the I-Phone 5 on Monday, was transferring my contacts and calendar thru I-Cloud (I never used I-Cloud before that moment - and always had it turned off). He successfully transferred the contacts - which are still on my phone), but the Calendar weirdly split into 6 calendars (2 of which were linked to my G-Mail which only had a few entries) (4 were linked to my MSN / Hotmail email and contained all the major events/data). I never created calendars that were separate or liked them to 2 different emails. I just typed entries into the I-Phone calendar. However, the calendar did exist on the new I-Phone for 24 hours. Something happened during transfer. When the Apple Genius Bar tech was attempting to back up my Calendar & merge the 6 calendars, everything disappeared in his hand while he was looking at it.
    I am hoping that some really good data recovery expert exists that can restore the calendar that was in both I-Phones yesterday. It is completely devastating if I can't recover it.
    Any help, or referrals, is great appreciated!!!!
    Thanks!

  • IOS 7 ugrade failed " Error:Device disappeared during timed transition". Phone will not now turn on or sync with itunes, any ideas please?

    iOS 7 ugrade failed " Error:Device disappeared during timed transition". Phone will not now turn on or sync with itunes, any ideas please?

    if a Mac OSX Computer is in near - try iBackup Viewer.
    This is free of charge and can read your backup.
    and thats the main difference. Those tools are reading the saved Data in the backup
    but itunes attempts to restore the data from the backup on your iphone. if there are any corrupted data in the backup - the backup restore goes wrong. this can happen during security software or wrong corrupt data already stored on the iphone.
    if itunes messed up to restore from backup try this one :
    - restore your iphone to factory settings using HT1808 or reset all settings and content direct from iphone
    - rename your iPhone (e.g. iPhone Test)
    - setup your iPhone as new device -> attempt to make a new backup - if successful -
    - click in itunes on restore from backup... and choose your desired backup
    or go to:
    Mac: ~/Library/Application Support/MobileSync/Backup/
    Windows XP: \Documents and Settings\(Username)\Application Data\Apple Computer\MobileSync\Backup\
    Windows Vista - Windows 7: \Users\(Username)\AppData\Roaming\Apple Computer\MobileSync\Backup\
    Pull your complete BackupFolder and try a different PC - copy the BackupFolder on this different PC in the same Path above - start iTunes and see if your Backup is there - attempt to restore from Backup again

  • Sound problem during play-back

    Dear friends
    After recording images with my MSI TV-Tuner card, i cant get any sound during play back. First i had Win-Amp installed on my system that i thought may be it is the cause of the problem. After uninstalling the win amp, again the problem existed. Even i have installed the Beta version driver of my MSI tv tuner but i hadn't any success in solving the problem .
    If somone can help me to solve this i will be appreciated.

    make sure you have the recording input set correctly in your settings (look under Device options)
    however your tv tuner is connected to your soundcard (eg Line-IN) then this should be set accordingly

  • Apple Tv rented movie shutdown during play, not highlighted as hired / able to replay, fraud!

    Rented Epic tonight
    Started watching and it shut down during play, for no reason
    Cannot Replay cause it doesn't appear as rented.
    Connection is allright (duh, hense this post)
    Apple Support unavailable.
    Thank you for ruining my evening and stealing my hardearned cash.
    This goes out the window, along with my thoughts about it.

    Ok nw the rented film is on the iPad which won't play and when I looked at the Mac I was greeted with an error message saying that the film could nt be transferred because the file had already been transferred somewhere else!  Thing is I can see it on theioad and the Mac still!
    Obviously the film Kees checking where it as you can't watch it in two places at the same time. I can understand that but I knw it's not anywhere else.
    The only thing I can think of is if when time machine backs it up it thinks it's being watched!
    Any ideas anyone?

  • Qt freezes during play... constantly

    I upgraded to QT 7 and bought Pro, and ever since the image freezes often during play. I have to restart or redownload the movie to get it unstuck; sometimes changing Views (small to full screen) will nudge it. 10.3.9. This happens on both of my computers: dual g5, and ibook.

    QuickTime Player is designed to drop frames if the viewing machine can't process the data fast enough.
    A two minute file that is 2.8 GB's in file size suggests a data rate that would exceed the playback abilities of nearly any modern machine.

  • Since upgrading to 6 on my iphone, my notes disappear. They are no longer in the cloud. Also disappear during typing! What's happening?

    Since upgrading to 6 on my iphone, my notes disappear. They are no longer in the cloud. Also disappear during typing! What's happening?

    So you have business contacts that were lost... do you not have these on a Database in some shape or form? Sounds like you need to invest in a RAID1 backup setup for your computer so you dont have this issue in the future.
    As for repairing your problem, sounds like you are going to need to start from scratch at this point or if the data is still on your phone look into a program that can take the information from the phone onto iTunes.

  • The progress indicator in version 11.0.1.2 does not appear when a song or podcast starts. It may or may not appear during play.

    The progress indicator in version 11.0.1.2 does not appear when a song or podcast starts. It may or may not appear during play. How do I make it appear so I can start a podcast in the middle of the program?

    No errors in error console. No effect using *. I tried using the dns name of my localhost both in the Firefox URL and in the javascript and I get exactly the same. I have spent a huge amount of time looking into this issue.
    One thing I noticed is that if I use the examples on the internet (http://arunranga.com/examples/access-control/preflightInvocation.html or http://saltybeagle.com/cors/) they work in the same browser. These examples however, are accessed through HTTP proxies.
    I am wondering if the issue has to do with using the same hostname just with different ports.

  • How to drag and move duplicated movieclip in flashMX

    i would like to know how to drag and move duplicated movie
    clip in flashMX? i'm unable to drag and move duplicated movieclips
    but able to see duplicated movieclip on the stage. Is there anyone
    who can show me or direct me to any tutorial site?
    Thanks

    i have just changed to Flash MX2004 and below is my code. I'm
    not sure what has gone wrong with my script as i still unable to
    drag my duplicated movieclip? hope u guys can help me out!
    var mySelection = "";//Global declaration
    var totalmc = 0;
    wire.onPress = function ()
    this.createEmptyMovieClip(["mc"+totalmc],
    this.getNextHighestDepth(["mc"+totalmc])); //Create a newMovieClip
    with variable name "mc1""
    duplicate(["mc"+totalmc]);
    //trace(["mc"+totalmc]);
    dragging(["mc"+totalmc]);
    mc = attachMovie("idwire", ["wire"+totalmc++],
    this.getNextHighestDepth(["wire"+totalmc])); //store the Movie into
    mc1 by attaching
    mc._x = 273;//(Stage.width - mc1._width)/2;
    mc._y = 196.5;//(Stage.height - mc1._height)/2; //setting
    the corrdinates for x and y axis
    dragging(["wire"+totalmc]); //calling the dragging function
    //trace(mc1._width +","+ mc1._height);
    //Function for dragging
    function dragging()
    mc.onPress = function()
    this.startDrag(true);
    mySelection = this;
    mc.onRelease = mc.onReleaseOutside = function()
    stopDrag();
    function duplicate()
    mc.duplicateMovieClip (["mc"+i], i);
    i++;
    //trace("mc"+i);
    //trace(x);
    //Btn function for flipping
    flip.onRelease = function()
    mySelection._rotation += 10;
    //Btn function for delete
    del.onRelease = function()
    mySelection.removeMovieClip();

  • My project stops during playing

    Good day!
    I have a Project, want publish it, but when I desided to check it, I saw a mistake - It stops during playing slide - when the headline appears...And I have to press ">" button to play this slide at all.

    Hello again
    Well, I'm not sure I saw where the actual VERSION of Captivate you are using was mentioned, but for me, it's version 7. And in that version, if you click a Button and look at the Properties panel in the Timing section, you should find a check box that you are able to clear. At that point, the object will no longer cause the slide to pause.
    You may need to clear this for all three buttons.
    Cheers... Rick

  • Layer disappears when playing from Flash Player

    I have a dotted line animation in a layer. It shows up fine
    when dropping to IE window but it disappears when playing from
    inside Flash Player 7. Maybe it needs a newer version to play it
    correctly but it's just a layer with a line in it. The SWF is
    created with Flash CS3. Maybe Flash Player 7 comes from Studio 8
    that is also on the PC.

    I just found that it plays fine on Flash Player 9 which comes
    with CS3. Some of the features probably are not compatible with
    Player 7.

Maybe you are looking for