Hello everyone…I am new to the forum and new to Flash and AS. I am using Flash CS4 and AS2. I have been following along a video tutorial that has me stuck. The code below is as far as we got and when it was time to test it, mine didn’t work.
This project is a carousel and I am trying to load the movieclip “item” to the stage. I have the linkage set to Export to ActionScrip.
Sometimes I get a compiler error, something to the effect of “unable to load identifier or class named item”
Right now, however, I am not receiving any errors but still no movieclip on the stage.
If someone could help me with this, I would really appreciate it.
/variable which stores how many items in carousel/
var numOfItem:Number = 1;
/variable which indicates how wide and how tall the carousel to be/
var radiusX:Number = 250;
var radiusY:Number = 75;
/variable which indicates the center of the stage/
var centerX:Number = Stage.width/2;
var centerY:Number = Stage.height/2;
/variable to indicate the carousel speed/
var speed:Number = 0.05;
/calls up the movie file/
/places each item evenly spaced across a 360 degree circle/
/on enter frame event/
for(var i=0;i<numOfItems;i++)
{
var t = this.attachMovie(“item”,“item”+i,i+1);
t.angle = i * ((Math.PI*2)/numOfItems);
t.onEnterFrame = mover;
}
/x position use cos to calculate the angle/
/y position use sin to calculate the angle/
/add speed to every angle as it passes through/
function mover()
{
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
this.angle += this._parent.speed;
}