A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Help With attaching Movie Clips and moving them

  1. #1
    Junior Member
    Join Date
    Jul 2010
    Posts
    9

    Help With attaching Movie Clips and moving them

    So I've had a look around on the problems and cant find the solution to my action script problems

    Firstly, I want to be able to push the space bar on my keyboard during a swf, and for a movie clip to appear on the stage. This is what i have so far:

    Code:
    onClipEvent(enterFrame){
    		
    	if(Key.isDown(Key.SPACE)){
    			_root.attachMovie("Explosion", "Explosion"+i, _root.getNextHighestDepth());
    			_root["Explosion"+i]._x = _x;
    			_root["Explosion"+i]._y = _y-20;
    	}
    }
    I dnt know whats wrong, but its not working....

    Secondly, I want A movie clip to spawn in the middle of the stage, then randomly travel outwards to the edge of the stage, then dissapear. And this needs to happen over and over, with the same movie clip travelling to a different place each time. This is what i have so far :

    Code:
    onClipEvent(load){
    	timer = 0;
    	i = 0;
    	a = 0;
    	b = 0;
    }
     
    onClipEvent(enterFrame){
    	if(timer > 0){
    		timer --;
    		a = Math.round(Math.random()*20);
    		b = Math.round(Math.random()*20);		
    	}
     
    		if(timer == 0){
    			_root.attachMovie("RockSmall2Big", "RockSmall2Big"+i, _root.getNextHighestDepth());
    			_root["RockSmall2Big"+i]._x = 275;
    			_root["RockSmall2Big"+i]._y = 200;
    			_root["RockSmall2Big"+i]._width = Math.round(Math.round()*
     
    			_root["RockSmall2Big"+i].onEnterFrame = function(){
    				this._y -= a;
    				this._x -= b;
    				if(this._y < -30){
    					this.removeMovieClip();
    				}
    			}
     
    			i ++;
    			timer = 20;
    	}
    }

    Please help

  2. #2
    Junior Member
    Join Date
    Jul 2010
    Posts
    9
    Bump, please help

  3. #3
    Junior Member
    Join Date
    Jul 2010
    Posts
    9
    Bump

  4. #4
    Junior Member
    Join Date
    Jul 2010
    Posts
    9
    BUMP , please help

  5. #5
    Junior Member
    Join Date
    Jul 2010
    Posts
    9
    Bump, cmon guys, i really need this

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