Я использую Adobe Flash CS4 professional для этого проекта Actionscript 3.0 (http://tutorials.flashmymind.com/2009/02/rotating-menu-via-actionscript-3/)
. Я даже пытался следовать рекомендациям в комментариях, но эта ошибка всегда появляется: TypeError: Ошибка # 1010:Термин не определен и не имеет свойств.Я озадачен кодированием ... Вот код между прочим ...
//Save the center coordinates of the stage
var centerX:Number=stage.stageWidth/2;
var centerY:Number=stage.stageHeight/2;
//The number of items we will have (feel free to change!)
var NUMBER_OF_ITEMS:uint=5;
//Radius of the menu circle (horizontal and vertical)
var radiusX:Number=200;
var radiusY:Number=100;
//Angle difference between the items (in radians)
var angleDifference:Number = Math.PI * (360 / NUMBER_OF_ITEMS) / 180;
//How fast a single circle moves (we calculate the speed
//according to the mouse position later on...)
var angleSpeed:Number=0;
//Scaling speed of a single circle
var scaleSpeed:Number=0.0002;
//This vector holds all the items
//(this could also be an array...)
var itemVector:Array = new Array ('1', '2', '3', '4','5');
//This loop creates the items and positions them
//on the stage
for (var i:uint = 0; i < NUMBER_OF_ITEMS; i++) {
//Create a new menu item
var item:Item = new Item();
//Get the angle for the item (we space the items evenly)
var startingAngle:Number=angleDifference*i;
//Set the x and y coordinates
item.x=centerX+radiusX*Math.cos(startingAngle);
item.y=centerY+radiusY*Math.sin(startingAngle);
//Save the starting angle of the item.
//(We have declared the Item class to be dynamic. Therefore,
//we can create new properties dynamically.)
item.angle=startingAngle;
//Add an item number to the item's text field
item.itemText.text=i.toString();
//Allow no mouse children
item.mouseChildren=false;
//Add the item to the vector
itemVector.push(item);
//Add the item to the stage
addChild(item);
}
//We use ENTER_FRAME to animate the items
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
//This function is called in each frame
function enterFrameHandler(e:Event):void {
//Calculate the angle speed according to mouse position
angleSpeed = -(mouseX - centerX) / 5000;
//Loop through the vector
for (var i:uint = 0; i < NUMBER_OF_ITEMS; i++) {
//Save the item to a local variable
var item:Item=itemVector[i];
//Update the angle
item.angle+=angleSpeed;
//Set the new coordinates
item.x=centerX+radiusX*Math.cos(item.angle);
item.y=centerY+radiusY*Math.sin(item.angle);
//Calculate the vertical distance from centerY to the item
var dy:Number=centerY-item.y;
//Scale the item according to vertical distance
item.scaleY = (dy / radiusY)+2;
//Set the x scale to be the same as y scale
item.scaleX=item.scaleY;
//Adjust the alpha according to y scale
item.alpha=item.scaleY+1.1;
}
}
Я нахожу это странным - возможно, код правильный, но я не знаю, испортились ли эти шагивверх по проекту ...
3 - Convert the circle into a movie clip...
4 - In the “Item” movie clip, create a dynamic text field in the center of the circle (in a new layer).
5 - Set the text to align center. Type some number in the text field. Give the text field an instance name of “itemText”. Embed numerals...
6 - Remove the Item movie clip from the stage. We will create all the items dynamically via ActionScript 3.
Я мог бы сделать больше скриншотов, но так как я новый пользователь, мне разрешено не более двух - и в отличие от этого тега, яне работает с приложением Android. (Я дам вам дополнительную информацию, как только кто-нибудь из вас ответит на этот вопрос ...)
Я должен признать, что шаги с 3 по 6 сбивают с толку и не сделалисмысл для меня - особенно с шестым шагом, когда вы должны удалитьролик со сцены.Для меня, если бы я сделал это, над чем работал бы сценарий?
Есть идеи, что я сделал не так?
РЕДАКТИРОВАТЬ: Спасибо, я понял свою ошибку - спасибо за подсказку: -)
Но теперь я попытался немного изменить код этого урока, чтобы слова появлялись внутри окружностей (как «Домой», «О нас» и т. д.), как то, что я набрал в строке на скриншоте - http://i429.photobucket.com/albums/qq19/tsujzpie/modifiedlineincode_00.jpg
Но, несмотря на то, что я считаю, что соответствующие изменения ясделано, ошибка по-прежнему обнаруживается - (пожалуйста, см. здесь - http://i429.photobucket.com/albums/qq19/tsujzpie/newerrorincode_00.jpg)
Почему это происходит? Прежде чем я забыл, в какой раздел кода я должен вставить строку, которая заставит нажатую кнопку отображатьинформация, соответствующая ей? (то есть, если я нажму на "Контакт" или любую из кнопок, под меню на сцене появится окно ...)