Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 05-09-2012, 09:33 PM   #1
fudgematico
Registered User
 
Join Date: May 2012
Posts: 9
Default this.attachMovie Problem

I guys i am not new to game desigining in flash as2 but i am a little rusty at the moment. I am trying to create a block breaking game and have done well so far as making the blocks, ball/walls and paddle but now i am trying to add the power ups. I cant get the this.attachMovie to work, its works as so, there is a random number generator and it generates every time a block is broken once the number is higher than 90 it activates the code. Can somebody please tell me what i am doing wrong here, heres my code:


function makeLvl():Void{
var arrayLength:Number = _root.lvlArray[currentLvl-1].length;
var brickRow:Number = 0;
for(var i:Number = 0;i<arrayLength;i++){
if(lvlArray[currentLvl-1][i] == 1){
_root.brickAmt ++;
_root.attachMovie('mcBrick', 'brick'+i,_root.getNextHighestDepth(),{_x:9999, _y:9999});
_root['brick'+i]._x = 15+(i-brickRow*10)*75;
_root['brick'+i]._y = 10+brickRow*20;
_root['brick'+i].onEnterFrame = function(){
if(this.hitTest(_root.mcBall)){
displayRandomNumber();
this.removeMovieClip();
ballYSpeed *= -1;
_root.brickAmt --;
if(randomNumberText.text>=90){
this.attachMovie('mcBg', 'doubleball',_root.getNextHighestDepth());
trace("doubleball");
}
}
if(_root.gameOver){
this.removeMovieClip();
}
}
for(var c:Number = 1;c<=10;c++){
if(i == c*10-1){
brickRow ++;
}
}
}
}
}
fudgematico is offline   Reply With Quote
Old 05-09-2012, 11:55 PM   #2
tacos
Grrrrrrrrreat!
 
tacos's Avatar
 
Join Date: Apr 2007
Location: Montréal, Québec
Posts: 5,473
Default

Try _root rather than this...
__________________
WHO I WAS...
BANDS OF THE 80's
tacos is offline   Reply With Quote
Old 05-11-2012, 10:40 PM   #3
fudgematico
Registered User
 
Join Date: May 2012
Posts: 9
Default

I Tried that but it attached the movie to the stage i need the MovieClip to attach to the one that the ball has just hit? Could you rework the code at all? Plus does the attached movieclip have to be a simple shape or can it be a movieclip with tweens and animations in?
fudgematico is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:52 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.