Help with ActionScript?

Axle12693

New Member
First of all - if this isn't the right forum, sorry.


Next, my problem:
I'm trying to make a flash movie that creates a butterfly graph. I have one "working" version, the only problem being that it slows down as it goes.

The old version:
Framerate:120 fps.Three symbols - panel, action, and pixel. Panel is a blank symbol where action places the pixel. It has no code, and is placed in the center of the stage. Action: creates each pixel and places it in panel. It also has no graphics, and is placed on the stage.
Code for action:

Code:
i = 1;
this.onEnterFrame = function(){
	_root.panel.attachMovie("pixel", "pixel" + toString(i), _root.panel.getNextHighestDepth());
	i++;
}

Pixel has a small dot in the center.
Code for pixel:
Code:
t = 0
this.onEnterFrame = function(){
	_xscale = 10;
	_yscale = 10;
	set("r" , Math.exp(Math.sin(t))-2*Math.cos(4*t)+Math.pow(Math.sin((2*t - Math.PI)/24),5))
	_x = r*Math.cos(t)*-50;
	_y = r*Math.sin(t)*-50;
	t+=.01;
}
Each pixel is coded to follow a single path at different values of t. Therefore, as more pixels are added, the computer has to move each and every one, and it gets very slow.

The new version:
Almost everything is the same, except that action has all of the code - and none of the pixels are moving this time.

Code for action:
Code:
t = 0;
i = 0;
this.onEnterFrame = function(){
	set("r" , Math.exp(Math.sin(t))-2*Math.cos(4*t)+Math.pow(Math.sin((2*t - Math.PI)/24),5));
	_root.panel.attachMovie("pixel", "pixel" + toString(i), _root.panel.getNextHighestDepth())
	//SET X AND Y COORDINATES HERE. x = r*Math.cos(t)*-50, y = r*Math.sin(t)*-50//
	i++;
	t+=.01;
}

How do I access each pixel's X and Y coordinates as I create them in panel? Thanks in advance.
 

adamblan

New Member
tracking how many individual pixels @ 120 fps?! no wonder your movie's running slow! Motion pictures are set to 24 fps, which should be adequate for your purposes.
 
Top