Help With Undefined Error
Hi guys! I'm tearing my hair out with this one!
Basically, I'm creating a small "Click the Country" game.
I have 10 frames with questions on, and have created an array, which will chose the 10 questions in a random order without repeated frames.
When the user gets the country correct, they will be taken to a "correct" screen, and the user has to click "continue". The continue button has this script;
on (release) {
_root.gotoAndPlay (randArray[frame]);
//testing purposes:
trace (randArray[frame]);
frame++;
}
When clicked, it comes up as undefined. I think it may be something to do with the randArray. I've attached the script from the main timeline
Can anybody see where I'm going wrong here?
Thanks
Attach Code
_root.frame=0;
// populates an array called countArray with the possible frame numbers from 11 - 20
num = 21
countArray= new Array;
for (i=11; i<num; i++) {
countArray.splice(num, 0, i);
}
//test to check array is correct
trace(countArray.toString());
//randomly shuffles array and returns as custom defined new array
Array.prototype.shuffle = function (secondArray){
interimArray = new Array();
arrayCount = ((this).length);
deleteCount = ((secondArray).length);
secondArray.splice(0, deleteCount);
//copies values from original array into interim array so that original data is not lost
for (a=0; a<arrayCount; a++) {
value = this[a];
interimArray.splice(a, 0, value);
}
//chooses random array data * copies into first position in new array,
// deletes that data from interim array so it can't be chosen again
for (a=0; a<10; a++) {
num = (random(interimArray.length));
value = interimArray[num];
secondArray.splice(1, 0, value);
interimArray.splice(num, 1);
}
}
// here we tell Flash to perform the array shuffle on
//your "countArray" and to call the new Array to be populated
//with the 10 random numbers "randArray"
countArray.shuffle(randArray=new Array());
trace (randArray.toString());
Adobe > ActionScript 1 and 2
Posted on: 04/15/2007 01:15:18 PM
View Complete Forum Thread with Replies
Sponsored Links:
Error #1010: A Term Is Undefined And Has No Properties - Useless Error Message
I hate runtime errors!
ActionScript Code:
TypeError: Error #1010: A term is undefined and has no properties.
at Image/setImage()
at Instructions/preNavigateCallback()
at Instructions/nextSlide()
The issue is that I deleted a movieclip from the stage, but the code referencing that clip was not changed.
Why can't the error say something more useful, for example, including the line number, or the actual "term"?
ActionScript Code:
TypeError: Error #1010: A term is undefined and has no properties.
at "container.guide.visible"
at Image/setImage() : line 214
at Instructions/preNavigateCallback() : line 186
at Instructions/nextSlide() : line 103
Does anyone know why it is so damn vague!? I realise that maybe line numbers probably get lost once compiled, but these kinds of errors always cost me so much debugging time, and are very frustrating - is it impossible to provide the "term" though?.
And does anyone have any good advice on how to avoid them, or track them down with the limited amount of info supplied?
Many thanks,
Dave
View Replies !
View Related
Undefined Error
Can someone please tell me how to make this work?
tring.prototype.verificaCPF = function(){
cpf = this.toString();
soma1=0;
soma2=0;
for(i=0;i<9;i++){
numero1 = parseInt(cpf.charAt(i))*(i+1);
soma1=soma1 + numero1;
}
for(i=1;i<10;i++){
numero2 = parseInt(cpf.charAt(i))*i;
soma2=soma2 + numero2;
}
v1=soma1%11;
v2=soma2%11;
if(v1==10)v1=0;
if(v2==10)v2=0;
if(v1==parseInt(cpf.charAt(9)) && v2==parseInt(cpf.charAt(10))){
return "CPF Válido";
}else{
return "CPF Inválido";
}
}
//Test
cpf = "85723185187";
trace(cpf.verificaCPF());
View Replies !
View Related
Undefined Error
Hi,
I'm processing basic customer data into a form. Certain fields are mandatory and I test for nulls. The null checker initially worked - but no longer. Now if I leave the field blank it gets populated by an "undefined" and the null checker doesn't catch it. This is my code:
function formcheck1 () {
if ((((email == null)) || (email.length<1)) || (email == "ERROR! Address not valid")) {
this.eemail._visible = true;
action = "";
}
if (!validate(email)) {
this.EnterTitle._visible = true;
this.eemail._visible = true;
action = "";
}
if (fname == null) {
this.EnterTitle._visible = true;
this.efname._visible = true;
action = "";
}
if (lname == null) {
this.EnterTitle._visible = true;
this.elname._visible = true;
action = "";
}
if (address1 == null) {
this.EnterTitle._visible = true;
this.eaddress1._visible = true;
action = "";
}
if (city == null) {
this.EnterTitle._visible = true;
this.ecity._visible = true;
action = "";
}
if (state == null) {
this.EnterTitle._visible = true;
this.estate._visible = true;
action = "";
}
if (zipcode == null) {
this.EnterTitle._visible = true;
this.ezipcode._visible = true;
action = "";
}
if (country == null) {
this.EnterTitle._visible = true;
this.ecountry._visible = true;
action = "";
}
if (telno == null) {
this.EnterTitle._visible = true;
this.etelno._visible = true;
action = "";
}
if ((validate(email)) && (email != "ERROR!") && (fname != "") && (lname != "") && (address != "") && (city != "") && (state != "") && (zipcode != "") && (country != "") && (telno != "")) {
action = "send";
I hope someone can help.
Cheers,
Hedley
is not workingThis isn't working. The null checker i because the variables a For some reason it's moving on with the data being filled as undefined. Does
View Replies !
View Related
[F8] Undefined Error - Please Help
Hi guys! I'm tearing my hair out with this one!
Basically, I'm creating a small "Click the Country" game.
I have 10 frames with questions on, and have created an array, which will chose the 10 questions in a random order without repeated frames.
I've taken actionscript from this topic;
http://www.actionscripts.org/forums/...6526#post46526
When the user gets the country correct, they will be taken to a "correct" screen, and the user has to click "continue". The continue button has this script;
Code:
on (release) {
_root.gotoAndPlay (randArray[frame]);
//testing purposes:
trace (randArray[frame]);
frame++;
}
When clicked, it comes up as undefined. I think it may be something to do with the randArray. Here's the script from the main timeline
Code:
_root.frame=0;
// populates an array called countArray with the possible frame numbers from 11 - 20
num = 21
countArray= new Array;
for (i=11; i<num; i++) {
countArray.splice(num, 0, i);
}
//test to check array is correct
trace(countArray.toString());
//randomly shuffles array and returns as custom defined new array
Array.prototype.shuffle = function (secondArray){
interimArray = new Array();
arrayCount = ((this).length);
deleteCount = ((secondArray).length);
secondArray.splice(0, deleteCount);
//copies values from original array into interim array so that original data is not lost
for (a=0; a<arrayCount; a++) {
value = this[a];
interimArray.splice(a, 0, value);
}
//chooses random array data * copies into first position in new array,
// deletes that data from interim array so it can't be chosen again
for (a=0; a<10; a++) {
num = (random(interimArray.length));
value = interimArray[num];
secondArray.splice(1, 0, value);
interimArray.splice(num, 1);
}
}
// here we tell Flash to perform the array shuffle on
//your "countArray" and to call the new Array to be populated
//with the 10 random numbers "randArray"
countArray.shuffle(randArray=new Array());
trace (randArray.toString());
Can anybody help me please?!
View Replies !
View Related
Getting An Undefined Error
Hi,
I am getting an undefined area when I test the scene. Any suggestions? Thanks.
Ext_text = new LoadVars();
Ext_text.onLoad = addText;
Ext_text.load("spa_01.txt");
function addText() {
content.htmlText = this.spa_01;
}
View Replies !
View Related
XML Undefined Error
I have the following code on an MC, the MC is called '_fader'...
Code:
on (construct, keyPress "") {
_xmlfile = "images.xml";
_loop = true;
}
INSIDE the MC '_fader' I have the following:
Code:
#initclip
ImageFader = function () {
this.__init__();
};
ImageFader.prototype = new MovieClip();
ImageFader.prototype.__init__ = function () {
this._xscale = 100;
this._yscale = 100;
this.bounding_box.unloadMovie();
this._fader_.unloadMovie();
this._dataProvider = new Array();
this._count = 0;
this._depth = 1;
this._isLoaded = -1;
if (this._S_) {
clearInterval(this._S_);
}
if (this._xmlfile != "") {
this.loadXML(this._xmlfile);
}
};
ImageFader.prototype.loadXML = function (x) {
var v9 = new XML();
v9.ignoreWhite = true;
v9.path = this;
v9.load(x);
v9.onLoad = function () {
for (v2 = 0; v2 < this.firstChild.childNodes.length; v2++) {
var v4 = this.firstChild.childNodes[v2].attributes.TRANSITION;
var v3 = this.firstChild.attributes.PAUSE;
var v5 = this.firstChild.childNodes[v2].firstChild.nodeValue;
this.path._dataProvider.push({img: v5, transition: v4, pause: v3});
}
this.path.startFading();
false;
};
};
ImageFader.prototype.startFading = function () {
if (this._dataProvider.length > 0) {
this.makeFader(true);
}
};
ImageFader.prototype.makeFader = function (first) {
this._isLoaded = -1;
this._depth++;
this._tmp = this.attachMovie("ImageLoader", "ImageLoader" + this._depth, this._depth);
this._old1 = this["ImageLoader" + (this._depth - 1)];
this._old2 = this["ImageLoader" + (this._depth - 2)];
this._tmp.loadHandler("isLoaded", this._count);
this._tmp.autoStart = false;
this._tmp.transition = this._dataProvider[this._count].transition;
this._tmp.loadImage(this._dataProvider[this._count].img);
this._t1 = getTimer();
this.onEnterFrame = function () {
this._t2 = getTimer();
if (this._t2 - this._t1 > this._dataProvider[this._count].pause || first == true) {
if (this._isLoaded == this._count || (this._isLoaded == 1 && this._count == 0)) {
delete this.onEnterFrame;
this._tmp.start();
this._old1.fadeOut();
this._old2.removeMovieClip();
if (this._count + 1 < this._dataProvider.length) {
this._count++;
this.makeFader();
return;
} else {
if (this._loop == true) {
this._count = 0;
this.makeFader();
}
}
}
}
};
};
ImageFader.prototype.isLoaded = function (num) {
this._isLoaded = num;
};
Object.registerClass("ImageFader", ImageFader);
#endinitclip
When I run it I keep getting an 'undefined' error, does anyone have any ideas as I'm struggling...
View Replies !
View Related
Undefined Var Error
I have been taking scripting I am familiar with from AS2 and making adjustments to AS3, just very simple files. Of course, I run into problems and through research, I have managed to solve most them, but I have a problem that has me absolutely stumped.
I created a file with a simple timer that when it reaches a certain time moves to a different frame:
stop();
var startTime:Number= 0;
stage.addEventListener(MouseEvent.CLICK, reset);
function reset(myevent:MouseEvent):void {
startTime = getTimer();
}
stage.addEventListener(Event.ENTER_FRAME, showTime);
function showTime(myevent:Event):void {
var currentTime = getTimer();
var elapsedTime = (currentTime - startTime) / 1000;
myDisplay_txt.text = elapsedTime;
if (elapsedTime >= 5){
gotoAndStop(2);
}
}
All is well and good, but when I try to combine it with a file with has score buttons, I get an error.
stop();
var currentScore = 0;
score.text = "0";
function scorept(myevent:MouseEvent):void {
score.text = currentScore+=1;
}
scoreOne_btn.addEventListener(MouseEvent.MOUSE_DOW N, scorept);
function scoreFivept(myevent:MouseEvent):void {
score.text = currentScore+=5;
}
scoreFive_btn.addEventListener(MouseEvent.MOUSE_DO WN, scoreFivept);
function scoreMinusFivept(myevent:MouseEvent):void {
score.text = currentScore-=5;
}
scoreMinusFive_btn.addEventListener(MouseEvent.MOU SE_DOWN, scoreMinusFivept);
function scoreMinusOnept(myevent:MouseEvent):void {
score.text = currentScore-=1;
}
scoreMinusOne_btn.addEventListener(MouseEvent.MOUS E_DOWN, scoreMinusOnept);
var startTime:Number= 0;
startTime = getTimer();
stage.addEventListener(Event.ENTER_FRAME, showTime);
function showTime(myevent:Event):void{
var currentTime = getTimer();
var elapsedTime = (currentTime - startTime) / 1000;
tme_txt.text = elapsedTime;
if (elaspsedTime >= 5){
gotoAndStop(3);
}
}
stage.addEventListener(Event.ENTER_FRAME, winGame);
function winGame(myevent:Event):void {
if (currentScore >=20) {
gotoAndStop(4);
}
}
Now I get a compiler error:
1120: Access of undefined property elaspsedTime.
WTF? If I turn off the compiler strict mode, it will render, the score part works, but the timer just go on forever. The var for elapsedTime is RIGHT THERE!!
What the heck am I missing????
View Replies !
View Related
Undefined Error
I'm trying to pull in a value from my XML doc and use it to load in a text file...I can trace the value fine but am losing it somehow in my load function...
Code:
for (var j = -1; j<i; j++) {
loadMovie(image_path, contentMC.itemsMC[name].picHolder);
contentMC.itemsMC[name].myLink = link_to;
contentMC.itemsMC[name].myTitle = case_title;
contentMC.itemsMC[name].onRollOver = function() {
casetitle.htmlText = this.myTitle;
};
contentMC.itemsMC[name].onRelease = function() {
trace(this.myLink);
var lvArticleContent:LoadVars = new LoadVars();
lvArticleContent.onData = function(sHTMLData:String) {
_parent.tArticle.htmlText = sHTMLData;
};
var cssStyles:TextField.StyleSheet = new TextField.StyleSheet();
cssStyles.onLoad = function() {
_parent.tArticle.styleSheet = this;
lvArticleContent.load("studies/"+myLink+".html");
};
cssStyles.load("studies/styles.css");
};
}
so I can trace "myLink" but in the cssStyles.onLoad function it gets lost...anyone know what I'm doing wrong...it's probably a path problem...function inside a function or something like that...any help would be greatly appreciated.
Thanks
View Replies !
View Related
Undefined Error
Hello all,
When creating flash movies, I get undefined for all my text fields with external variables whenever a visitor doesn't type in www at the beginning of the url. Such as: domainname.com
But when a user enters the www such as: www.domainname.com, the flash movie works fine and the variables load just fine.
Is this a common error? What might I be doing wrong? And is there any way of fixing this?
Thanks
View Replies !
View Related
XML Undefined Error
I have the following code on an MC, the MC is called '_fader'...
Code:
on (construct, keyPress "") {
_xmlfile = "images.xml";
_loop = true;
}
INSIDE the MC '_fader' I have the following:
Code:
#initclip
ImageFader = function () {
this.__init__();
};
ImageFader.prototype = new MovieClip();
ImageFader.prototype.__init__ = function () {
this._xscale = 100;
this._yscale = 100;
this.bounding_box.unloadMovie();
this._fader_.unloadMovie();
this._dataProvider = new Array();
this._count = 0;
this._depth = 1;
this._isLoaded = -1;
if (this._S_) {
clearInterval(this._S_);
}
if (this._xmlfile != "") {
this.loadXML(this._xmlfile);
}
};
ImageFader.prototype.loadXML = function (x) {
var v9 = new XML();
v9.ignoreWhite = true;
v9.path = this;
v9.load(x);
v9.onLoad = function () {
for (v2 = 0; v2 < this.firstChild.childNodes.length; v2++) {
var v4 = this.firstChild.childNodes[v2].attributes.TRANSITION;
var v3 = this.firstChild.attributes.PAUSE;
var v5 = this.firstChild.childNodes[v2].firstChild.nodeValue;
this.path._dataProvider.push({img: v5, transition: v4, pause: v3});
}
this.path.startFading();
false;
};
};
ImageFader.prototype.startFading = function () {
if (this._dataProvider.length > 0) {
this.makeFader(true);
}
};
ImageFader.prototype.makeFader = function (first) {
this._isLoaded = -1;
this._depth++;
this._tmp = this.attachMovie("ImageLoader", "ImageLoader" + this._depth, this._depth);
this._old1 = this["ImageLoader" + (this._depth - 1)];
this._old2 = this["ImageLoader" + (this._depth - 2)];
this._tmp.loadHandler("isLoaded", this._count);
this._tmp.autoStart = false;
this._tmp.transition = this._dataProvider[this._count].transition;
this._tmp.loadImage(this._dataProvider[this._count].img);
this._t1 = getTimer();
this.onEnterFrame = function () {
this._t2 = getTimer();
if (this._t2 - this._t1 > this._dataProvider[this._count].pause || first == true) {
if (this._isLoaded == this._count || (this._isLoaded == 1 && this._count == 0)) {
delete this.onEnterFrame;
this._tmp.start();
this._old1.fadeOut();
this._old2.removeMovieClip();
if (this._count + 1 < this._dataProvider.length) {
this._count++;
this.makeFader();
return;
} else {
if (this._loop == true) {
this._count = 0;
this.makeFader();
}
}
}
}
};
};
ImageFader.prototype.isLoaded = function (num) {
this._isLoaded = num;
};
Object.registerClass("ImageFader", ImageFader);
#endinitclip
When I run it I keep getting an 'undefined' error, does anyone have any ideas as I'm struggling...
View Replies !
View Related
Getting An Undefined Error
Hi,
I am getting an undefined area when I test the scene. Any suggestions? Thanks.
Ext_text = new LoadVars();
Ext_text.onLoad = addText;
Ext_text.load("spa_01.txt");
function addText() {
content.htmlText = this.spa_01;
}
View Replies !
View Related
Undefined Error
for(j=0;j<str.length;j++){
if (str.charCodeAt(j)<=90&& str.charCodeAt(j)>=65){
temp=Math.abs((str.charCodeAt(j)-65));
iNumOfSym[temp]+=1;
trace(iNumOfSym);
}
In the above part code i have declared iNumOfSym as a string... .. but when i run this code and trace iNumOfSym.. i get undefined as the output.. why?? how should i fix it??
View Replies !
View Related
Undefined Error ?
Hi, I am a bit of a newbie when it comes to flash(but learning fast). I have an issue with the code below. This has been constructed from 2 tutorials I have found... 1 to load xml and the other to do a simple slideshow. If I seperate the xml bit and the slide show bits they work fine. If I put them together it does not work. It seems to says that the XML is undefined. It doesnt go into the loop that puts the data in the array(I have debugged that much). Any help would be appreciated... Very frustrating.... I'm sure it's something stupid I'm doing.
var picArray:Array = new Array(); //array to hold the image and all of its attributes
var thisNode:XMLNode = new XMLNode();
var imageXML:XML = new XML();
imageXML.ignoreWhite = true;
imageXML.onLoad = function(success:Boolean) {
for(var i:Number = 0;i<imageXML.firstChild.childNodes.length;i++) {
thisNode = imageXML.firstChild.childNodes[i];
picArray.push([thisNode.attributes.img,thisNode.attributes.Captio n,thisNode.attributes.link]);
}
//When the xml is completely loaded,
//delete the xml (since its now contained in picArray)
//and continue to the slideshow
delete imageXML;
}
imageXML.load("pg7.xml");
this.fadeSpeed = 20;
this.pIndex = 0;
// MovieClip methods ----------------------------------
// d=direction; should 1 or -1 but can be any number
//loads first image automatically
loadMovie(picArray[0][0],_root.photo);
MovieClip.prototype.changePhoto = function(d) {
// make sure pIndex falls within picArray.length
this.pIndex = (this.pIndex+d)%picArray.length;
if (this.pIndex<0) {
this.pIndex +=picArray.length;
}
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
// specify the movieclip to load images into
var p = _root.photo;
//------------------------------------------
p._alpha = 0;
p.loadMovie(picArray[this.pIndex][0]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
//trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
I have attached the fla.
Thanks
Adrian
View Replies !
View Related
Undefined Error
In the code below:
Code:
var loadFiles:LoadVars = new LoadVars();
loadFiles.load("http://127.0.0.1/karenburns/get_files.php?dir=horiz");
total = this["total"];
function loadImageLeft() {
var x = 0;
imagePath = this["image" + x];
trace("Image path left: " + imagePath);
loadMovie("file:///C|/dev%5Fenvironment/photography/horiz/" + imagePath, picHolderLeft);
x++;
}
function loadImageRight() {
var y = 2;
imagePathRight = this["image" + y];
trace("Image path right: " + imagePathRight);
loadMovie("file:///C|/dev%5Fenvironment/photography/horiz/" + imagePathRight, picHolderRight);
y++;
}
loadFiles.onLoad = function(success:Boolean) {
if (success) {
setInterval(loadImageLeft, 2000);
setInterval(loadImageRight, 3000);
} else {
trace("Error loading/parsing LoadVars.");
}
}
I get an error that imagePath and imagePathRight is undefined when testing the flash movie. Can anyone see why I am getting this error? Thanks!
View Replies !
View Related
XML Undefined Error
I have the following code on an MC, the MC is called '_fader'...
Code:
on (construct, keyPress "") {
_xmlfile = "images.xml";
_loop = true;
}
INSIDE the MC '_fader' I have the following:
Code:
#initclip
ImageFader = function () {
this.__init__();
};
ImageFader.prototype = new MovieClip();
ImageFader.prototype.__init__ = function () {
this._xscale = 100;
this._yscale = 100;
this.bounding_box.unloadMovie();
this._fader_.unloadMovie();
this._dataProvider = new Array();
this._count = 0;
this._depth = 1;
this._isLoaded = -1;
if (this._S_) {
clearInterval(this._S_);
}
if (this._xmlfile != "") {
this.loadXML(this._xmlfile);
}
};
ImageFader.prototype.loadXML = function (x) {
var v9 = new XML();
v9.ignoreWhite = true;
v9.path = this;
v9.load(x);
v9.onLoad = function () {
for (v2 = 0; v2 < this.firstChild.childNodes.length; v2++) {
var v4 = this.firstChild.childNodes[v2].attributes.TRANSITION;
var v3 = this.firstChild.attributes.PAUSE;
var v5 = this.firstChild.childNodes[v2].firstChild.nodeValue;
this.path._dataProvider.push({img: v5, transition: v4, pause: v3});
}
this.path.startFading();
false;
};
};
ImageFader.prototype.startFading = function () {
if (this._dataProvider.length > 0) {
this.makeFader(true);
}
};
ImageFader.prototype.makeFader = function (first) {
this._isLoaded = -1;
this._depth++;
this._tmp = this.attachMovie("ImageLoader", "ImageLoader" + this._depth, this._depth);
this._old1 = this["ImageLoader" + (this._depth - 1)];
this._old2 = this["ImageLoader" + (this._depth - 2)];
this._tmp.loadHandler("isLoaded", this._count);
this._tmp.autoStart = false;
this._tmp.transition = this._dataProvider[this._count].transition;
this._tmp.loadImage(this._dataProvider[this._count].img);
this._t1 = getTimer();
this.onEnterFrame = function () {
this._t2 = getTimer();
if (this._t2 - this._t1 > this._dataProvider[this._count].pause || first == true) {
if (this._isLoaded == this._count || (this._isLoaded == 1 && this._count == 0)) {
delete this.onEnterFrame;
this._tmp.start();
this._old1.fadeOut();
this._old2.removeMovieClip();
if (this._count + 1 < this._dataProvider.length) {
this._count++;
this.makeFader();
return;
} else {
if (this._loop == true) {
this._count = 0;
this.makeFader();
}
}
}
}
};
};
ImageFader.prototype.isLoaded = function (num) {
this._isLoaded = num;
};
Object.registerClass("ImageFader", ImageFader);
#endinitclip
When I run it I keep getting an 'undefined' error, does anyone have any ideas as I'm struggling...
View Replies !
View Related
Error 1010....what Is Undefined?
This is really strange. I've got a button symbol on stage with an instance name of aboutUs_btn. My code on my AS layer is:
this.aboutUs_btn.addEventListener(MouseEvent.MOUSE _DOWN, about);
function about(evt:MouseEvent):void {
this.wipe_mc.gotoAndPlay(2);
this.gotoAndStop("history");
head.unload();
}
And then I test the movie and get this error and it makes no sense to me.
TypeError: Error #1010: A term is undefined and has no properties.
at main1_fla::MainTimeline/about()
What's weird is I tried this in another .fla and it didn't bring up the error. That makes no sense. They've both got Publish Settings for AS3/FL9
View Replies !
View Related
[CS3] XML Undefined Showing Error
Hi all,
Im having a huge problem with an xml gallery and I need help. Basically all the images and titles are pulled from an xml sheet. But if there are no titles I want it to display nothing but It keeps showing "undefined" in the text box. My code to pull the text in is below.
thanks
Code:
_root.title1.text = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;
Any help will bring serious kudos
View Replies !
View Related
Error #1010: Something Is Undefined, But I Won't Tell You Which.
TypeError: Error #1010: A term is undefined and has no properties.
at EKG1_fla::MainTimeline/EKG1_fla::frame2()
OK, I've narrowed possibilities by sliding code keyframes, and now only have a couple hundred lines of code to guess at by comment out trial and error.
Anyone know a way for Flash to be more specific.
(like the app programmers couldn't foresee any value is passing the offending term)
View Replies !
View Related
Slideshow Error 'undefined'
Can anyone tell me what I am doing wrong with this code... When I run it it keeps saying 'undefined'...
Code:
import com.mosesSupposes.fuse.*;
ZigoEngine.register(Fuse, PennerEasing);
for (i=1;i<11;i++) {
var tmpClip:MovieClip = eval ("Pic" + i)
tmpClip.loadMovie("images/"+i+".jpg")
}
// Start the slideshow on a setInterval
var slideShowTimer:Number = setInterval(nextImage, 5000);
var counter:Number = 0;
// The workhorse function, gets called by setInterval, and should run every 5 seconds.
function nextImage():Void {
var img:MovieClip = images[counter % 3];
img.swapDepths(counter);
trace(img.getDepth());
img._alpha = 0;
img._visible = true;
img.alphaTo(100, 2, "easeOutSine", null, {func:cleanUpPrevious, args:[(counter-1) % 3]});
counter++;
}
// A function to be used in the tween callback to make the image that was just covered up invisible.
function cleanUpPrevious(image:Number):Void {
images[image]._visible = false;
}
// Show first image immediately.
nextImage();
View Replies !
View Related
Array Value Undefined Error
hi!
I require values stored in an array...but, when 'i' in a for loop is at, say 20, I need the 10th value of the array...similarly, when 'i' increments to 30, I require the 20th value...and so on...
i tried 'trace(array[i-10])' but thats shows up as 'undefined' in output...
wud appreciate all suggestions!
View Replies !
View Related
Error Opening Url Undefined
empty_mc.loadMovie(Main.swf) - i am trying to load an external swf into a empty_mc on the stage. When I test it i am getting this in the output:
"file:///C|/Documents%20and%20Settings/Owner/Desktop/My%20Site/FLA/undefined"
Error opening URL
View Replies !
View Related
[Flash8] Undefined Error
Hi, I get a "undefined" for the var "_root["star" + i].adjustPosX" on the last line, how could that be?
Thanks in advance,
Joost Pastoor
Code:
/* S T A R S */
_root.starArr = new Array();
for(i=0; i < _root.gb.cStars; i++)
{
starSize = Math.random()*40+10;
_root.attachMovie("Star", "star" + i, 1000+1);
_root["star" + i]._alpha = Math.random()*40+20;
_root["star" + i]._xscale = _root.gb.starSize;
_root["star" + i]._yscale = _root.gb.starSize;
_root["star" + i].xPos = Math.random()*_root.gb.square;
_root["star" + i].yPos = Math.random()*_root.gb.square;
_root["star" + i].adjustPosX = 0;
_root["star" + i].adjustPosY = 0;
_root["star" + i].defAlpha = _root["star" + i]._alpha;
_root.starArr[i] = _root["star" + i];
_root["star" + i].onEnterFrame = function() {
trace("enterframe" + _root["star" + i].adjustPosX);
View Replies !
View Related
HELP ME - Lee's MP3 Tutorial - Undefined Error :(
Ok, so basically, here's how it all went down. I followed the tutorial all the way through tutorial 2 with no problems... Then I got to tutorial three, and followed everything that Lee said, typed, etc... But then when I got to the end to test my movie, I got this:
My path, C:/Users/MeaningfulCause/Documents/Mashun/Homepage/Jukebox
with a /undefined on the end.
My mp3Player.as (for me it's Jukebox.as) document, is EXACTLY the same as Lee's. At one point I even got so deperate as to copy and paste the XML file over to mine, but even that didn't work! I can't figure out what I'm doing wrong here; I haven't even uploaded it onto my server yet.
Here is my song.as file:
and my XML file (songs.xml):
Please help me guys. I'm just trying to make a good website. This feature is like, 100% neccesary.
Thanks.[/img]
View Replies !
View Related
Getting Undefined Error With Mp3 Player
Hello,
I did the Flash mp3 tutorials on this site and it works perfectly on my computer. However, when I upload the files to my server it stops working and gives me a "undefined-undefined" error where the artists name should be and doesn't play the mp3. The directories are exactly the same and I've tripled checked everything. Is there some code that I'm suppose to add or am I missing something? Any help is appreciated.
Here is a link to the site (it's still under construction)
http://www.3sonsproductions.com/v2/index.html
Code:
// Load the songs XML
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
var nodes:Array = this.firstChild.childNodes;
for (var i=0; i<nodes.length;i++)
{
sa.push(new Song(nodes[i].attributes.url, nodes[i].attributes.artist, nodes[i].attributes.track));
}
playSong();
}
xml.load("songs.xml");
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<songs>
<songs url="mp3/Intro.mp3" artist="Dim Sweets" track="Intro"/>
<songs url="mp3/Muggin_Me.mp3" artist="Dim Sweets & Dead Arm" track="Muggin Me"/>
<songs url="mp3/Paramount.mp3" artist="Dead Arm, KB, & Cleo" track="Paramount"/>
<songs url="mp3/Jet_Black.mp3" artist="Dead Arm" track="Jet Black"/>
</songs>
View Replies !
View Related
Error #1010: Something Is Undefined, But I Won't Tell You Which.
TypeError: Error #1010: A term is undefined and has no properties.
at EKG1_fla::MainTimeline/EKG1_fla::frame2()
OK, I've narrowed possibilities by sliding code keyframes, and now only have a couple hundred lines of code to guess at by comment out trial and error.
Anyone know a way for Flash to be more specific.
(like the app programmers couldn't foresee any value is passing the offending term)
View Replies !
View Related
Load Ext. Scrolltext. Error: 'undefined'
Hi, when i load a .txt file into a scrollwindow it works locally. but when i test it on a webhost it doesnt. the error is 'undefined'. could it have something to do with the new flash mx 2004? .before that i didnt have the prob. anyone?
o yeah this is the site http://www.buksna.tk
the center piece
View Replies !
View Related
UNDEFINED Error In External Loading
I am trying to load variables from an external file. I have tried .txt and .php and have gone through every tutorial about it I can.
In my movie I have a dynamic chat box instance called excomment1. I have an external php file with just text in it....http://themcclellanfamily.net/read.php (also tried making it read.txt)
contents are as follows
&excomments1=Test
(I have also tried &excomments=Test and excomments=Test)
Now I want the file to load in the text file. I am using this code...
myData = new LoadVars();
myData.onLoad = function(){
placeTheDataIntoTheRightPlace();
};
myData.load("http://themcclellanfamily.net/read.php");
placeTheDataIntoTheRightPlace = function(){
excomments1.text = myData.excomments1;
};
(when I changed the &excomments1 to &excomments I also changed the myData.excomments1; to match...also tried myData.load("read.php"); and myData.load("/read.php")
Every single time I either get nothing or undefined. I worked on this for 4 hours and can't get it to work. Check out http://www.themcclellanfamily.net/ca...&comments=test for the test. It is SUPPOSED to display near the end when the box shows up.
Any ideas? Thank you so much!
View Replies !
View Related
Access Of An Undefined Property Error
I keep getting 66 errors of "1120: Access of undefined property" for like different properties/variables i am using in a class.
I am not sure why i am getting them. I am importing my class correctly cause if i comment out everything and just put a trace statement in the constructor it traces out fine.
I have attached the flash file and the classes in a zip file.
can someone explain my problem and help me fix it? I have searched all over and can't figure out why im getting this error.
View Replies !
View Related
Undefined Property (error:1120)
I'm trying to move to 3.0 oop. It's not going so hot. I'm trying to create a simple button and I'm at the up/down state stage. My strategy is very simple, but I can't even make the listener work. I've tried several different approaches. I don't understand why this won't work, but I expect it will be pretty obvious to some of you. Your help will be greatly appreciated.
Here is the code with comments. I'll also attach the .as and .fla.
Code:
package{
import flash.display.Sprite;
import flash.events.MouseEvent;
public class upButton extends Sprite{
//upTarget is the container holding the button images. upTarget "listens"
public function upButton():void{
var upTarget:Sprite = new Sprite();
upTarget.graphics.lineStyle(2,0x95ADE5);
upTarget.graphics.beginFill(0xb9dafb);
upTarget.graphics.drawRoundRect(0.6,0.5,14,15,2,2);
upTarget.addEventListener(MouseEvent.MOUSE_DOWN,uPressed);
upTarget.buttonMode = true;
upTarget.useHandCursor = true;
addChild(upTarget);
//upFillDown hides behind the upFillup image.
var upFillDown:Sprite = new Sprite();
upFillDown.graphics.lineStyle(2,0x95ADE5);
upFillDown.graphics.beginFill(0xb9dafb);
upFillDown.graphics.drawRoundRect(0.6,0.5,14,15,2,2);
upTarget.addChild(upFillDown);
//At a higher level, upFillUp should show before a mouseDown
var upFillUp:Sprite = new Sprite();
upFillUp.graphics.lineStyle(2,0x95ADE5);
upFillUp.graphics.beginFill(0x95ADE5);
upFillUp.graphics.drawRoundRect(0.6,0.5,14,15,2,2);
upFillUp.alpha = 100;
upTarget.addChild(upFillUp);
//this guy identifies the button action (up or down)
var upSymbol:Sprite = new Sprite();
upSymbol.graphics.lineStyle(3, 0x4D6185);
upSymbol.graphics.moveTo(1.1,4.2);
upSymbol.graphics.lineTo(4.3,1.1);
upSymbol.graphics.lineTo(7.5,4.2);
upSymbol.x = 4.2;
upSymbol.y = 6.5;
addChild(upSymbol);
}
//For some reason, this handler will not recognize any of the sprites above
public function uPressed(event:MouseEvent){
upTarget.upFillUp.alpha = 0;//this code should hide the upFillUp sprite to show the sprite benieth
}
}
}
View Replies !
View Related
Undefined Property Error With Buttons
Hello,
I've made a movie clip that's the exact size of the stage I'm using in Flash. I want to make it clickable, and when it clicks, I want a 'jumping' boolean variable to turn true.
Right now I have the movie clip 'btn' set up on the stage. I have two classes, a main class, and a class for the character who will jump when the background is pressed. I have an event listener in the character class and a function that should make it jump, but I am getting this error:
1120: Access of undefined property btn.
ActionScript Code:
public function Character() {
btn.addEventListener(MouseEvent.MOUSE_UP,checkJumping);
}
public function checkJumping(event:MouseEvent):void {
jumping = true;
}
There are the portions of the code I'm having problems with. The movie clip has the instance name 'btn', so that can't be the problem.
Thanks.
View Replies !
View Related
Undefined Error Preloader Help Needed
My AS 1.0 preloader code was set to work just fine using Flash 6 in AS 1.0 and now I'm using the same code with a few slight updates I've added for AS 2.0 in Flash 8 and still having problems with an "undefined" error. I'm obviously missing something with variables.., yes?
Thanks to anyone who can shed some light on this problem!
Attach Code
Frame 1
var totalmovie:Number = this.getBytesTotal();
var totalloaded:Number = this.getBytesLoaded();
if (totalloaded / totalmovie > .75) {
gotoAndPlay("loaded");
}
Frame 2
var percentloaded:Number = Math.round(totalloaded / totalmovie * 100);
var feedback:String = " " + percentloaded + "%";
gotoAndPlay("loop");
View Replies !
View Related
Undefined Text Field Error
Hiya guys,
I've just changed over from using Flash 6 to Flash 7 and am having some teething problems. I have a lot of information being read from text files and brought into flash. This all worked fine when it was published as flash 6 but now I've changed it to flash 7 all I get in my text fields is the word UNDEFINED?
Here's the code I'm using...
on (release){
_root.field1.html = true;
_root.field1.htmlText = "Please Wait Loading...";
myLoadVar = new LoadVars();
myLoadVar.load("news.txt");
myLoadVar.onLoad = function(success) {
if (success == true) {
_root.field1.htmlText = myLoadVar.myText;
}
}
}
Any bright ideas?
View Replies !
View Related
Access Of Undefined Property Error?
I'm sure this is just a rookie mistake, but I'm getting the following error:
1119: Access of possibly undefined property scaleX through a reference with static type Function.
from the following code:
public function zoomCounty():void
{
{
var countyTweenZoomX:Tween = new Tween(selectedCounty, "scaleX", Regular.easeInOut, selectedCounty.scaleX , (selectedCounty.scaleX +countyEndSize), framesForZoomIn, false);
var countyTweenZoomY:Tween = new Tween(selectedCounty, "scaleY", Regular.easeInOut, selectedCounty.scaleY , (selectedCounty.scaleY +countyEndSize), framesForZoomIn, false);
var countyTweenPositionX:Tween = new Tween(selectedCounty, "x", Regular.easeInOut, selectedCounty.x , countyEndPositionX, framesForZoomIn, false);
var countyTweenPositionY:Tween = new Tween(selectedCounty, "y", Regular.easeInOut, selectedCounty.y , countyEndPositionY, framesForZoomIn, false);
}
View Replies !
View Related
Error #1010: A Term Is Undefined
I keep getting this error in this function:
ActionScript Code:
private function search(e:Event):void { if (searchtxt.text) { searchResults_ar.splice(0); var searchCriteria:String = searchtxt.text.toLowerCase(); for (var i:int = 0; i< searchStrings_ar.length; i++) { var index = searchStrings_ar[i].toLowerCase().indexOf(searchCriteria); if (index > -1) { searchResults_ar.push(i + 1); } } if (searchResults_ar.length != 0) { // Clear the list component slideList.removeAll(); for (var k:int = 0; k < searchResults_ar.length; k++) { var j = searchResults_ar[k]; var slideTitle = xmlList[j].Title; var slideID = xmlList[j].@id; slideList.addItem({label:j + ". " + slideTitle, data:slideID}); } } else { trace("nothing found"); } } }
and I cannot figure it out! Everything compiles fine, the function even works the way it is suppose to, but every time I hit my search button, I get this error:
ActionScript Code:
TypeError: Error #1010: A term is undefined and has no properties. at Vforum/::search()
Do you guys see anything that might be causing this?
View Replies !
View Related
Error - Undefined Term Has No Properties
I'm trying to program a couple of sliders; this error is coming up and I can't fix it because I don't know what it means ... Can you help me get rid of this error?
This is the slider code I'm using -
//sliders
var dragging:Boolean = false;
var rectangle:Rectangle = new Rectangle (0,0,100,0);
var rotate_mc;
var zoom_mc;
rotate_mc.rotateKnob_mc.addEventListener(MouseEven t.MOUSE_DOWN, dragIt);
zoom_mc.zoomKnob_mc.addEventListener(MouseEvent.MO USE_DOWN,dragIt);
stage.addEventListener(MouseEvent.MOUSE_UP, dropIt);
function dragIt(event:MouseEvent):void{
event.target.startDrag (true);
}
function dropIt(event:MouseEvent):void{
if(dragging){
rotate_mc.rotateKnob_mc.stopDrag();
zoom_mc.zoomKnob_mc.stopDrag();
dragging = false;
}
rotate_mc.rotateKnob_mc.startDrag(false,rectangle) ;
zoom_mc.zoomKnob_mc.startDrag(false,rectangle);
dragging = true;
This is the output error I get (no compiler errors); ind302_Katie_project_v5 is the file's name -
TypeError: Error #1010: A term is undefined and has no properties.
at ind302_Katie_project_v5_fla::MainTimeline/ind302_Katie_project_v5_fla::frame1()
Thanks,
Katie.
View Replies !
View Related
Undefined Text Field Error
Hiya guys,
I've just changed over from using Flash 6 to Flash 7 and am having some teething problems. I have a lot of information being read from text files and brought into flash. This all worked fine when it was published as flash 6 but now I've changed it to flash 7 all I get in my text fields is the word UNDEFINED?
Here's the code I'm using...
on (release){
_root.field1.html = true;
_root.field1.htmlText = "Please Wait Loading...";
myLoadVar = new LoadVars();
myLoadVar.load("news.txt");
myLoadVar.onLoad = function(success) {
if (success == true) {
_root.field1.htmlText = myLoadVar.myText;
}
}
}
Any bright ideas?
View Replies !
View Related
Slideshow With FUse / Error 'undefined'
Hi,
Am just starting to get into both Flash and Fuse and wanted to create a small slideshow... But when I run it in the output window I get 'undefinied' if anyone has any ideas would be much appreciated!
Code:
import com.mosesSupposes.fuse.*;
ZigoEngine.register(Fuse, PennerEasing);
for (i=1;i<11;i++) {
var tmpClip:MovieClip = eval ("Pic" + i)
tmpClip.loadMovie("images/"+i+".jpg")
}
// Start the slideshow on a setInterval
var slideShowTimer:Number = setInterval(nextImage, 5000);
var counter:Number = 0;
// The workhorse function, gets called by setInterval, and should run every 5 seconds.
function nextImage():Void {
var img:MovieClip = images[counter % 3];
img.swapDepths(counter);
trace(img.getDepth());
img._alpha = 0;
img._visible = true;
img.alphaTo(100, 2, "easeOutSine", null, {func:cleanUpPrevious, args:[(counter-1) % 3]});
counter++;
}
// A function to be used in the tween callback to make the image that was just covered up invisible.
function cleanUpPrevious(image:Number):Void {
images[image]._visible = false;
}
// Show first image immediately.
nextImage();
View Replies !
View Related
Loading Random Image Error: Undefined?
I have a script on the first frame of my movie that is supposed to load a random image and also load the same correlating random text file with information for that image. The code grabs a variable from another text file that says the max number of images for the image folder so that I don't have to update the flash eveytime I add a new image/photo to the "backgrounds" folder.
Every now and again I get an error when the code tries to load an image/photo that is undefined (//pathtofolder/backgrounds/undefined.jpg). Why would it sometimes try and load an image titled "undefined.jpg"? Here is my code:
// create a clip to hold the image
this.createEmptyMovieClip("imageHolder", 2);
// selecting random images
myArray = new Array();
// loads text document containing number of images
loadVarsText = new LoadVars();
loadVarsText.load("info/number.txt");
//assign a function which fires when the data is loaded:
loadVarsText.onLoad = function(success) {
if (success) {
trace("done loading");
// only after the data finishes loading, you-ll be able to use it
for (i = 1; i <= this.var1; i++) {
myArray.push('photo' + i);
}
randNumber = Math.round(Math.random() * myArray.length);
// load the image.
imageHolder.loadMovie("backgrounds/" + myArray[randNumber] + ".jpg");
} else {
trace("not loaded");
}
};
_______________________
I have two folders "backgrounds" and "info". The folder "backgrounds" has two photos in it (photo1.jpg and photo2.jpg). The info folder has the file "number.txt" in it with this text in the file:
&var1=2&
- Why am I receiving an undefined error? Please help... I am so close!
Thanks,
-- K
View Replies !
View Related
Java Popup Error: File Undefined
When Im trying to call a popup window in flash mx pro, a error appears saying "cannot find file:c//"my computer"/undefined. instead of test.html
But everything (movie.swf, movie.html, and test.html) are togheter in the same folder
this is the code in the button:
on (release) {getURL(javascriptopenNewWindow("test.html",'gtani me', 'height=200,width=250,toolbar=no,scrollbars=no')
);
}
And this is the code I placed between the head tag inside the movie.html:
<script language="JavaScript">
function openNewWindow(URLtoOpen, windowName, windowFeatures) { newWindow=window.open(URLtoOpen, windowName, windowFeatures); }
</script>
View Replies !
View Related
[CS3] Access Of Undefined Property WareBtn Error?
Hi there,
New to Flash and trying to figure out why I'm getting this error.
I have a movie clip called buttons on the stage and inside that I have two buttons that animate over time in and out. I'm guessing this error is because I have the actions in my main timeline and not in the buttons movie clip?! However when I put the actions in the movie clip I get this error:
Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at 2_test3_fla::buttons_4/2_test3_fla::frame2()
Here's my actionscript:
Code:
wareBtn.addEventListener(MouseEvent.CLICK, getMyUrlWare);
function getMyUrlWare(event: MouseEvent):void
{
var request:URLRequest = new URLRequest("http://www.blah.com/warehousing.html");
navigateToURL(request, "_self");
}
airBtn.addEventListener(MouseEvent.CLICK, getMyUrlAir);
function getMyUrlAir(event: MouseEvent):void
{
var request:URLRequest = new URLRequest("http://www.blah.com/air.html");
navigateToURL(request, "_self");
}
Oh and I have made sure all the buttons keyframes have the correct name e.g "wareBtn"
Any help would be much appreciated...
Thanks.
J
View Replies !
View Related
Error 1120: Access Of Undefined Property
Hi-
I'm new to Flash and am trying to do a simple assignment. I need a button to control a movie clip. My button is called "btn" and movie clip is called "corn." This is my script so far....
btn.addEventListener(MouseEvent.ROLL_OVER, onOver);
function onOver(evt:MouseEvent):void {
corn.scaleX = 2;
}
and this is my error message: 1120: Access of undefined property corn.
View Replies !
View Related
ERROR 1120: Access Of Undefined Property
As you can probably tell i am very new to actionscript! i have done a very basic bit of code and am trying to get a small navigation bar to work! JUST 1 BUTTON !
there are no errors when i type it in the actions pannel, however when it comes to publishing it, the error 1120 comes up!
1120: Access of undefined property master_mc.
View Replies !
View Related
1120: Access Of Undefined Property Error
okay, this is probably a very silly question but i cant work out what im doing wrong.
my lecturer made a website and i was using the menu action script for mine obviously changing the names for the buttons to corrospond to my site. yet im getting the error '1120: Access of undefined property error'. my code is:
package {
import flash.events.*;
import flash.display.*;
public class Mainmenu extends MovieClip {
public function Mainmenu() {
// Event Setup.
Gallery_home_btn.addEventListener(MouseEvent.CLICK ,navigationClicked);
Biography_home_btn.addEventListener(MouseEvent.CLI CK,navigationClicked);
Credits_home_btn.addEventListener(MouseEvent.CLICK ,navigationClicked);
Contacts_home_btn.addEventListener(MouseEvent.CLIC K,navigationClicked);
}
// Event Handlers.
private function navigationClicked(Event:MouseEvent):void {
var frmLabel:String='';
switch (Event.target) {
case Gallery_home_btn:
frmLabel="Gallery_frm";
break;
case Biography_home_btn:
frmLabel="Biography_frm";
break;
case Credits_home_btn:
frmLabel="Credits_frm";
break;
case Contacts_home_btn:
frmLabel="Contact_frm";
break;
}
//portfolio(root).gotoFrame(frmLabel);
MovieClip(root).gotoFrame(frmLabel);
}
}
}
can you please explain to me why i am getting that error.
thanks in advance
View Replies !
View Related
Error #1010: A Term Is Undefined And Has No Properties.
Hello There.
Please look the code that follows:
ActionScript Code:
function geraExpo():Array {
for (var i:uint = 1; i<total+1; i++) {
req.url = "images/expo/"+i+".jpg";
addChild(superSprite);
var expo:Expo = new Expo();
var loader:Loader = new Loader();
expo.name = "expo"+i;
loader.name = "loader"+i;
loader.load(req);
expo.x = 39;
expo.img_mc.alpha = 0;
expo.barra_mc.alpha = 0;
addChild(expo);
expo.img_mc.addChild(loader);
expo_array[i] = getChildByName("expo"+i);
superSprite.addChild(expo_array[i]);
if (i==1) {
expo.y = 207;
} else {
expo.y = posY+121;
}
posY = expo_array[i].y;
expo_array[i].addEventListener(Event.ENTER_FRAME, checaPosition);
}
return expo_array;
}
geraExpo();
Everything is working fine. But I have to get the entire array to compare the event target at its y position to make some actions. The code follows:
ActionScript Code:
function checaPosition(evt:Event):void {
//trace("nome = "+evt.target.name+" y = "+evt.target.y);
if(evt.target.y!=207) {
Tweener.addTween(evt.target.img_mc, {alpha:0, time:.5, transition:"easeoutexpo"});
Tweener.addTween(evt.target.barra_mc, {alpha:0, time:.5, transition:"easeoutexpo"});
} else {
var stageW:int = stage.stageWidth;
Tweener.addTween(evt.target.img_mc, {alpha:1, time:.5, transition:"easeoutexpo"});
Tweener.addTween(evt.target.barra_mc, {alpha:1, time:.5, transition:"easeoutexpo"});
evt.target.barra_mc.width = stageW;
}
}
When I click a button, previous and next, the sprite object named superSprite flows up or down. But here is the problem. I can't compare the array elements y position because they are inside the Sprite object ans its coordinates don't change. So i'm trying to return the array but i can't get the array. Someone have any idea to solve this?
Thanks in advance.
View Replies !
View Related
Error 1120 Access Of Undefined Property....
I recently completed an Adobe video tutorial that showed me how to create a simple application using components: simple application
I'm trying to learn about document classes and how to use external .as files to control the movie, and so I figured this might be a good example to try using. However, I keep getting Compiler error 1120 on lines 11–4 (Access of undefined property dp); 16 (Access of undefined property myList and dp); 18 (Access of undefined property myList and announceSelect); 19 (Access of undefined property myButton and eatItem); and 22, 25, 26 (Access of undefined property myList). I looked at other 1120 problems on the forum and it seems like most of them are labeling-related, and from what I can tell, my labels are okay. Any help would be much appreciated!
The flash file consists of a list with the name myList and a button with the name myButton. The code from the .as file is as follows:
Attach Code
package {
import flash.display.MovieClip;
import fl.events.*;
import flash.events.*;
import fl.data.DataProvider;
public class Eating extends MovieClip {
var dp:DataProvider = new DataProvider();
dp.addItem( { label: "tomato" } );
dp.addItem( { label: "carrot" } );
dp.addItem( { label: "blueberry" } );
dp.addItem( { label: "turnip" } );
myList.dataProvider = dp;
myList.addEventListener(Event.CHANGE, announceSelect);
myButton.addEventListener(MouseEvent.CLICK, eatItem);
public function announceSelect(e:Event):void {
trace("You have selected item: " + myList.selectedItem.label + ".");
}
public function eatItem(e:MouseEvent):void {
trace("You have eaten item: " + myList.selectedItem.label + ".");
dp.removeItem(myList.selectedItem);
}
}
}
View Replies !
View Related
GetDefinitionByName Throws Undefined Variable Error
Flash CS3 project. Can anyone explain this:
var ViewClass:Class = views.Login;
view = new ViewClass();
// ^works fine
var ViewClass:Class = getDefinitionByName("views.ViewLogin") as Class;
// ^throws error:
ReferenceError: Error #1065: Variable Login is not defined.
at global/flash.utils::getDefinitionByName()
...
My Login class is in a subdir named "views" and is defined like this:
package views{
public class Login extends View{}
}
I also added "views/" to the classpath, though I think that's not necessary.
So what am I missing that getDefinitionByName can't recognize my class in a package?
View Replies !
View Related
Error Opening URL File:// Undefined? Can't See What I Missed.
I am using a dynamic nav menu edited using xml, when the corresponding button is pressed I want it to display some text in the text box and load a .swf into the loader m.c. It sort of works, however which ever button i click on it displays the content text and .swf for the last button listed in the xml file, when I try to set a var equal to the instance name of the button clicked on it shows the text as undefined and does not load the m.c? If i leave out the var 'currentIndex' I get a message in the output Error opening URL file undefined. I've checked everything and there are no typos. Really need some help here.
Thanks
code;
var yPosition:Number = 0;
var myXML:XML = new XML();
myXML.ignoreWhite = true;
var links:Array = new Array();
var names:Array = new Array();
theText._alpha = 0;
empty._visible = false;
myXML.onLoad = function(){
var linkname:Array = this.firstChild.childNodes;
for(i=0;i<linkname.length;i++){
names.push(linkname[i].attributes.NAME);
contents = linkname[i].attributes.CONTENT;
movies = linkname[i].attributes.MOVIE;
_root.attachMovie("button","btn"+i,_root.getNextHi ghestDepth());
_root["btn"+i]._y = yPosition;
yPosition = yPosition + 25
_root["btn"+(i)].blackTxt.Txt.text = (names[i]);
_root["btn"+(i)].whiteTxt.Txt.text = (names[i]);
_root["btn"+(i)].onRollOver = btnOver;
_root["btn"+(i)].onRollOut = btnOut;
_root["btn"+(i)].onRelease = btnRelease;
}
}
myXML.load("projects.xml");
function btnOver(){
this.gotoAndPlay(2);
}
function btnOut(){
this.gotoAndPlay(11);
}
function btnRelease(){
var currentBtn:String = this._name;
var currentIndex:String = currentBtn.substring(3,5);
theText._alpha = 100;
theText.text = contents;
empty._visible = true;
empty.loadMovie(movies[currentIndex]);
}
View Replies !
View Related
TypeError: Error: #1010: A Term Is Undefined.. [AS3]
Hello,
So, with a recent switch to AS3, learning a bit better about events and other stuff, I decided to port my A* Pathfinder from AS2 to AS3, and at the end of things I get the following error during runtime: "TypeError: Error #1010: A term is undefined and has no properties", I've been looking through the class a couple of times, and I'm probably blind, so I'm asking for your help Improvement suggestions are welcome aswell
ActionScript Code:
package { import flash.events.Event; import flash.events.EventDispatcher; import flash.geom.Point; public class Pathfinder extends EventDispatcher { private const _dirs:Array = [ {x:0, y:-1},{x:1, y:-1},{x:1, y:0},{x:1, y:1}, {x:0, y:1},{x:-1, y:1},{x:-1, y:0},{x:-1, y:-1} ]; private var cost_diag:int = 14; private var cost_orth:int = 10; private var grid:Array = []; private var openList:Array = []; private var closedList:Array = []; private var finalPath:Array = []; private var start:pathBlock; private var goal:pathBlock; public var available:Boolean = true; public function Pathfinder():void {}; public function findPath(g:Array, s:Point, goal:Point):void { this.start = new pathBlock(s.x, s.y); this.goal = new pathBlock(goal.x, goal.y); for(var i:uint = 0;i<g.length;i++){ grid[i] = []; for(var j:uint = 0;j<g[i].length;j++){ grid[i][j] = new pathBlock(j, i, 0, 0, null, g[i][j].w); } } openList.push(this.start); addEventListener("nextPath", eventHandler); checkAdjacentBlocks(openList_next()); } public function getPath():Array { return finalPath; } private function eventHandler(evt:Event):void { if(evt.type == "nextPath"){ var block:pathBlock = openList_next(); if(block != goal){ checkAdjacentBlocks(block); } else { optimizePath(); } } } private function optimizePath():void { var c:pathBlock = goal; while(c != start){ finalPath.push(new Point(c.x, c.y)); c = grid[c.y][c.x].p; } dispatchEvent(new Event("pathCompleted")); } private function checkAdjacentBlocks(block:pathBlock):void { for(var i:uint = 0;i<_dirs.length;i++){ var x:uint = block.x + _dirs[i].x; var y:uint = block.y + _dirs[i].y; var g:uint = (_dirs[i].x == 0 || _dirs[i].y == 0)? block.g + cost_orth : block.g + cost_diag; if(grid[y][x] != undefined){ if(grid[y][x].w){ if(closedList_exists(grid[y][x])){ if(!openList_updateCondition(grid[y][x])){ grid[y][x].update(x, y, g, manhatCost(grid[y][x], goal), block); openList.push(grid[y][x]); } } } } } openToClosed(block); dispatchEvent(new Event("nextPath")); } private function openToClosed(block:pathBlock):void { for(var i:uint = 0;i<openList.length;i++){ if(openList[i] == block){ if(i > 0){ var tmp:pathBlock = openList[i]; openList[i] = openList[0]; openList[0] = tmp; } closedList.push(openList.shift()); break; } } } private function closedList_exists(block:pathBlock):Boolean { for(var i:uint = 0;i<closedList.length;i++){ if(closedList[i] == block){ return true; break; } } return false; } private function openList_next():pathBlock { var n:pathBlock = openList[0]; for(var i:uint = 1;i<openList.length;i++){ n = (n.f < openList[i].f)? n : openList[i]; } return n; } private function openList_updateCondition(block:pathBlock):Boolean { for(var i:uint = 0;i<openList.length;i++){ if(openList[i] == block){ if(openList[i].g < block.g){ openList[i].p = block.p; } return true; break; } } return false; } private function manhatCost(start:pathBlock, goal:pathBlock):int { return cost_orth * ( Math.abs(start.x - goal.x) + Math.abs(start.y - goal.y) ); }; };};class pathBlock { public var x:uint; public var y:uint; public var g:int; public var h:int; public var f:int; public var p:pathBlock; public var w:Boolean; public var v:uint; public function pathBlock(x:uint, y:uint, g:int = 0, h:int = 0, p:pathBlock = null, w:Boolean = true, v:uint = 0):void { update(x, y, g, h, p); this.w = w; this.v = v; }; public function update(x:uint, y:uint, g:int, h:int, p:pathBlock):void { this.x = x; this.y = y; this.g = g; this.h = h; this.f = g + h; this.p = p; };};
P.S: I don't know if this would actually be anything close to real A* either, this is my interpretation of it
View Replies !
View Related
|