LoadVars Gives An Undefined
Hi there, because I am no 'AS-wizard' my wisdom came to an end...
I tried to load text from an external txt file into the textfield with the LoadVars ... but I only get an 'undefined'.... I have no clue whats wrong...anyone can help??
thats the AS: import caurina.transitions.Tweener;
//set the alpha to 0
scroller_mc._alpha = 0;
//fade the textfield in Tweener.addTween(scroller_mc, {_alpha:100, time:3, delay:2.5});
//--------------LoadVarsAS goes here-------to load the contentTXT----------- var myLV:LoadVars = new LoadVars();
myLV.onLoad = function (success:Boolean) { if (success) { scroller_mc.txt_mc.text_txt.htmlText = myLV.links; trace("jaja"); } else { scroller_mc.txt_mc.text_txt.text = "Sorry!There has been an error in loading the text." } }
//---------load the text myLV.load("links.txt");
the external text starts with "links=........" and I use sharedFonts
Hope someone can help
Thanks a lot
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 04-18-2007, 11:35 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Loadvars Undefined
No matter what I do,
myData = new LoadVars();
myData.onLoad = function() {
Success = true
};
myData.load("params.txt");
when I test this movie in the flash player all run ok,
but embedded in a html page, tested in a server all the parameters are undefined. can anyone help me please????
LoadVars + Php = Undefined
This should be a rather simple thing to do. Server is running, files are in my htdocs folder.
but it just reports undefined. Any thoughts?
Code:
var cat = new LoadVars
function printOut(success){
frankencat.text = cat.id;
}
cat.load("test.php");
cat.onLoad = printOut();
PHP Code:
<?php print "id=lalalalalalalalalalallalalalalalalalalalalalalalalalalala";?>
LoadVars + PHP = Undefined.. Over And Over Again
First off, I'm no idiot. Wanted to make that statement before acting like one...
PHP Code:
PHP Code:
<?php
echo "score1=1";
?>
Actionscript:
Code:
var score:LoadVars = new LoadVars();
score.load("score.php");
score.onLoad = function() {
trace(this.score1); // displays 'undefined'
};
I tried 11 actionscript examples from the actionscript Bible, PHP for Flash and from numerous websites. I copy/paste code and yet.... nothing works.
I'm using Flash MX 2004.
How is this possible?
LoadVars.loaded Always Undefined
Hi there,
I have:
Code:
lv = new LoadVars();
lv.pageIndex = pageIndex;
lv.sendAndLoad("List_NewsStories.aspx", result_lv, "GET");
trace("loaded: " + lv.loaded);
And it always outputs 'undefined' even in the onLoad handler.
Any ideas?
[F8] LoadVars == Undefined ? [RESOLVED]
Hi,
I've got a LoadVars object that has issues with one of its parameters. This is for a dynamic image gallery that's mostly complete. All of my code works fine, except for when I put the php script I'm calling on my web server. Then one (and only one) of my variables comes back as undefined.
Here's the code:
Code:
var picVars:LoadVars = new LoadVars();
var gall:String = "gallery1";
picVars.onLoad = function(success){
if (success){
parseFiles(picVars.returnFiles,picVars.widths,picVars.heights);
trace(returnFiles); // returns "undefined"
trace(widths); // returns a string of numbers
trace(heights); // returns a string of numbers
}
else{
error = "ERROR WITH LOADVARS";
}
};
picVars.load("../getImages.php?gall=" + gall);
So as you can see, all but one of my LoadVars variables returns the correct data. picVars.returnFiles traces as undefined. And as I said, it works fine when I run it locally.
Also, if I navigate directly to my script, PHP prints the correct data, so it's not a server-side issue. The proper string it returns is:
returnFiles=8.jpg|9.jpg|1.jpg|2.jpg|3.jpg|5.jpg|6. jpg|7.jpg|4.jpg|&widths=47|47|39|39|40|24|48|40|53 |&heights=36|36|36|36|36|36|36|36|36|
Just a big string of image names and dimensions.
This is especially puzzling since "success" is obviously coming back as true. Anyone have any ideas?
LoadVars Returns Undefined
en.txt:
introHead=Headline here.&introBody=Body copy here.
The Flash 8 Stage:
- Text Field instance named "head_txt"
- Text Field instance named "body_txt"
- Both set to Dynamic
The ActionScript:
Code:
// default language //
loadText("en");
// load all site text from file //
function loadText(language:String) {
siteText = new LoadVars();
siteText.load(language + ".txt")
}
// populate headline and body copy text fields for this page //
function populatePage(pageName:String) {
siteText.onLoad = function() {
head_txt.text = siteText.pageName + "Head";
body_txt.text = siteText.pageName + "Body";
}
}
populatePage("intro");
stop();
Since I'm using "pageName" twice, it seems obvious to declare it as a variable and have the function dynamically retreive it. But it's not working. The text being displayed in those two boxes returns as "undefinedHead" and "undefinedBody" instead of the real content from the text file. This does work, however:
Code:
head_txt.text = siteText.introHead;
body_txt.text = siteText.introBody;
i.e., if I "hard code" it, it works fine. But as a variable, it doesn't.
Other random piece of info: if I declare the LoadVars with strict data typing it doesn't load the text file at all:
Code:
var siteText:LoadVars = new LoadVars();
I'm guessing it's scope-related, but I've run out of ideas. Any thoughts?
LoadVars/Targeting Problem . ..undefined
I am building a site in which there is a container file that loads multiple swfs. Those loaded swfs, then load other swfs into them. Once that third level of swfs is loaded, I am loading txt files into the interface. swf(_root) > swf(2) > swf(3) > txtfile.
The LoadVars script that I am using loads perfectly when I test that specific swf individually, but once I script it to load into the various levels, I get an undefined error.
Here is the script without considering the levels:
var loadVarText = new LoadVars();
LoadVarText.load("botero.txt");
loadVarText.onLoad = function() {
scroller.html = true;
scroller.htmlText = this.var1
}
Here is the script considering the levels:
var loadVarText = new LoadVars();
LoadVarText.load("botero.txt");
loadVarText.onLoad = function() {
_root.sections.loader.scroller.html = true;
_root.sections.loader.scroller.htmlText = this.var1
}
If anyone has had this problem and has found a fix, please help!!!
thanks. tonofmun
Global Arrays In LoadVars Undefined
Heellp... I have read all the threads I could find on this topic, but now I've gotta give up.
The question is simple, but the answer isn't... or so it seems.
How can I make the arrays, defined in mycode accessible outside the loadVars object??? The arrays stays local no matter what I do. When I access data in the arrays inside the loadVars object it works okay, but ouside they are "undefined"....!
I have tried using the _global property in every thinkable way, but it does not work.... and now I am completely lost!
What I am trying to do is to build up a poll, importing data from a mysql database. The data import goes fine, and the comboboxes and dynamic text fields in Flash are filled with the data from the database, but, I need the arrays for calculating percantages and totals for when the user clicks submit,
Check out my work in progress here (it's in Danish):
http://www.andand.dk/ulydige_db/ulydige_poll.swf
Here's the code:
var var_loader = new LoadVars();
var var_saver = new LoadVars();
var_loader.onLoad = function(success){
if (success){
var headline_array:Array = this.headline.split("~");
var sp1_array:Array = this.sp1.split("~");
var sp2_array:Array = this.sp2.split("~");
var sp3_array:Array = this.sp3.split("~");
var sp4_array:Array = this.sp4.split("~");
var sp5_array:Array = this.sp5.split("~");
var sp6_array:Array = this.sp6.split("~");
var sp7_array:Array = this.sp7.split("~");
var sv1_array:Array = this.sv1.split("~");
var sv2_array:Array = this.sv2.split("~");
var sv3_array:Array = this.sv3.split("~");
var sv4_array:Array = this.sv4.split("~");
var sv5_array:Array = this.sv5.split("~");
var sv6_array:Array = this.sv6.split("~");
var sv7_array:Array = this.sv7.split("~");
spørgsmål.sp1.text = headline_array[0];
spørgsmål.sv1_1.label = sp1_array[0];
spørgsmål.sv1_2.label = sp1_array[1];
spørgsmål.sp2.text = headline_array[1];
spørgsmål.sv2.dataProvider = sp2_array;
spørgsmål.sp3.text = headline_array[2];
spørgsmål.sv3.dataProvider = sp3_array;
spørgsmål.sp4.text = headline_array[3];
spørgsmål.sv4.dataProvider = sp4_array;
spørgsmål.sp5.text = headline_array[4];
spørgsmål.sv5.dataProvider = sp5_array;
spørgsmål.sp6.text = headline_array[5];
spørgsmål.sv6.dataProvider = sp6_array;
spørgsmål.sp7.text = headline_array[6];
spørgsmål.sv7.dataProvider = sp7_array;
spørgsmål._visible = true;}
else {
_parent.tekst.text = "data could not be read...";}}
var_loader.load("ulydige_poll.php");}
Sending Data With Loadvars To Php , Undefined
Hi,
I've looked around on the net and can't get an answer to my problem..
I need to send data from my flash to php.
here's the code from my flash file
on (press) {
dataSender = new LoadVars();
dataSender.nom = nom.text;
dataSender.prenom = prenom.text;
dataSender.email = email.text;
dataSender.send("../update.php","_self","POST");
trace( dataSender.toString() );
}
they come up undefined in my php file.
Also, when I load my swf with the url http://www.avocadotraiteur.com/fr/swf/intranet.swf the submit buton works, but when the swf is loaded through another swf when you click on submit nothings happens any idea?
Http://www.avocadotraiteur.com click on french then intranet in the bottom menu to see the difference
thank you so much in advance..
LoadVars = Success, But My Vars Are Undefined?
Hello all!
I've been working with LoadVars a lot recently and like it very much so. However, I have encountered a new problem. As always, I have searched through a bunch of threads to no avail; if this is a repeated question, please trout slap me and I'll apologize! Anywho -
I have this array that already works in my Flash project:
ActionScript Code:
angles = [0, 35, 100, 72, 72, 81];
Now I want to pull those numbers in the array from a changing PHP program. To start, I'm using a test file:
PHP Code:
&p1=0&p2=35&p3=100&p4=72&p5=72&p6=81
Then I have actions like this right before I need those pulled in:
ActionScript Code:
lv = new LoadVars();lv.onLoad = function(success){if(success){p1 = this.p1;p2 = this.p2;p3 = this.p3;p4 = this.p4;p5 = this.p5;p6 = this.p6;trace(p1); //returns a zero}}lv.load("myStupidTextFile.txt");trace(p1); //returns 'undefined'
How do I get those variables to register outside of the loadVars? There has to be a way, right??!!
LoadVars = Success, But My Vars Are Undefined?
Hello all!
I've been working with LoadVars a lot recently and like it very much so. However, I have encountered a new problem. As always, I have searched through a bunch of threads to no avail; if this is a repeated question, please trout slap me and I'll apologize! Anywho -
I have this array that already works in my Flash project:
ActionScript Code:
angles = [0, 35, 100, 72, 72, 81];
Now I want to pull those numbers in the array from a changing PHP program. To start, I'm using a test file:
PHP Code:
&p1=0&p2=35&p3=100&p4=72&p5=72&p6=81
Then I have actions like this right before I need those pulled in:
ActionScript Code:
lv = new LoadVars();lv.onLoad = function(success){if(success){p1 = this.p1;p2 = this.p2;p3 = this.p3;p4 = this.p4;p5 = this.p5;p6 = this.p6;trace(p1); //returns a zero}}lv.load("myStupidTextFile.txt");trace(p1); //returns 'undefined'
How do I get those variables to register outside of the loadVars? There has to be a way, right??!!
Simple Slideshow: LoadVars, Undefined Trace...scope Issue?
I'm making a simple slideshow (Flash MX 2004 V7.2).
I'm using LoadVars to access an outside text document to get the number of slides used in the slideshow (path: vars/slideInfo.txt, totalFrames=4).
Now I KNOW this is elementary, and I know it is something I'M doing/not doing, but I can't get my slideshow to recognize: totalFrames=4 (unless I hardcode it in!).
Using trace I get "undefined" everywhere in my code except within my .onLoad function statement which traces the number correctly: 4 (or whatever I change it to).
From hours of internet searching I think this may be a scope issue.
I've tried adding additional code to fix this (my last efforts reflected below). Still I can't get the number of slides out of this function to be used by the rest of the slideshow.
Will someone please point out what I'm doing wrong (I know I'll feel stupid but I'll still appreciate it!)?
Thanks!
Trace Output from below code:
undefined
undefined
4
4
Code:
var totalFrames:Number;
var slideInfoLV:LoadVars = new LoadVars();
var totalFrames:Number;
trace(totalFrames); //output: undefined
slideInfoLV.onLoad = function(success:Boolean) {
if (success) {
slideCounter();
trace(this.totalFrames); //output: 4
totalFrames = this.totalFrames;
trace(totalFrames); //output: 4
} else {
frameNum.text = "error";
}
};
slideInfoLV.load("vars/slideInfo.txt");
trace(totalFrames); //output: undefined
LoadVars Flashing "undefined" In Text Box
Hello, I have a situation here, that I can't figure out.
I have a main movie with:
var externalData:LoadVars = new LoadVars();
externalData.onLoad = function(success:Boolean) {
if (success) {
rcopy_txt.text = externalData.rhomecopy;
trace ("success");
}
};
externalData.load("rhomecopy.txt");
when first coming to the scene there is no "undefined" message and the text file loads fine.
However, my external swfs loading on buttons have this code on it's third frame (after the first two for preloader):
this.onEnterFrame = function(){
_root.rcopy_txt.text = _root.externalData.rcraftscopy;
}
_root.externalData.load("rcraftscopy.txt");
When these files load the text box flashes ("undefined") and then loads the text. Any ideas on how to fix that? Here's a link to the site.
surroundings-rogersgallery.com
HTML "undefined" Using LoadVars()
I'm trying to load HTML into a text field using loadVars(). The text field is in a MC which I am calling to the stage using attachMovie. When the MC is called to the stage it should then load the HTML into the window.
I think everything is correct but when I test the movie and click on the button to launch the MC the text field appears blank. If I click on it there is text there that says "undefined" in Cooper Black, which is the font I specified in the HTML. That font is also embedded in my movie library. I'm confused.
Here is the code I'm using:
Code:
myData = new LoadVars();
myData.onLoad = function() {
theslides_txt.html = true;
theslides_txt.htmlText = this.myVariable;
};
myData.load("theslidehtml.txt");
the html .txt file is a really simple page and is saved in the same directory as the flash. I've attached it if anyone wants to take a look.
Any help would be appreciated immensely.
If Undefined Dont Show Text That Says Undefined
Curious to know, I am using flash, .Net, and MySQL and have elements (text fields) posting in flash.
Question is, if the table in the data base is not holding the var char how can I set the text field in flash to not show undefined and just be blank?
I am about to search the heck out of this but if anyone can hit me with some insight it would be much appreciated.
Thanks in advance,
MT
Preloading Loadvars + Code That Uses The Loadvars
Hey everyone
I can't find out how to do this.
I have a main file with a menu. When a menu button is pressed, and external SWF with the corresponding page is loaded into a container in the main movie. I use the MovieCliploader for this
In all my external files, I have a loadVars that gets XML-output from a PHP-file. In the onLoad handler, I have a buildPage() function that takes the variables and e.g. builds a news page and so on.
My question is how I make a preloader that preloads the loadVars + all the code inside my buildPage function? I mean - on big preloader for it all?
I guess it cannot be done with my moviecliploader inside my main movie?
thanx - Rune
Help LoadVars.send Vs. LoadVars.sendAndLoad
OK, my understanding is that if example 1 works so too should example 2:
Example 1:var my_lv:LoadVars = new LoadVars();
my_lv.overall_score = _root.overall_score;
my_lv.send("score.php", _blank, "GET");
Example 2:var my_lv:LoadVars = new LoadVars();
my_lv.overall_score = _root.overall_score;
my_lv.sendAndLoad("score.php", result_lv, "GET");
My understanding is however clearly wrong as example 1 will pass the variable quite happily to my php script which will update appropriately. In example 2, nothing. Nada. Variables aren't availabe to php and (therefore unsurprisingly) my_lv.onload isn't picking up any return.
Where am I going wrong this time?!
Cheers,
Andrew
[AS1][loadVars] Scope Trouble With LoadVars
Hi everybody,
I'm new on this server !
Is there a way to attach a file to my thread ?
You would find enclosed a ".zip" file in wich there's a ".fla" file, a ".txt" file and 6 ".jpg" images.
Frame 1 of the FLA only has a "Preload" class/constructor found on another site and works well.
Frame 2 launches the graphic interface construction.
The file "externalVar.txt" has one variable "maxVin" with a value of 6.
I would like to know WHY i can't acces this variable from outside of the loadVars object's scope (i would better say from outside of its ".onLoad" methode scope).
In fact, when i trace my variable "maxVinNum" from outside of this function, flash player return "undefined". Even if i declare "maxVinNum" on the _root (_root.maxVinNum).
For information, at the start of frame 2, i have let an instruction in comment :
//var maxVinNum = 6;
When we activate this instruction, then the variable is directely declared and everything works well. This test allow us to verify that scripts are not bugged.
Here is the script of frame 2, some of you may understand quickly what's wrong :
//var maxVinNum = 6;
var vignetteVars = new LoadVars();
vignetteVars.onLoad = function(ok) {
if (ok) {
trace(this.loaded);
maxVinNum = this.maxVin;
trace("maxVinNum = " + maxVinNum);
}
};
vignetteVars.load("externalVar.txt");
//
function buildArray (arrayLength) {
FileArray = new Array();
for (var i=0; i<maxVinNum; i++){
FileArray.push ("v_"+(i+1)+".jpg");
}
trace("FileArray : " + FileArray);
};
//
function buildSlide(){
vinKern = 1;
preloadSlide = new Preloader(load_indicator);
for (var i=0;i<FileArray.length;i++){
//Construction du slide
slide.vignette.duplicateMovieClip("vignette"+i,i);
slide["vignette"+i]._x += i*(slide.vignette._width + vinKern);
// ajoute à la file du preloader
preloadSlide.insert(FileArray[i], this.slide["vignette"+i].conteneur, i,"","","okload");
}
slide.vignette._visible=0;
};
buildArray(maxVinNum);
buildSlide()
stop();
I hope my english is not too bad, and my explaination not too long and understable.
thanks a lot for your help !
LoadVars.send VS LoadVars.sendAndLoad
Last edited by gkcohen : 2004-04-23 at 09:19.
can someone tell me what the difference is with these two. here is my problem. i am trying to submit some info to php script. i have my variables in text file.
if if loadVars.load("textFile.txt");
and then say loadVars.send(url, "_blank", "post") then it will work. but i dont want to load the resulting php page outside of flash. if instead i do loadVards.sendAndLoad(url, dataReceiver, "post") then it will not work. my dataReceiver will return blank, or i will get an error that the variables were not sent.
i guess that you cant loadVar from a text file and then use it with sendAndLoad, is that right?
the reason for using the text file is the real problem. the php script requires a variable 'group_ids[]' with an integer for a value. apparently, flash cant read the variable with the '[]' in it. i have tried different ways to get it formatted, but it wont work. i tried do something like loadVars.group_ids + "[]" = 1 but i get message stating the the object to the left of the operand must be a variable.
my only fix was to use a text file to load this variable. it works, but only when using the send and having a php srcipt popup.
i am not too familiar with php to modify the scipt, and i think that variable needs to be an array.
i dont know what else to do. HELP
gkc
[AS1][loadVars] Scope Trouble With LoadVars
Hi everybody,
I'm new on this server !
Is there a way to attach a file to my thread ?
You would find enclosed a ".zip" file in wich there's a ".fla" file, a ".txt" file and 6 ".jpg" images.
Frame 1 of the FLA only has a "Preload" class/constructor found on another site and works well.
Frame 2 launches the graphic interface construction.
The file "externalVar.txt" has one variable "maxVin" with a value of 6.
I would like to know WHY i can't acces this variable from outside of the loadVars object's scope (i would better say from outside of its ".onLoad" methode scope).
In fact, when i trace my variable "maxVinNum" from outside of this function, flash player return "undefined". Even if i declare "maxVinNum" on the _root (_root.maxVinNum).
For information, at the start of frame 2, i have let an instruction in comment :
//var maxVinNum = 6;
When we activate this instruction, then the variable is directely declared and everything works well. This test allow us to verify that scripts are not bugged.
Here is the script of frame 2, some of you may understand quickly what's wrong :
//var maxVinNum = 6;
var vignetteVars = new LoadVars();
vignetteVars.onLoad = function(ok) {
if (ok) {
trace(this.loaded);
maxVinNum = this.maxVin;
trace("maxVinNum = " + maxVinNum);
}
};
vignetteVars.load("externalVar.txt");
//
function buildArray (arrayLength) {
FileArray = new Array();
for (var i=0; i<maxVinNum; i++){
FileArray.push ("v_"+(i+1)+".jpg");
}
trace("FileArray : " + FileArray);
};
//
function buildSlide(){
vinKern = 1;
preloadSlide = new Preloader(load_indicator);
for (var i=0;i<FileArray.length;i++){
//Construction du slide
slide.vignette.duplicateMovieClip("vignette"+i,i);
slide["vignette"+i]._x += i*(slide.vignette._width + vinKern);
// ajoute à la file du preloader
preloadSlide.insert(FileArray[i], this.slide["vignette"+i].conteneur, i,"","","okload");
}
slide.vignette._visible=0;
};
buildArray(maxVinNum);
buildSlide()
stop();
I hope my english is not too bad, and my explaination not too long and understandable.
thanks a lot for your help !
Undefined
buttondata = new XML();
buttondata.load("buttons.xml");
buttonlist = new Array;
function myOnLoad(){
count = buttondata.firstChild.firstChild.firstChild.nodeVa lue;
var = buttonlist[1].firstChild.nodeValue;
for (i=1; i<=count; i++){
createTextField("button"+i,i,30,30+(i*20),80,50);
_root["button"+i].text = "Button"+i;
}}
buttondata.onLoad = myOnLoad;
Flash says: var is undefined. Why?
Undefined
Im using code: var item = CBOLoadSites.getItemAt(1); to see if any items have been loaded into a combobox. When I trace with nothing loaded in the combobox it returns "undefined".
So can I do:code: if (item=="undefined"){CBOLoadSites.addItem("site1")}or should "undefined" be "null" or just "" or what?
Thanks
Why 'undefined' ?
This has me baffled! I am testing an application that lets users look up the stock symbol for a company by entering the name in a text field (co_name).
The code works just fine in the test movie mode, but when it test it on the HTML publish page, I immediately get back an "undefined" value.
I integrated the LoadBar animation clip to delay the onLoad function so that the application had enough time to make the query and get back the data. Again this works fine until I try it on the web.
The HTML page and .SWF are in the same directory and on the same domain. Also, I use nearly identical code to make stock quote queries in same application and can pull back the data with no problem.
So, why will this work in Test Movie mode, but not on the web page?
code:
on(release){
var colist = new LoadVars();
url = "http://www.mycompany.com/flash_quote.cfm?co_name=";
colist.load(url + co_name, _root);
attachMovie("loadbar","loadbar",9);
loadbar._x=5;
loadbar._y=180;
colist.onLoad = function() {
removeMovieClip(loadbar);
_root.lookupWin.company_list = colist.company_list;
}
}
NaN Or Undefined Or What?
I am creating dynamic text that is effected by input text boxes. I have this type of code going:
dynamicText = inputText1 + inputText2;
When one of the input text boxes has nothing in it, the dynamic text box shows NaN. I tried this code to prevent it:
if (inputText1 == undefined) {
inputText1 = 0;
};
Instead of undefined, I've also tried NaN. Is there a way to make the text box always have at least a 0 or higher in it?
Thanks.
Undefined
//why does this code say the sharedobject is undefined when i have clearly defined it as flashcookie15?
stop();
myLocalSO = sharedobject.getLocal("flashcookie15" );
trace(myLocalSO.data.counter); // undefined???????
if (myLocalSO.data.counter > 1) {
numVisits.text = "You have been here " + myLocalSO.data.counter + " times."
gotoAndStop(4);
}else {
Play();
myLocalSO.data.counter = 1;
}
myLocalSO.data.counter++;
Why The 'undefined' ?
Can anyone tell me why the following code produces an 'undefined' result somewhere in the trace list. I just want it to randomly list all of the numbers from 1 to 30 (inclusive of both 1 and 30):
Code:
popped = []; // create empty array
for (var i = 1; i < 31; i++) {
popped[i] = i;
}
addNumber = function()
{
var idx = random(popped.length);
r = popped.splice(idx, 1);
if (popped.length == 0)
{
clearInterval(timer);
} else
{
trace(r);
}
}
timer = setInterval(addNumber, 100);
Thanks,
Stephen.
Get Rid Of Undefined...
hey, I want to trace all the names, and I have this code:
function detectAllNames() {
var all:Number = new Number();
for (all=0; all<=100; all++) {
var totalNames = new Array();
totalNames[all] = "flash"+all;
trace(totalNames);
}
}
when executed I get:
flash0
undefined,flash1
undefined,undefined,flash2
undefined,undefined,undefined,flash3
undefined,undefined,undefined,undefined,flash4
...
while I oonly want to get
flash0
flash1
flash2
flash3
...
how do I get rid of these undefined and can anyone explain me why it is that it seems to do the loop all over?
tnx
Undefined
hey guys im going insane with this one. can anyone tell me why mc is undefined? i used almost the same script in another frame and it works?
stop();
import mx.transitions.Tween;
var easeType:Function = mx.transitions.easing.None.easeNone;
var time:Number = 1;
var currentpos = selectedMC._x;
var startpos = 197;
new Tween(selectedMC, "_x", easeType, currentpos, startpos, time, true);
// reorder items
var startingPoint = startpos;
var previousWidth = selectedMC._width;
var gap = 30;
var menuItems:Array = ["profile", "whyus", "products", "contactus", "catalogue"];
for (i=0; i<5; i++) {
if (i != selectedNumber) {
var mc:MovieClip = this._parent[menuItems[i]];
mc._x = startingPoint+previousWidth+gap;
startingPoint = mc._x;
trace(mc);
previousWidth = mc._width;
}
}
for (i=0; i<5; i++) {
var mc:MovieClip = this._parent[menuItems[i]];
mc._alpha = 100;
}
Undefined Value
Hi guys...
Maybe it's too late, that's why nothing work for me...
I dont know why the nSize in following code give me an undefinded value...
Code:
class common.Card{
private var nSize:Array = new Array();
private var tFace:Array = new Array();
function Card(){
var xmlReader:XML=new XML();
xmlReader.ignoreWhite = true;
xmlReader.load("cardproperties.xml")
xmlReader.onLoad = function(bSuccess:Boolean):Void{
var xnRoot:XMLNode = xmlReader.firstChild;
var xnItem:XMLNode;
for (var i:Number = 0; i < xnRoot.childNodes.length; i++){
xnItem = xnRoot.childNodes[i];
for (var j:Number = 0 ; j < xnItem.childNodes.length; j++){
var xnSubItem:XMLNode = xnItem.childNodes[j];
if (xnItem.nodeName == "size"){
nSize.push(xnSubItem.attributes.x);
nSize.push(xnSubItem.attributes.y);
}else
tFace.push(xnSubItem.attributes.src);
}
}
trace(nSize);
}
}
}
Xml Undefined?...never
any thoughts why the xmlLang would read undefined?
Code:
function makeButtons() {
menuBox = this.createEmptyMovieClip("menuBox", newDep++);
menuBox.swapDepths(bg);
menuBox._x = 20;
menuBox._y = 20;
nX = 0;
nY = 0;
for (i=0; i<4; i++) {
menuBs = menuBox.attachMovie("button", "button"+i, i);
menuBs._x = nX;
menuBs._y = nY;
nY += menuBs._height;
effect.roll(menuBs);
}
makeFrame();
loadLanguage("eng");
}
makeButtons();
////////////////////////////////////////
/////////////XML////////////////
////////////////////////////////////////
var xmlLang:XML = new XML();
xmlLang.ignoreWhite = true;
function loadLanguage(lang) {
trace(lang)//works well
xmlLang.onLoad = function() {
printText(this);
};
if (lang=="itl") {
xmlLang.load("xml/italiano.xml");
} if(lang=="eng") {
xmlLang.load("xml/english.xml");
}
trace(xmlLang);// traces undefined
}
a_modified_dog....i should have listened to your 2c's on this bi-ligual project!
Please Help With Undefined.
I have a flash file that is not performing the way it used to.
The web page is http://www.anytimeinc.com.
As you can see, the news section says undefined. I know it pulls it's information from a txt file on the server, which I have checked does exist and is in the proper format (the file is called news.txt and is does exist in the txt directory just as all the other txt files do that work correctly), but yet I am still getting this error.
Here is the link to the fla file: http://www.hyphenpipe.com/anytime_012.fla
Can anyone take a look and see if they can find something I am missing?
Thanks!
[F8] XML 'undefined' ?
I am calling in weather from Yahoo via XML using ...
var my_xml:XML = new XML();
my_xml.ignoreWhite = true;
my_xml.load("http://xml.weather.yahoo.com/forecastrss?p=95720");
my_xml.firstChild.childNodes[0].lastChild.childNodes[5].attributes.text;
this.onEnterFrame = function() {
weather_txt.text = "Current Weather At "+my_xml.firstChild.childNodes[0].childNodes[6].attributes.city+": "+my_xml.firstChild.childNodes[0].lastChild.childNodes[5].attributes.temp+" and "+my_xml.firstChild.childNodes[0].lastChild.childNodes[5].attributes.text;
};
It works perfectly when tested locally, but displays as "Current Weather At undefined undefined and undefined" when posted to www. Why would that be, and how do I fix it?
Thanks in advance -
sleepydad
[CS3] Undefined
hi there...
just wondering if someone could help me out with a little annoying problem!
I read in data from an xml file into flash.
if I want to leave a field in the xml file blank then it pops up in flahs as <<undefined>> - whereas I would just like nothing to appear!
is there some sort of code I can enter which will alter this behaviour?
thanks for any help you can offer :-)
John
Var Is Undefined In OEF
Hi!
Have tried a lot of stuff now, but cant figure it out. My arrCurrent is undefined when it's in my onEnterFrame function, in another function. Why is that?
Would really appreciate if someone could me out here....
Code:
class Menu extends MovieClip{
public var intMaxBoxes:Number;
public var intContentSize:Number;
public var intXPos:Number;
public var intYPos:Number;
public var arrCurrent:Array = new Array();
private var boxOpen:Boolean = false;
private var mainTimeLine;
private var menuHolder:MovieClip;
function Menu(boxes:Number, x:Number, y:Number) {
mainTimeLine = this;
intMaxBoxes = boxes;
intXPos = x;
intYPos = y;
for(var i:Number = 0; i < intMaxBoxes; i++){
menuHolder = _root.attachMovie("item_mc", "item_mc" + i, _root.getNextHighestDepth(), {_y:intYPos, _x:intXPos});
arrCurrent.push(menuHolder);
intYPos += (arrCurrent[i]._height+1);
arrCurrent[i].manager = this;
arrCurrent[i].onRelease = function(){
this.manager.dropMenu(this);
}
}
}
function dropMenu(currentMC) {
if(boxOpen == false) {
//Open
for(var i:Number = 0; i < arrCurrent.length; i++) {
if(arrCurrent[i] != currentMC && arrCurrent[i]._y >= currentMC._y){
_root.onEnterFrame = function(){
trace("Opening: " + arrCurrent[i]);
}
}
}
//***
}else{
//Close
for(var i:Number = 0; i < arrCurrent.length; i++) {
if(arrCurrent[i] != currentMC && arrCurrent[i]._y >= currentMC._y) {
trace("Closing: " + arrCurrent[i]);
}
}
//***
}
}
}
XML Is Undefined
Hello Everyone,
I created an flash file that loads XML trvia questions. The questions load from an internet source and work fine when viewing in the authoring environment. When i export the files (with the network option checked), it comes up undfined. When i publish it with a standalone player it works like it normally would.
What is blocking my XML file from being loaded into my flash file
Why Is It Undefined
i am calling an xml doc into flash...
the xml
HTML Code:
<?xml version="1.0"?>
<images>
<photo url="images/red.jpg" des="red" />
<photo url="images/green.jpg" des="green" />
<photo url="images/blue.jpg" des="blue" />
</images>
the action script
ActionScript Code:
var x:XML = new XML();
x.ignoreWhite =true;
var mc:Array= new Array();
var mcurl:Array= new Array();
x.onLoad = function(){
var images:Array =this.firstChild.childNodes;
for(i=0;i<images.length;i++) {
mc.push(photo[i].attributes.des);
//trace(photo[i].attributes.des);
mcurl.push(photo[i].attributes.url);
}
trace("the length of mc:array is "+mc.length)
trace("the name of mc:array value 1 is "+mc[0])
leftLimit = 200
rightLimit = (mc.length - 1)*50 +200;
topLimit = 205
botLimit =205
}
x.load("images.xml");
so my question, there are two traces i put in here.. 1 is the length of the array "mc" i created from xml and 2 is the value of 0 in that array... it is certainly reading the xml because it gets the length right, but all values are "undefined"
why?
please help
Why Do I Get An Undefined ?
I have a xml loading in several dynamic text fields. everything loads fine, but I test the movie with low brandwith I remarked that the text fields are all populated first with a "undefined" before getting the datas...
Here is the loading script of my xml...does somebody see the reason of my problem there ?
Tx
import mx.transitions.Tween;
import mx.transitions.easing.*;
/*********declare variables and instances*******/
var nextX = 0;
nPhoto = 0;
/****************create objects**************/
var xmlPhotos:XML = new XML();
var initThumb:Object = new Object();
xmlPhotos.onLoad = loadXML;
xmlPhotos.ignoreWhite = true;
xmlPhotos.load("aerial.xml");
/****************handle events**************/
function loadXML(loaded) {
if (loaded) {
total = xmlPhotos.firstChild.childNodes.length;
for (var i:Number = 0; i<total; i++) {
initThumb.photo = (xmlPhotos.firstChild.childNodes[i].attributes.photo);
initThumb.titre = (xmlPhotos.firstChild.childNodes[i].childNodes[0].firstChild);
initThumb.count = (xmlPhotos.firstChild.childNodes[i].childNodes[1].firstChild);
initThumb.number = (xmlPhotos.firstChild.childNodes[i].childNodes[3].firstChild);
makeAThumb(i);
nextX += 120;
}
mcScroller["mcThumb"+nPhoto].onRelease();
setInterval(_root, "scroller", 50);
} else {
content = "file not loaded!";
}
}
XML Undefined?
Hey guys
I tred to load a XML into flash but i can`t access it.
It looks like this:
HTML Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <news>
- <Eintrag>
- <ID>
- <![CDATA[ 29
]]>
</ID>
- <Name>
- <![CDATA[ South Side Boys
]]>
</Name>
- <Nachricht>
- <![CDATA[
Ab heute wieder mal 2 neue Tracks online für euch... Beide bei Smiddey im Homestudio entstanden, 2 mal keine hauseigenen Beats verwendet, aber wir hoffen ihr habt trotzdem Spaß damit. Beides waren 2 schnellgeschriebene Tracks in die wir nicht allzu viel Arbeit reingesteckt haben, im Prinzip sind sie nur aus Langeweile und aus Spaß am Rappen entstanden...
Also, "Links Liegen" und "Loyal 2 The game" saugen, anhören und feiern ;)
]]>
</Nachricht>
- <Datum>
- <![CDATA[ 2007-02-25 22:06:00
]]>
</Datum>
- <Var>
- <![CDATA[ Update, 2 Neue Tracks unter der Rubrik "Downloads" verfügbar
]]>
</Var>
</Eintrag>
</news>
If I trace the whole XML it works really good, but if I try only to trace one element it doesn`t .... undefined
ActionScript Code:
trace(theXML.news.Eintrag[0]);
for example doesn`t work-.-
Thanks Martin
Undefined
when easing a movie clip using a normal easing script
this._x+=(finalX-this._x)/friction
i try to trace out the current X coordinate...and it says undefined, does anyone know why this is?
'undefined'?
When outputting a cfc returned result to a list box, i keep getting the word 'undefined' displayed after each result in the list box.
No idea as to why its doing that as im sure im using the component correctly.
Any help would be appreciated
Thanks
Why Undefined?
Why is it that whenever these tabs are created on the stage and you click one, the value is undefined? The references to the arrays are correct as my traces have shown me, but whenever I click on one of the buttons, it seems as though it doesn't have a value even though I think I have assigned one.
ActionScript Code:
function makeTab(){
if (tabCount<magicSpeeds.length){
_root.attachMovie("tabMC", "tab"+tabCount, 9999+tabCount);
_root["tab"+tabCount].tab_txt.text = magicWords[tabCount]
_root["tab"+tabCount]._x = tabLocX
_root["tab"+tabCount]._y = tabLocY+=tabHeight;
_root["tab"+tabCount].newSpeed = magicSpeeds[tabCount]
trace(_root["tab"+tabCount].newSpeed+" is new speed");
_root["tab"+tabCount].tab_btn.onRelease = function (){
_root.speed = _root["tab"+tabCount].newSpeed;
trace(_root["tab"+tabCount]+" is the new speed");
}
tabCount++;
trace("yay");
return;
}
}
Undefined?
Sorry to bug everyone again, but I have exhausted my resources and am totally stumped. It's a button and function problem.
In the first frame I stated the function:
function mask2(event:MouseEvent):void {
MovieClip(root).mask2.gotoAndPlay(20);
}
Later down the line I made a button and placed this code in the keyframe:
image2.addEventListener(MouseEvent.CLICK, mask2);
The only problem is that every time I click the button I get this wonderfully confusing error.
TypeError: Error #1010: A term is undefined and has no properties.
at images_fla::buttons_5/mask2()
Are you ready for the real kicker? I have another button/function combo with the EXACT same code (well, mask1 and image1), and it works perfectly.
If anyone has a clue what is happening here I would greatly appreciate your insight.
Undefined On Get Url
Hi Guys,
i'm working on an Actionscript 2.0 script in my Flash 8. My script catches 3 variables from an XML file,
makes duplicated movieclip on the stage and puts inside all this a function with onrelase event.
If i try to write my array variable called idvaluemc inside the function called item.onRelease,
after the trace, flash replies me "Undefined" value. The array is loaded with all XML values but if i write it to the "getUrl" on my function item.onRelease the idvaluemc variable goes away... outside getUrl
all the variables are there!!! I'm very sad, i don't undestand where is the error in my script ...
Can anyone tell me where the problem is? Advanced thanks for your help!
This is my Actionscript:
Attach Code
for (var i:Number = 0; i<tempArray.length; i++) {
idvalue[i] = tempArray[i].childNodes[0].attributes.id;
dayvalue[i] = tempArray[i].childNodes[0].attributes.day;
titlevalue[i] = tempArray[i].childNodes[0].firstChild.firstChild;
trace(idvalue);
var item:MovieClip = item_mc.duplicateMovieClip("duplmov"+i+"_mc", i);
item._y = posInit;
posInit += 13;
item.titlmc_txt.htmlText = titlevalue[i];
item.daysmc_txt.htmlText = dayvalue[i];
item.idvaluemc = idvalue[i];
item.onRelease = function() {
getURL("javascript:myLightWindow.activateWindow({href: 'myfile.asp?day=" + this.idvaluemc + "', title: '" + titlmc_txt + "', params: 'lightwindow_width=430,lightwindow_height=240'});")
this.titlmc_txt.textColor = 0x8A8989;
oldId.titlmc_txt.textColor = 0x8dc640;
oldId = this;
trace(idvaluemc);
};
}
Why Undefined?
hey , quick question..
why does this return undefined? , the movie which im loading in works perfectly so its something in thtis code which is not right ( its tracing undefined)
ActionScript Code:
if(!xxx){ menu.loadMovie("menu1.swf"); //load in Menu 1 loadintowhat=menu; xxx=true;}loadbar1(loadintowhat);loadbar1 = function (loadintowhat) { tot=[loadintowha].getBytesTotal(); lod=[loadintowhat].getBytesLoaded(); trace(tot+" "+lod);}
thanks
// VoS
Undefined :S
whats wrong with this in answer i always get undefined
Code:
on(release){
number=Math.ceil(Math.random()*2);
if(number==1){
_root.answer =yes;
}
if(number==2){
_root.answer =no;
}
}
I Get 'undefined.' But Why?
Ok, I am working a tile based game. In my tile movieClip, I have on tile with an instance name. So when the character moves on top of the tile it will do 'something'. But I can't get it to work. Here is the script:
game.Tile39 = function () { };
game.Tile39.prototype.walkable = true;
game.Tile39.prototype.frame = 39;
if(_root.char.hitTest(_root.tile.Tile39)) {
//do this here
}
I am testing a hitTest collision between the character (char) and tile 39 (Tile39, in the instance name in the movieClip tile).
I have done a trace(_root.tile.Tile39), but it gives me an 'undefined'. Why is this?
Also, did I provide enough info so you can understand what I trying to get at?
If(var == Undefined) {}
Is it possible to do a statement such as if(string == undefined) { }?
I'm pulling the strings from XML. I'm just trying to not have to go through and put x=" " for each empty childNodes in the XML where this variable isn't necessary.
Thanks
Igby
Getting Undefined...
I have external .txt files that loads information into a defined area. It works fine through testing on my computer. Once uploaded, I'm getting an undefined in the fields where the information should appear.
The link:
http://www.shakeyhands.com/BunnyB/index.html
click on the gallery link and choose an image. The text box reads "undefined"
Here's the code i'm using to load the .txt file when a thumbnail is selected:
imageFrame.thumbSelected = function() {
showImage(this.imagePath);
loadText = new LoadVars();
loadText.load(this.txt);
loadText.onLoad = function() {
model.text = this.model;
colors.text = this.colors;
sizes.text = this.sizes;
};
};
here's the line of code I'm using to load the proper .txt file when selected:
thumbFrame.txt = "Data/gal1/1_0"+x+".txt";
|