Hi, I’m trying to link an actionscript to my main .fla file and it’s not really working out for me. In the .as file I’ve got a code for circular motion linked to a class in the fla file.
So the circular motion is to be carried out within the movieclip.
The movieclip consists of a mid point and four smaller objects around it.
package circular_as {
import flash.events.*;
import flash.display.*;
public dynamic class MainTimeline extends movieclip {
public var nucleus:movieclip;
public var r1:movieclip;
public var r2:movieclip;
public var r3:movieclip;
public var r4:movieclip;
public function MainTimeline(){
addFrameScript(0, frame1);
}
function frame1(){
orbit(nucleus, r1, 110, 2);
orbit(nucleus, r2, 110, 2);
orbit(nucleus, r3, 110, 2);
orbit(nucleus, r4, 110, 2);
}
public function orbit(_arg1:movieclip, _arg2:movieclip, _arg3:number, _arg4:number):void{
var currentDegrees:* = nan;
var doEveryFrame:* = null;
var getRadians:* = null;
var nucleus:* = _arg1;
var electron:* = _arg2;
var radius:* = _arg3;
var speed:* = _arg4;
doEveryFrame = function (_arg1:Event):void{
var _local2:number;
var _local3:number;
var _local4:number;
currentDegrees = (currentDegrees + speed);
_local2 = getRadians(currentDegrees);
_local3 = (nucleus.x + (math.sin(_local2) * radius));
_local4 = (nucleus.y + (math.cos(_local2) * radius));
electron.x = _local3;
electron.y = _local4;
};
getRadians = function (_arg1:number):number{
return (((_arg1 * math.pi) / 180));
};
I’ve double checked the link between the two, they are identical.
No errors show, so can anyone identify the problem? (if it exists in the code).
Any help to solve this or if there’s a simpler way to do this, I’d love to know
thx in advance.