View Full Version : Duplicate movie problem [renamed]
julie4ever
June 12th, 2005, 02:17 PM
i want to duplicate a movie clip b1 and create ball1 to manipulate them with setproperty, and the same for b2 but this one into ball2. when i execute this code it would only do it for b1 and not for b2. can anyone help???
Julie(^_^)
var x1=50
var y1=100
var x2=60
var y2=89
duplicateMovieClip (this.b1,ball1,1);
setProperty(pelota1,_x,x1);
setProperty(pelota1,_y,y1);
duplicateMovieClip (this.b2,ball2,2);
setProperty(pelota2,_x,x2);
setProperty(pelota2,_y,y2);
unchew
June 12th, 2005, 03:18 PM
Welcome to the forums!
I don't understand you question... can you post your fla to give me a hint?
julie4ever
June 12th, 2005, 04:20 PM
Welcome to the forums!
I don't understand you question... can you post your fla to give me a hint?
check it out, i hope it helps
scotty
June 12th, 2005, 04:51 PM
Put quotes around the new instancename :)
this.b1.duplicateMovieClip("ball1", 1);
ball1._x = x1;
ball1._y = y1;
scotty(-:
julie4ever
June 12th, 2005, 05:05 PM
Put quotes around the new instancename :)
this.b1.duplicateMovieClip("ball1", 1);
ball1._x = x1;
ball1._y = y1;
scotty(-:
thank you very much sotty!!!1
scotty
June 12th, 2005, 05:13 PM
no problem=)
julie4ever
June 12th, 2005, 06:15 PM
no problem=)
remember my last question, well i have another one that its linked to the previous one
if((this.right.hitTest(ball1)==true))
{
do something
}
but when "ball1" hits the movie clip "right", doesnt detects the collision. remember that "ball1" is the duplicate of "b1"
scotty
June 13th, 2005, 02:32 AM
Are you using an onEnterFrame or setinterval for checking if the hitTest is true?
btw you can write
if(this.right.hitTest(ball1)){
scotty(-:
julie4ever
June 13th, 2005, 07:53 PM
Are you using an onEnterFrame or setinterval for checking if the hitTest is true?
btw you can write
if(this.right.hitTest(ball1)){
scotty(-:
lol
well it works if i do it
if((this.right.hitTest(ball1))
but now i need it to be variable like
movname = "ball1"
if((this.right.hitTest(movname))
how do i make that work????
scotty
June 14th, 2005, 02:55 AM
var movname = this["ball1"];
or, even better
var movname =this.b1.duplicateMovieClip("ball1", 1);
movname._x = x1;
movname._y = y1;
scotty(-:
julie4ever
June 14th, 2005, 08:11 PM
var movname = this["ball1"];
or, even better
var movname =this.b1.duplicateMovieClip("ball1", 1);
movname._x = x1;
movname._y = y1;
scotty(-:
ok, so far so good. now I have this function MYcounter which has flag0,flag1,flag2,flag3 and x,y variables, I send initial values for the flags and initial values for x and y
function MYcounter(flag0,flag1,flag2,flag3,x,y)
{
if(flag0 == 1)
{
x += 3
}
if(flag1 == 1)
{
x -= 3
}
if(flag2 == 1)
{
y += 3
}
if(flag3 == 1)
{
y -= 3
}
}
then I have my function moves which has the same flags and the same x and y. I call my function MYcounters and gets the values for the flags and variables, ok. then I call my function moves and I want it to get the values of the flags and x,y from MYcounter function and execute the arguments. as you can see moves function gives new values to the flags for MYcounter function to use after the first pass so that MYcounter function uses those new values to execute diferent counts.
function moves(flag0,flag1,flag2,flag3,movname,x,y)
{
setProperty(movname,_x,x);
setProperty(movname,_y,y);
if((this.right.hitTest(movname)))
{
test = "right";
if((flag0 == 1)&&(flag1 == 0)&&(flag2 == 0)&&(flag3 == 1))
{
flag0 = 0; //positive in X
flag1 = 1; //negative in X
flag2 = 0; //positive in Y
flag3 = 1; //negative in Y
}
else if((flag0 == 1)&&(flag1 == 0)&&(flag2 == 1)&&(flag3 == 0))
{
flag0 = 0; //positive in X
flag1 = 1; //negative in X
flag2 = 1; //positive in Y
flag3 = 0; //negative in Y
}
else if((flag0 == 1)&&(flag1 == 0)&&(flag2 == 0)&&(flag3 == 0))
{
flag0 = 0; //positive in X
flag1 = 1; //negative in X
flag2 = 0; //positive in Y
flag3 = 1; //negative in Y
}
}
}
i have no idea how to pass those parameters, in C++ i would pass them as reference paramenters but i have no idea on how to do that in actionscript.
thanks Scotty, I hope you can help.(^_^)
scotty
June 15th, 2005, 03:40 AM
I'm not 100% sure what you want to achieve so posting a fla would help.
As far as I can see you want to chenge the movement of eg ball1 after hitTest?
scotty(-:
julie4ever
June 15th, 2005, 10:52 PM
i want to know how to pass values of the parameters to the function and then return them to the main and so on.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.