A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: _root.attachMovie HELP!!

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    8

    _root.attachMovie HELP!!

    Hello! I have a problem, I can`t find anything on it anywhere! I have a code to spawn enemies using _root.attachMovie, but whenever it spawns it just disappears shortly after spawning. Here is the code.

    Actionscript Code:
    onClipEvent (load) {
    var a = 100;
    }
    onClipEvent (enterFrame) {
    function goblinspawn() {
    a++;
    var newname = "goblin" + a;
    _root.attachMovie ("goblin", gob, this.getNextHighestDepth())
    if (this._xscale == +scale) {
    _root[gob]._x = 1400;
    _root[gob]._y = 250;
    }else{
    _root[gob]._x = 1400;
    _root[gob]._y = 250;
    }
    _root[gob].onEnterFrame = function() {
    if (_root.knight._x < this._x) {
    this._x -= 8
    }
    if (_root.knight._x > this._x) {
    this._x += 8
    }
    }
    }
    function goblinspawn1() {
    var newname = "goblin" + a;
    _root.attachMovie ("goblin", gob, this.getNextHighestDepth())
    if (this._xscale == +scale) {
    _root[gob]._x = 100;
    _root[gob]._y = 250;
    }else{
    _root[gob]._x = 100;
    _root[gob]._y = 250;
    }
    }
    //nonfunction
    //nonfunction
    if (a == 100) {
    goblinspawn();
    a++;
    }
    if (a == 101) {
    goblinspawn1();
    a++;
    }
    if (a == 102) {
    goblinspawn();
    a++;
    }
    }

  2. #2
    Junior Member
    Join Date
    May 2012
    Posts
    8
    Bump, anyone have a solution?

  3. #3
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Post FLA file
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  4. #4
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Yeah! Post FLA so we can help you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center