Jump to content


Photo

duplication


  • Please log in to reply
15 replies to this topic

#1 FlashGameboy

FlashGameboy

    Young Padawan

  • Members
  • Pip
  • 139 posts
  • Gender:Male
  • Location:Somewhere over the rainbow
  • Interests:Mostly flash but im trying to work on Maya and some<br />signiture design

Posted 19 January 2006 - 10:07 PM

Ok heres my problem im trying to duplicate an object called spark
a num amount of time and then add speed which i define to its
y and boom another var which i defined to its x.

Can someone tell me whats wrong

I have a movie clip called Firework that have these parameters on it
name:gravity----var:grav---default value:10
name:launches----var:launch---default value:30
name:numspark----var:numspark---defauly value:5

// I wrote this in an earlier frame called Init
var spark:MovieClip = Firework.Spark;
var gravity:Number = Firework.grav;
var launches:Number = Firework.launch;
var num:Number = Firework.numspark;
var gravup:Number = 0.05;
// inside Firework there is an movieclip called Spark
// num is the number of sparks i will have

This works fine but here comes my problem

var count = 1;
for (i=1; i<num; i++) {
	var speed:Number = launches-gravity;
	gravity *= 1.04;
	var ran2:Number = random(8);
	var heading = "spark"+i;
	duplicateMovieClip(spark, heading, i);
	var boom:Number = random(40)-20;
	eval(heading)._x += boom;
	eval(heading)._y -= speed;
	trace(eval(Firework.heading)._y);
	if (ran2 == 1) {
		eval(heading).gotoAndPlay(2);
		count++;
	}
}
if (count == num) {
	gotoAndPlay("wait");
}

let me explain what im trying to do, im trying to duplicate a
movieclip called spark num amount of times
and set its name to
heading. Then i will add the value boom to heading's x and speed
to heading's y
.Then i make a random number called ran2, the code
will then play over and over, which i ensured with a frame
actionscript command, until ran2 equals 1. Then i will play frame
2 in heading and add 1 to count
. Finally i have a if statement
saying that if count == num then ill goto and play a frame called
wait.

words highlighted in red doesn't work

Edited by FlashGameboy, 22 January 2006 - 08:35 PM.


#2 adzicents

adzicents

    Young Padawan

  • Members
  • Pip
  • 21 posts
  • Location:Melbourne, Australia

Posted 20 January 2006 - 07:54 AM

What exactly doesn't work though? the duplication? or add the value of boom? or what doesn't work?

#3 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 20 January 2006 - 10:45 PM

I'm not really sure if this is the solution it could also be that you have some typo on your post but.
this line:
var num:Number = Firework.spar;

Shouldn't it be?
var num:Number = Firework.spark;


#4 FlashGameboy

FlashGameboy

    Young Padawan

  • Members
  • Pip
  • 139 posts
  • Gender:Male
  • Location:Somewhere over the rainbow
  • Interests:Mostly flash but im trying to work on Maya and some<br />signiture design

Posted 21 January 2006 - 04:46 PM

this is getting confusing im going to modify my earlier code
so its more readable.

read the modified post above.

Edited by FlashGameboy, 21 January 2006 - 05:23 PM.


#5 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 21 January 2006 - 06:09 PM

again, mate.. check your typo.. I think it's not working because you have a lof of stuff which is not being declared on it.. or maybe I don't see them.

#6 FlashGameboy

FlashGameboy

    Young Padawan

  • Members
  • Pip
  • 139 posts
  • Gender:Male
  • Location:Somewhere over the rainbow
  • Interests:Mostly flash but im trying to work on Maya and some<br />signiture design

Posted 21 January 2006 - 06:13 PM

let me clear this up spar is a parameter which i defined on
the movieclip Firework while Spark is a movieclip inside
the movieclip Firework named Spark.

ill change spar to numspark to make it less confusing

Edited by FlashGameboy, 21 January 2006 - 06:17 PM.


