Duplicated MovieClips disappear during playback

make my own version of a spaceship combat game. At some point, I want to randomly generate enemies. Here's what I do.

I have a movieclip in the library called enemyShip, AS-link is normalEnemy. Object is not on the scene. The actionScipt on this image, I have the code below, that does this for me. What happens is this: when I publish and run the swf file, the two first enemies spwan correctly, from the third, each new Rogue "mask", but does not remove, the seized. the second enemy is the first to disappear. The first enemy remains visible. Ideas please? I tried duplicateMovieClip and attachMovieClip and they both have the same result. Sorry for the question for a long time!

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 newly created objects are the replacement of objects, then it looks like you are people by placing them in the same level.  When you put something in a certain level, it replaces what is at this level.

Try to use the trace() function to see what generates your this.getNextHIghestDepth () in your loop.  You will probably find that this is not what you think.  If you add items to the _root, you probably want to get depth higher next to the _root, not "this". (_root.getNextHIghestDepth ();  )

Tags: Adobe Animate

Similar Questions

  • 2015.3 mac - video disappears, executives dropped during playback

    Looks like Adobe precipitated another set of applications that were not ready.  My problem is different and less severe than the others, which is why I started a new thread.

    My sequence monitor goes black occasionally and regularly during playback.  Quit and restart the application bring him temporarily.

    I also have a jerky video playback on sequences that played well in the 2015.2 version.

    Related issue: bridge CC 2015.3 crashes at startup.  Bug report page is an endless loop.  Forum messages flooded in constant crash reports on Mac and Windows.  No option in the Setup program CC to roll back to 2014 CC or CC 2015.2 CS6 does work, however.

    OSX 10.10.5 - GRAM MacPro3 32, 1 - Quadro K5000

    Kevin, I'm almost 100% certain my KPs are caused by the NVidia driver from the Web, I posted above.    I am not as convinced the CUDA latest driver is a culprit as well, but when I installed it, got a KP and immediately back to a previous version, I have not had since.

    My crash logs have NVidia in the first 10 lines, which to my knowledge, are usually the extension or the processes involved.  I don't remember see GPUSniffer on any of them, but I can keep an eye on, if it happens again.

    BTW, I've worked on Pr 2013.3 for these last two days, and the question I posted on seems to have disappeared.  No black screens and frames do not fall on the playback of the sequence.  I don't have an explanation why.

    Thank you.

    Jim

  • Buzz during playback caused by svchost.exe (swprv)

    During playback of any kind, if the streaming, playing a CD, listening on iTunes, using any multimedia player, etc., I get an occasional buzz that lasts only a second or so, but it is very troublesome during the reading of the symphonies, etc.  After trying the drivers of different devices, mobile wires and all sorts of other fixes, I finally watch this process were underway on the CPU during playback and discovered that whenever the buzz happens suddenly appears out of nowhere, POPs to the top of the list of running processes "svchost.exe (swprv)" program and then disappear or fall to the bottom of the list as soon as the buzz disappears.  This happens any reading device - speakers or headphones - or the form of audio playback I use.  The problem is clearly caused by this svchost process.  She also is not using a lot of CPU when it arrives.

    The process is an essential copy of Microsoft program and cannot be removed from the system.  How to make this stop?

    Hi WesStevens,

    I had the same problem as you and drove me crazy.   I tried everything with malwarebytes, Microsoft Security essentals antivirus analysis and software spy hunter all to nothing does not.  Installed the latest important and recommended updates windows always annoying random humming.  Disc clean up and remove all of the recommendations. The only thing that fixed it and I'm now free buzz was a defrag of my c drive!  My machine was only 1% fragmented, but now I can happily listen to any audio player via media, youtube, etc without any buzz.

    I hope this simple defragmentation solution works for you also.

  • FCPX - marker of time does not move during playback

    All the world has noticed this annoying bug? During playback of content video plays normally in the preview window, but the marker of time in the timeline panel locks into place and not moving from left to right in real time. When I stop reading, then the marker jumps to the position in the timeline, it is supposed to be. Makes it much more difficult to change. I checked my preferences and couldn't find anything that would cause this erratic behavior. Any input will be appreciated. Thank you.

    TTry trashing prefs and reboot. Is there a lot of graphics and unreturned equipment in the timeline?

  • Is there a way to disable automatic playback during playback of a clip in full screen or a way to see the number of frame of a clip during playback in full screen?

    Is there a way to disable automatic playback during playback of a clip in full screen or a way to see the number of frame of a clip during playback in full screen? Thank you!

    Not that I know of.

    You can always send a feature request: Final Cut Pro--> provide Final Cut Pro Feedback...

  • Hi, my screen flashes during playback of movies from Netflix

    Hi, my screen flashes during playback of movies from Netflix. It happens with other applications or when I play DVD. It begins in about 5 seconds in movies and it happens about every 4-5 seconds. The screen turns white for about a second, then it shows some horizontal lines, and it goes back to normal. And after a few seconds, he begins anew. I also noticed it always happen when I move my mouse during playback of a movie at Netflix.

    My PC is HP Pavilion 17 inch. I3 Haswel processor and Intel graphics card built-in. 8.1 to win

    I've updated all the drivers, but nothing helped.

    Any suggestions?

    Thank you

    Dmitry

    Figured out. Change refresh rate of 60 Hz 40 Hz p p and it solved the problem.

    BTW, HP helpdesk is completely useless... He does not call them – at least their 'free' in India support is completely incompetent.

  • Satellite Pro P100 - WinDVD stutters during playback

    Satellite toshiba windvd Pro100 stutters during playback of dvd movies - worse yet, when you use windows Vista media player - can help you solve?

    Hello

    If Norton antivir is running, try to disable all functions. My experience is that permanent HDD scan can force CPU for greater use and because of this DVD movie stutters all playing.

  • After 9.2 update I can no longer drag to make fast-forward or rewind during playback of the video. I can now only click to jump forwards or backwards in 10 second increments. However, if I stop the video I can then drag to move forward or backward.

    After 9.2 update I can no longer drag to make fast-forward or rewind during playback of the video. I could do those before the update. I can now only click to jump forwards or backwards in 10 second increments. However, if I stop the video I can then drag to move forward or backward. I tried this on Netflix and Hulu with similar results. Apple TV restarting is not to solve the problem.

    Maybe a bug in the new version?  Does anyone else know this?

    Thank you!

    Many people complain when they reach around in the dark watching a movie they press and cause the movie ff or rwd.

    I think that this version tried to improve the situation by requiring the user to press and release the button then slide as formerly.

  • Stuttering during playback of AVI files

    I have problem during playback of AVI files on my computer, they stutter when he plays. The problem arises with a wide range of media players.

    The problem started about 2 months ago. Before that time, the same file (s) to play OK!
    The same files play OK on other computers (tested today)...

    I'm having a Satellite Pro m-30, works with XP pro SP2.

    I have tried everything I can find without success of Ant:
    Uninstalled nearly every program.
    Check the virus.
    Checked for Spy-wares.
    Stop all unnecessary processes.
    Defragment the HD.

    Help is wanted

    Hello

    Just a question: do you have this problem just with avi files or even mpg or files if you watch movies with WinDVD DVD?

  • C50D-A-13W (PSCGWE) satellite crashes during playback of video files

    Hello

    my laptop stops during playback of flash (like youtube or facebook videos) files, and then there is a blue screen with a sad face and the following text: "(atikmdag.sys) system_thread_exception_not_handled.
    my system is windows 8.1 and I already reinstalled the display driver (I used this one: http://www.toshiba.de/innovation/dow...jsp?service=DE)

    There is no virus or maleware on the laptop.

    Thanks for the help!

    atikmdag.sys is part of the ATI graphics card driver...

    I think that the problem is caused by the graphics card... probably the ATI driver is the reason why the BSOD appears...

    The laptop was not equipped with a dedicated GPU, but the graphics card part of the Kabini A4-5000 AMD processor AMD Radeon HD 8330 done graphics card

    Perhaps you could uninstall this driver and install a new update...

  • Some of my photos have disappeared during the transition to a new iphone, where can I find them, how?

    Some of my photos have disappeared during the transition to a new iphone, where can I find them, how?

    AlbiinaB wrote:

    Some of my photos have disappeared during the transition to a new iphone, where can I find them, how?

    Transfer the contents of an iPhone, iPad or iPod touch to a new device - Apple Support

  • Tecra A8: audio stutters during playback of CD/DVD on Win2K

    We recently started having the laptop Tecra A8 and we run Win2K on them. Everything works well except during playback of CD audio or DVD. Audio stutters really bad (worse with DVD to CD).
    I tried to remove the silent acoustics and re - install the audio drivers but same problem.
    As a test, I put the WinXP preinstalled on one, and then there is no problem. May be driver related issue, but we do not have the best experiences using XP drivers on a Win2K machine.
    Any suggestions would be greatly appreciated.

    As far as I know on the Tecra A8 has been preloaded with a Realtek HD Audio driver.
    I guess you also need the same kind of audio driver for W2k.
    This unit uses a link high-definition audio, and I think you'll need driver that supports this chip.

    See the Toshiba driver for W2k drivers page. In addition if you don t use the Toshiba Recovery CD you need to install all the drivers of Toshiba in the right order. Please see the installation instructions and follow this guideline.

  • Qosmio F60: audio and video distortion during playback of a media file

    Qosmio f60 / win 7 64 bit / 8 GB ram / 1 GB video card...
    Purchase date: June 2011

    question: audio and video distortion during playback of a media file

    of fact steps:

    (1) updated drivers audio & video > update bios > sent to Toshiba UAE; reformatted > replaced speakers; same CPU > (more funny when im not connected online using wifi, everything is good and ok) > dealers replaced wireless nic > No. SUCCESS still questions...

    (2) being researched a few discussions > reinstalled the drivers SATA > IRST update of intel > no still no chance > uninstalled TSRI > used Mirosoft AHCI > HDD and PC health monitor update > disabled all the > always unlucky (this solution came from TOSHIBA himself of their technical knowledge base)

    Resellers cannot identify the problem... I followed the technical knowledge base and still not solved...

    CAN SOMEONE PLEASE HELP ME SOLVE THIS ANNOYING PROBLEM? IT BECOMES NOWHERE >

    Toshiba tech support, please help me to solve this issue... I just bought recently and I didn't like that at all. It is not worth...

    > more funny when im not connected online via wifi, everything is good and ok
    Does this mean that this problem appears only using the WiFi network?
    Hmm how about Wlan driver update? Try this.

  • Satellite A500D-10F - audio USB is cracking/nervous during playback

    Hello!

    I am having some problems with my USB Audio on my Toshiba A500D-10F.
    The sound is cracking/nervous during playback of the sounds all. Even the sound system when the computer is idle.

    I tried two devices USB (Creative Arena USB Headset and Sandberg USB Sound box 7.1) audio, both with the same crackling sound, working fine on two other laptops.
    It's not feedback, it is only when his cheek that I hear the crackling.
    When no sound is played, the speakers are quiet.

    The Conclusion is that there is a common fault audio trough my USB ports.
    Mouse, disk hard etc works fine on USB ports.

    Works sound pit that my sound card integrated works very well, but there no available analog 5.1 output, so I need an external audio device to get 5.1 analog audio output. I now use the Sandberg USB Soundbox 7.1 to achieve this.

    I tried the following:

    Install the latest drivers for the USB box
    Tried to use generic drivers provided by windows.
    Reinstalled Windows (twice)

    Tried all of the different usb ports
    Tried without that no other usb devices connected
    Adjust the flow of output
    Disabling the integrated sound card
    Disabled all other devices, including sound recording devices

    I have the latest BIOS update (1.20)

    I have a laptop Toshiba A500D-10F
    Owner of 2.3 GHz Dual core
    4 GB of ram
    Card VGA of Radeon HD 4600 series

    Windows 7 Home Premium 32 bit
    All USB ports are USB 2.0 compatible.

    Could you please help me solve this problem? I did some research and think that he might have
    something to do with IRQ sharing, although I can find no good explanations as to how I would go about to fix.

    Hi stianmakela,

    You have reinstalled Windows using the Toshiba Recovery disk?

  • FCPX fall images during playback w/new HW

    Due to the increase in the performance issues of the PCF (lost frames during playback, FCPX gel) on my iMAC 2010 - I bought a new system, including storage in late 2015.  But I still have issues with FCPX, deletion of images during playback I would appreciate some advice on.

    The old system was an iMac w/8 GB RAM Core i5 connected to a DroboPro with FW800 drive Bay.

    The new iMAC is the high-end retina 5 K 27 "(core i7, 4 GHz, AMD Radeon R9 M395 2048 MB, 3 TB Fusion lecteur connecté à un 4 de ThunderBay, quatre disques HDD avec double Thunderbolt 20Gb/s ports configurés avec RAID 5)."

    I still have some dropped frames during playback.  The first image I play works well for a few seconds if he runs.  But the next clip down boxes.  The clip takes sometimes a few seconds to display in the browser.  The clips that I play back have no effects applied to them.

    My capture files are stored on love at first sight.  The library of FCPX files are stored on the Mac hard drive.

    My current library has about 12 events.  Media and cache are stored in the library.  Backups are stored on love at first sight.  The library file size is 247 GB.

    Any assistance to solve my problems of performance is greatly appreciated I'm starting a large project of edition with 700 clips to sort.

    Try to put libraries in the table of love at first sight.

    It seems to me that you are running almost everything on your internal drive - you say that the library and the media are here. This isn't what you want.

    I combed just Fcp x, drag from the library of the search of the home and try again.

    Edit: Make sure that you open the library in the RAID, TTAB everything works and you can remove the old one the internal drive.

Maybe you are looking for

  • Bootcamp Partition is corrupted or missing.

    Hello Update to windows 10 birthday and it seems that my bootcamp partition disappeared completely, I have a fusion of 2 TB drive (end of 2015 iMac) with partitions divided about 1 TB each. Bootcamp cannot see the windows partition more able to recla

  • Problem with hd satellite M40-155 (PSM40) & Seagate Momentus 7200 RPM

    Hello to all Toshibians, I recently upgraded from hd (origin: Toshiba 100 GB 4200 RPM) in my M40 - 155 (PSM40) satellite with a Seagate Momentus 100 GB at 7200 tr/min/8 MB cache. I work in the area of music production and after much advice I realized

  • drivers for windows 7

    Excuse me Sir all downgrading Windows 8.1 to windows 7 ultimate 64-bit I noticed that all my drivers were missing. Please can you provide links to the same: Network controller: PCI\VEN_1814 & DEV_3298 & SUBSYS_18EC103C & REV_00 PCI device: PCI\VEN_10

  • Background music on DVD is stronger than the word.

    When I play a DVD of some of the music seems perfectly normal however when a person speaks, I can hardly hear them.  I'm able to increase the volume to hear them, but when something else comes on it is much too strong. I checked all the speaker plug-

  • Huge problem with the graphics card. Help me pls!

    Unfortunately my pc is not guaranteed, so my last hope is here on the forum. I have Dell Inspiron 580 Ok.So the problem was that I found myself not being able to open My Nvidia Control Panel to verify customization as one of my games was so bad. That