FLash 5 a.s?

How do i make this work for flash 5

onClipEvent (load) {
radius=50;
perspective=150;
degrees=0;
}
onClipEvent (enterFrame) {
angle=degrees * (Math.PI/180 ) ;
degrees=degrees + 2;

xposition=radius * Math.cos(angle);
yposition=radius * Math.sin(angle);

distance= 1 / (1-(zposition/perspective));

this._x=(xposistion * distance) + _root.center_cross_hair._x
this._y=_root.center_cross_hair._y

this._xscale = distance * 100;
this._xscale = distance * 100;

_root.center_cross_hair._visible=0;
}

help meh

I don’t see anything wrong with the coding.

It should work in Flash 5, it doesn’t seem to have any MX coding in it.

But I don’t use Flash 5 so I am not 100% sure on what Flash 5 can actually use.

All that code has it basic math though, so I don’t see why it wouldn’t work.

As far as I know, the Math methods and the onClipEvent event handler are new to Flash 5, so they should work. There are a few things to remember, however.

This code must be in a MC. The MC must be in the timeline.

All the variables you have are local variables. Their scope is the MC. Keep that in mind when referencing.

zposition is never initialized.

The second last line doesn’t need to be in the enterFrame event handler (onClipEvent). It only needs to be run once, so you can put it in the load event handler (onClipEvent).

xposition and yposition keep changing as degree changes, but none of these variables are used to change _x, _y, _xscale, or _yscale (btw, you have _xscale twice…).

It looks to me like you are trying to build a mini-3D engine here. I’ve built a few. If you need further help, just ask. But without knowing exactly what you are doing, and what else is going on in your FLA, I can’t really help much more.

-Al

found it at actionscripts.com and couldnt seem to make it work
it is the code to make a ball rotate around either the x or the y axis
i got it to work
■■■■ variables
can someone please tell me how to make like a triangular path with a ball

*Originally posted by Kaotic *
**i got it to work…
…can someone please tell me how to make like a triangular path with a ball **

So you got it to work?

What do mean by a triangular path?

If you’re thinking about scripting paths with Flash 5, check Colin Moock’s website, he has files about that. You won’t find much better code.

pom :crazy: