The counter displays sprites in place of number values. More experienced programmers have given me a clue. Why am I getting error # 1010.
Secondly, what am I not seeing that’s so obvious? I wish I went in to this with a better foundation in actionscript 3, but I’m reading and doing my best.
WHAT I SEE
-dollar sign indicates a variable or array «$numbers»
-import flash.utils.Dictionary; «indicates an associative string»
-Error #1010: A term is undefined and has no properties
-is the associative string is fooling me? «maybe I set no values, duh»
-are the property of my symbols are set wrong?
numbers.fla
-MovieClip named «mc-NumberImage» Class «NumberImage»
-Bitmaps «number_0.jpg to number_9.jpg»
NumberDocumentClass.as «NumberDocumentClass»
package {
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class NumberDocumentClass extends Sprite {
private var timer:Timer = new Timer(10);
private var count:int = 0;
private var fcount:int = 0;
private var numbers:NumbersView;
public function NumberDocumentClass() {
timer.addEventListener(TimerEvent.TIMER, incrementCounter);
timer.start();
numbers = new NumbersView();
addChild(numbers);
}
function incrementCounter(event:TimerEvent) {
count++;
fcount=int(count*count/1000);//starts out slow... then speeds up
numbers.setTime(formatCount(fcount));
}
function formatCount(i:int):String {
return ("000000000" + i).substr(-9, 9);
}
}
}
NumbersView.as
package
{
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.utils.Dictionary;
import flash.events.Event;
import caurina.transitions.Tweener;
public class NumbersView extends MovieClip
{
private var _listItems:Array = new Array();
public function NumbersView()
{
var item:NumberImage;
for (var i:Number = 0; i < 9; i++) {
item = new NumberImage();
addChild(item);
item.x = i * item.width;
_listItems.push(item);
}
}
public function setTime($number:String):void {
var nums:Array = $number.split("");
for (var i:Number = 0; i < nums.length; i++) {
if (int(nums[i]) == 0) {
Tweener.removeTweens(_listItems[i].moveableNumber_mc);
if (_listItems[i].moveableNumber_mc.y < 0) {
_listItems[i].moveableNumber_mc.y = 120;
}
Tweener.addTween(_listItems[i].moveableNumber_mc, { y: 0, time:.3 } );
} else {
Tweener.addTween(_listItems[i].moveableNumber_mc, { y: -120 * int(nums[i]), time:.3} );
}
}
}
}
}
ERROR MESSAGE
TypeError: Error #1010: A term is undefined and has no properties.
at NumbersView/setTime()
at NumberDocumentClass/incrementCounter()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
When I test my movie, I’m getting this error: TypeError: Error #1010: A term is undefined and has no properties. I think it’s caused by child objects but I couldn’t fix it. My code:
var wPawn1:Object = new Object();
wPawn1.mc = new WhitePawn();
addChild(wPawn1.mc);
// Black inPeace variables
wPawn1.inPeace = "a2";
var pieces:Object = new Object();
pieces.a2.man = MovieClip(wPawn1.mc);
pieces.a2.x = 70;
pieces.a2.y = 491;
wPawn1.mc.x = pieces.a2.x;
wPawn1.mc.y = pieces.a2.y;
asked Dec 9, 2011 at 0:33
You need to define pieces.a2 and pieces.mc before you can define properties of a2 and mc.
var pieces:Object = new Object();
pieces.a2 = blah;
pieces.mc = blah;
pieces.a2.man = MovieClip(wPawn1.mc);
pieces.a2.x = 70;
pieces.a2.y = 491;
wPawn1.mc.x = pieces.a2.x;
wPawn1.mc.y = pieces.a2.y;
For clarity, your error is referring to a2 and mc as being undefined and having no properties.
answered Dec 9, 2011 at 0:44
![]()
MartyMarty
38.8k19 gold badges91 silver badges162 bronze badges
0
When I test my movie, I’m getting this error: TypeError: Error #1010: A term is undefined and has no properties. I think it’s caused by child objects but I couldn’t fix it. My code:
var wPawn1:Object = new Object();
wPawn1.mc = new WhitePawn();
addChild(wPawn1.mc);
// Black inPeace variables
wPawn1.inPeace = "a2";
var pieces:Object = new Object();
pieces.a2.man = MovieClip(wPawn1.mc);
pieces.a2.x = 70;
pieces.a2.y = 491;
wPawn1.mc.x = pieces.a2.x;
wPawn1.mc.y = pieces.a2.y;
asked Dec 9, 2011 at 0:33
You need to define pieces.a2 and pieces.mc before you can define properties of a2 and mc.
var pieces:Object = new Object();
pieces.a2 = blah;
pieces.mc = blah;
pieces.a2.man = MovieClip(wPawn1.mc);
pieces.a2.x = 70;
pieces.a2.y = 491;
wPawn1.mc.x = pieces.a2.x;
wPawn1.mc.y = pieces.a2.y;
For clarity, your error is referring to a2 and mc as being undefined and having no properties.
answered Dec 9, 2011 at 0:44
![]()
MartyMarty
38.8k19 gold badges91 silver badges162 bronze badges
0
Счетчик отображает спрайты вместо числовых значений. Более опытные программисты дали мне ключ к разгадке. Почему появляется ошибка №1010.
Во-вторых, что такого очевидного я не вижу? Хотел бы я приступить к этому с лучшей основой в ActionScript 3, но я читаю и стараюсь изо всех сил.
ЧТО Я ВИЖУ
-доллар обозначает переменную или массив «$ числа»
-импорт flash.utils.Dictionary; «обозначает ассоциативную строку»
-Ошибка № 1010: термин не определен и не имеет свойств.
-это ассоциативная строка меня обманывает? «может я не установил никаких ценностей, да»
-установлены ли свойства моих символов неправильно?
числа.fla
-MovieClip с именем «mc-NumberImage» Класс «NumberImage» -Bitmaps «number_0.jpg в number_9.jpg»
NumberDocumentClass.as «NumberDocumentClass»
package {
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class NumberDocumentClass extends Sprite {
private var timer:Timer = new Timer(10);
private var count:int = 0;
private var fcount:int = 0;
private var numbers:NumbersView;
public function NumberDocumentClass() {
timer.addEventListener(TimerEvent.TIMER, incrementCounter);
timer.start();
numbers = new NumbersView();
addChild(numbers);
}
function incrementCounter(event:TimerEvent) {
count++;
fcount=int(count*count/1000);//starts out slow... then speeds up
numbers.setTime(formatCount(fcount));
}
function formatCount(i:int):String {
return ("000000000" + i).substr(-9, 9);
}
}
}
NumbersView.as
package
{
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.utils.Dictionary;
import flash.events.Event;
import caurina.transitions.Tweener;
public class NumbersView extends MovieClip
{
private var _listItems:Array = new Array();
public function NumbersView()
{
var item:NumberImage;
for (var i:Number = 0; i < 9; i++) {
item = new NumberImage();
addChild(item);
item.x = i * item.width;
_listItems.push(item);
}
}
public function setTime($number:String):void {
var nums:Array = $number.split("");
for (var i:Number = 0; i < nums.length; i++) {
if (int(nums[i]) == 0) {
Tweener.removeTweens(_listItems[i].moveableNumber_mc);
if (_listItems[i].moveableNumber_mc.y < 0) {
_listItems[i].moveableNumber_mc.y = 120;
}
Tweener.addTween(_listItems[i].moveableNumber_mc, { y: 0, time:.3 } );
} else {
Tweener.addTween(_listItems[i].moveableNumber_mc, { y: -120 * int(nums[i]), time:.3} );
}
}
}
}
}
СООБЩЕНИЕ ОБ ОШИБКЕ
TypeError: Error #1010: A term is undefined and has no properties.
at NumbersView/setTime()
at NumberDocumentClass/incrementCounter()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
|
jowood 1 / 1 / 1 Регистрация: 10.05.2012 Сообщений: 26 |
||||||||
|
1 |
||||||||
|
AS 3.0 24.04.2015, 18:23. Показов 1425. Ответов 6 Метки нет (Все метки)
Здравствуйте, я только начинаю познавать as3.0 связка — php+mysql+as3.0 Столкнулся с проблемой при чтении из php файла… TypeError: Error #1010: Термин не определен и не имеет свойств. Вот часть кода в as3.0
Использую xmllist потому, что при использовании xml — класса возникает другая ошибка. Добавлено через 26 минут Добавлено через 57 минут
__________________
0 |
|
24 / 24 / 9 Регистрация: 18.12.2012 Сообщений: 194 |
|
|
24.04.2015, 18:44 |
2 |
|
text_name.text = name; что это?
0 |
|
1 / 1 / 1 Регистрация: 10.05.2012 Сообщений: 26 |
|
|
24.04.2015, 19:10 [ТС] |
3 |
|
Это передача полученных данных в текстовые поля на форме. Да это и не важно, обработчик застревает на том месте, где я из xml файла пытаюсь получить значения, т.е. тут:
var name:String = myXML.devices.Device[0].Device_name.text();
0 |
|
Модератор 2886 / 1744 / 178 Регистрация: 19.02.2011 Сообщений: 6,434 |
|
|
24.04.2015, 19:17 |
4 |
|
jowood, попробуйте вывести в трэйс значение, при необходимости уменьшайте цепочку. Дождитесь адекватных результатов. Вот на этом этапе станет ясно, что же не получается.
1 |
|
jowood 1 / 1 / 1 Регистрация: 10.05.2012 Сообщений: 26 |
||||||||||||||||||||
|
24.04.2015, 20:22 [ТС] |
5 |
|||||||||||||||||||
|
я в trace вывел следующее:
в ответ на это получил структуру моего xml’а. его он считывает. попробовал сделать так:
Выводит 0 в обоих случаях. Как можно посмотреть потомков? И еще вот так:
Выводит Null А еще какие теги для кода actionscript, а то я на панельке найти не могу, приходится модераторам исправлять Добавлено через 32 минуты Добавлено через 25 минут
пишем
Должно сработать
1 |
|
zhunshun 591 / 434 / 195 Регистрация: 05.04.2015 Сообщений: 1,743 |
||||
|
26.04.2015, 11:13 |
6 |
|||
а надо же хмл
0 |
|
1 / 1 / 1 Регистрация: 10.05.2012 Сообщений: 26 |
|
|
26.04.2015, 14:59 [ТС] |
7 |
|
а надо же хмл xml не надо, так как php сценарий парсит данные в виде xml и при запуске AS скрипта выполняется этот самый php. Да и вообще проблема решилась)
0 |
Ошибка:
TypeError: Error #1010: A term is undefined and has no properties. at Untitled_2_fla::MainTimeline/frame1()[Untitled_2_fla.MainTimeline::frame1:4]
Кажется, не могу понять, в чем дело.
Вот мой код:
import flash.events.MouseEvent;
btnMc1.txtSourceMc.gotoAndStop();
btnMc1.addEventListener(MouseEvent.ROLL_OVER, over);
btnMc1.addEventListener(MouseEvent.ROLL_OUT, out);
function over(e: MouseEvent) {
btnMc1.buttonMode = true;
btnMc1.gotoAndPlay(1);
}
function out(e: MouseEvent) {
btnMc1.gotoAndPlay(62);
}
5377037, 16 апреля 2018 г., 15:25
420
2
Ответы:
btnMc1.txtSourceMc.gotoAndStop();
Измените это на
btnMc1.txtSourceMc.gotoAndStop(1);
Убедитесь, что вы правильно назвали себя MC. Сначала перейдите на сцену и нажмите btnMc1. Убедитесь, что вы назвали его так на панели свойств (окна -> свойства). Затем дважды щелкните btnMc1 и сделайте то же самое для txtSourceMc, убедитесь, что у него правильное имя. Я предполагаю, что у вас есть txtSourceMc внутри btnMc1 на временной шкале.
Если проблема не устранена, вероятно, потому, что все, что вы загружаете в btnMc1 или txtSourceMc, слишком велико. Таким образом, он не может создать экземпляр в кадре, который вы пытаетесь вызвать в этом коде, поэтому он возвращается как undefined.
Чтобы решить эту проблему, щелкните правой кнопкой мыши btnMc1 в библиотеке и выберите свойства. Затем выберите экспорт для ActionScript и убедитесь, что установлен флажок для экспорта на frame1. Сделайте то же самое для txtSourceMc.
user1234567, 17 апреля 2018 г., 12:18
Решено
Вам нужно создать переменную btnMc1, например var btnMc1, и вам нужно будет присвоить ей такой класс, как var btnMc1:
whatEverObjectICreated = new whatEverObjectICreated;
Paula, 18 апреля 2018 г., 16:43
Интересные вопросы для изучения
When testing my project, I got this error :
TypeError: Error #1010: A term is undefined and has no properties. firegame.as:115]
at firegame/checkhitammo()[..DesktopFlashfiregame.as:115
at firegame/mainloop()[..DesktopFlashfiregame.as:77
I don’t understand why and if I change the if statement to something simple it’s all work fine.
This is my code :
package {
import flash.display.*;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.Event;
public class firegame extends MovieClip {
var tiger:Tiger = new Tiger();
var enemys:Array = new Array();
var scorea:Number = 0;
var ammoleft:Number = 0;
var ammo:Array = new Array();
var setint:Timer = new Timer(110);
var setenemy:Timer = new Timer(980);
var newenemy:Number;
var hitcheck:Array = new Array();
var totallength:Number;
public function firegame() {
startgame();
}
public function startgame() {
addplayer();
stage.addEventListener(MouseEvent.MOUSE_MOVE, moveplayer);
stage.addEventListener(MouseEvent.MOUSE_DOWN, shotfire);
stage.addEventListener(MouseEvent.MOUSE_UP, shotfirestop);
setint.addEventListener(TimerEvent.TIMER, shotfirestart);
setenemy.addEventListener(TimerEvent.TIMER, addenemy);
stage.addEventListener(Event.ENTER_FRAME, mainloop);
setenemy.start();
}
public function addplayer():void {
tiger.y = 200;
tiger.x = 507;
addChild(tiger);
}
public function moveplayer(e:MouseEvent):void {
tiger.y = mouseY;
tiger.x = 507;
}
public function shotfire(e:MouseEvent):void {
setint.start();
}
public function shotfirestop(e:MouseEvent):void {
setint.stop();
}
public function shotfirestart(e:TimerEvent):void {
var fire:Fire = new Fire();
fire.x = 460;
fire.y = mouseY;
addChild(fire);
ammoleft -= 1;
ammo.push(fire);
}
public function addenemy(e:TimerEvent):void {
var enemy:Enemy = new Enemy();
enemy.x = 0;
enemy.y = Math.floor(Math.random() * (370 - 30) + 30);
addChild(enemy);
enemys.push(enemy);
}
public function mainloop(e:Event):void {
setscoreandammo();
moveammo();
moveenemy();
checkhitammo();
}
public function moveammo():void {
for (var i:int = 0; i < ammo.length; i++) {
ammo[i].x -= 15;
if (ammo[i].x < -30) {
removeChild(ammo[i]);
ammo[i] = null;
ammo.splice(i, 1);
}
}
}
public function moveenemy():void {
for (var b:int = 0; b < enemys.length; b++) {
enemys[b].x += 5;
if (enemys[b].x > 590) {
removeChild(enemys[b]);
enemys[b] = null;
enemys.splice(b, 1);
}
}
}
public function setscoreandammo():void {
score.text = String(scorea);
leftammo.text = String(ammoleft);
}
public function checkhitammo():void {
for (var i:int = ammo.length; i >= 0; i--) {
for (var b:int = enemys.length; b >= 0; b--) {
if (ammo[i].hitTestObject(enemys[b])) { // <--- this is the line where the error is fired
removeChild(ammo[i]);
ammo[i] = null;
ammo.splice(i, 1);
removeChild(enemys[b]);
enemys[b] = null;
enemys.splice(b, 1);
scorea += 50;
break;
}
}
}
}
}
}
The counter displays sprites in place of number values. More experienced programmers have given me a clue. Why am I getting error # 1010.
Secondly, what am I not seeing that’s so obvious? I wish I went in to this with a better foundation in actionscript 3, but I’m reading and doing my best.
WHAT I SEE
-dollar sign indicates a variable or array «$numbers»
-import flash.utils.Dictionary; «indicates an associative string»
-Error #1010: A term is undefined and has no properties
-is the associative string is fooling me? «maybe I set no values, duh»
-are the property of my symbols are set wrong?
numbers.fla
-MovieClip named «mc-NumberImage» Class «NumberImage» -Bitmaps «number_0.jpg to number_9.jpg»
NumberDocumentClass.as «NumberDocumentClass»
package {
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class NumberDocumentClass extends Sprite {
private var timer:Timer = new Timer(10);
private var count:int = 0;
private var fcount:int = 0;
private var numbers:NumbersView;
public function NumberDocumentClass() {
timer.addEventListener(TimerEvent.TIMER, incrementCounter);
timer.start();
numbers = new NumbersView();
addChild(numbers);
}
function incrementCounter(event:TimerEvent) {
count++;
fcount=int(count*count/1000);//starts out slow... then speeds up
numbers.setTime(formatCount(fcount));
}
function formatCount(i:int):String {
return ("000000000" + i).substr(-9, 9);
}
}
}
NumbersView.as
package
{
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.utils.Dictionary;
import flash.events.Event;
import caurina.transitions.Tweener;
public class NumbersView extends MovieClip
{
private var _listItems:Array = new Array();
public function NumbersView()
{
var item:NumberImage;
for (var i:Number = 0; i < 9; i++) {
item = new NumberImage();
addChild(item);
item.x = i * item.width;
_listItems.push(item);
}
}
public function setTime($number:String):void {
var nums:Array = $number.split("");
for (var i:Number = 0; i < nums.length; i++) {
if (int(nums[i]) == 0) {
Tweener.removeTweens(_listItems[i].moveableNumber_mc);
if (_listItems[i].moveableNumber_mc.y < 0) {
_listItems[i].moveableNumber_mc.y = 120;
}
Tweener.addTween(_listItems[i].moveableNumber_mc, { y: 0, time:.3 } );
} else {
Tweener.addTween(_listItems[i].moveableNumber_mc, { y: -120 * int(nums[i]), time:.3} );
}
}
}
}
}
ERROR MESSAGE
TypeError: Error #1010: A term is undefined and has no properties.
at NumbersView/setTime()
at NumberDocumentClass/incrementCounter()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
It sounds like you are accessing an undefined index in your array in the file NumbersView.as.
_listItems[i]
In your for loop for _listItems:
for (var i:Number = 0; i < 9; i++) {
You set the _listItems to 0 to 8.
Then in your setTime for loop:
for (var i:Number = 0; i < nums.length; i++) {
You go to the length of the Array to access _listItems[i].
Is it possible that the length of this array is more than 8? If so then that could cause the error.