#7 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 21 January 2006 - 06:20 PM

ok.. good..

just asking myself this.. you are evaluating a value from the variable called "heading" and you want to know the y value of it. right?
how can you get the y value of a variable? That doesn't fit in my head. But maybe I'm wrong. :)

Edited by funkysoul, 21 January 2006 - 06:21 PM.


#8 FlashGameboy

FlashGameboy

    Young Padawan

  • Members
  • Pip
  • 139 posts
  • Gender:Male
  • Location:Somewhere over the rainbow
  • Interests:Mostly flash but im trying to work on Maya and some<br />signiture design

Posted 21 January 2006 - 06:21 PM

heading is the name of the duplicated movieclip and is
thus a movieclip and not a value, then i will modify its
y and x with speed and boom

I might be wrong but when you duplicate a movie clip
you name it like this duplicateMovieClip(the name of the
movieclip to duplicate, the name of the duplicated
movieclipe, and what level its on) so thus heading
will be the duplicated name and i can manipulate heading.

Edited by FlashGameboy, 21 January 2006 - 06:27 PM.


#9 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 21 January 2006 - 06:34 PM

yeh you duplicatemovieclip like that, but every loop that your flash movie does is accessing the last spark mc, I don't know if that is what you want.
heading will always be the last duplicatedmovieclip, if you want to control every duplicated movieclip you need to rewrite your code.

But I could also be wrong.. maybe you can post some sample fla with just the scripts that you are using

#10 FlashGameboy

FlashGameboy

    Young Padawan

  • Members
  • Pip
  • 139 posts
  • Gender:Male
  • Location:Somewhere over the rainbow
  • Interests:Mostly flash but im trying to work on Maya and some<br />signiture design

Posted 21 January 2006 - 06:45 PM

i think the code is always duplicating one mc
which is the mc in Firework. Also I want to control
one mc until it plays frame 2 thats because i'm not
sure about how to control several movieclips at once

When i tried to attach it said Upload failed. You are not
permitted to upload a file with that extension.

#11 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 21 January 2006 - 07:53 PM

put it on your own server or send it by email to me.

#12 FlashGameboy

FlashGameboy

    Young Padawan

  • Members
  • Pip
  • 139 posts
  • Gender:Male
  • Location:Somewhere over the rainbow
  • Interests:Mostly flash but im trying to work on Maya and some<br />signiture design

Posted 22 January 2006 - 08:19 PM

since i don't have my own servor what's your email.

#13 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 23 January 2006 - 04:47 AM

I've sent you a PM with my email

#14 FlashGameboy

FlashGameboy

    Young Padawan

  • Members
  • Pip
  • 139 posts
  • Gender:Male
  • Location:Somewhere over the rainbow
  • Interests:Mostly flash but im trying to work on Maya and some<br />signiture design

Posted 23 January 2006 - 01:45 PM

OK, i sent the file to your email

hope you can find the problem

#15 funkysoul

funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 23 January 2006 - 04:54 PM

Ok, the problem must be somewhere here:
if (ran2 == 1) {
		eval(heading).gotoAndPlay(2);
		count++;
	}
}
specially the eval(heading) line.

Put some breakpoints on line 1, 11, 12 and 13 then press CTRL+SHIFT+ENTER to access debug mode, then you will see that the problem resides on that line..
The var count has also to be moved to the first frame and defined as a global variable with "_global.count = 1", otherwise everytime the playhead starts at frame 20 (which it does atm), the variable count will be reseted to 1.

I'm still working on your fla, to figure out why the spark doesn't explode..
Just wanted to let you know.

#16 FlashGameboy

FlashGameboy

    Young Padawan

  • Members
  • Pip
  • 139 posts
  • Gender:Male
  • Location:Somewhere over the rainbow
  • Interests:Mostly flash but im trying to work on Maya and some<br />signiture design

Posted 29 January 2006 - 04:44 PM

Thanks for the update

^_^ :D :D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users