External XML Loads But Content Variable Remains Undefined
Ok after searching through most of this forum I couldn't find an answer to my question. what i have got is an external XML file that loads the news data into flash where it is there parsed and assigned to a dynamic text box and styled with a style sheet. Through trace() if found the xml gets loaded properly but when i upload it to a webserver it does not always load. Many times the variable just reads out undefined. If i refresh it a few times it will eventually load. This is not acceptable of course. It needs to try until it loads. I thought i had the code to make this happen but Im afraid im mistaken.here is the code, its inside the first frame of a simple swf with only the dynamic text box. Code: stop();trace("1");content_txt.htmlText = "Loading...";var xmlData = new XML(this);xmlData.ignoreWhite = true;trace("commence loading of XML");xmlData.onLoad = function(sucess) {if(sucess) {for (var n = 0; n<this.firstChild.childNodes.length; n++) {trace("inside the for loop" + n);_root.date = this.firstChild.childNodes[n].childNodes[0].firstChild.nodeValue;_root.venue = this.firstChild.childNodes[n].childNodes[1].firstChild.nodeValue;_root.city = this.firstChild.childNodes[n].childNodes[2].firstChild.nodeValue;_root.info = this.firstChild.childNodes[n].childNodes[3].firstChild.nodeValue;if (n<1) {trace("im here inside the parser"); contentData = "<p><span class='head'>"+_root.date+"</span><br><span class='venue'>"+_root.venue+" -- "+_root.city+"</span><br><span class='info'><a href='showdate.php?showid="+_root.info+"' target='_blank'>Click Here For More Info</a></span></p><br>";} else { contentData += "<p><span class='head'>"+_root.date+"</span><br><span class='venue'>"+_root.venue+" -- "+_root.city+"</span><br><span class='info'><a href='showdate.php?showid="+_root.info+"' target='_blank'>Click Here For More Info</a></span></p><br>";}}} else {trace("XML no load");content_txt.text = "Error";}};xmlData.load("shows.xml");var myCSS = new TextField.StyleSheet();var cssURL = "shows.css";myCSS.load(cssURL);myCSS.onLoad = function(success) {if (success) {content_txt.styleSheet = myCSS;content_txt.htmlText = contentData;} else {content_txt.text = "Error";}};trace(contentData);trace("done"); any thoughts?
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 09-05-2005, 09:24 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Undefined Variable Loading External Text
Still climbing the mountain learning AS; no doubt there is a simple answer to this question (I have tried unsuccessfully to find it in extant threads as well as between my ears).
Trying to augment the Kirupa tutorial "ActionScript Text Animation" (http://www.kirupa.com/developer/acti..._animation.htm)
to take an external text file. When I switch out the line:
text = "There is only one..."
with:
myLoadVar = new LoadVars ();
myLoadVar.load("davetextdoc.txt")
myLoadVar.onLoad = function (success){
if (success == true) {
output.variable = "text"
output.text=myLoadVar.text;
}
}
I get the word "undefined" repeatedly loading itself. The text file is properly formatted(text=dave's text here...) I've tried untold permutations to self-solve. Help is appreciated.
Undefined Variable Loading External Text
Still climbing the mountain learning AS; no doubt there is a simple answer to this question (I have tried unsuccessfully to find it in extant threads as well as between my ears).
Trying to augment the Kirupa tutorial "ActionScript Text Animation" (http://www.kirupa.com/developer/acti..._animation.htm)
to take an external text file. When I switch out the line:
text = "There is only one..."
with:
myLoadVar = new LoadVars ();
myLoadVar.load("davetextdoc.txt")
myLoadVar.onLoad = function (success){
if (success == true) {
output.variable = "text"
output.text=myLoadVar.text;
}
}
I get the word "undefined" repeatedly loading itself. The text file is properly formatted(text=dave's text here...) I've tried untold permutations to self-solve. Help is appreciated.
Button Loads Another Button And Remains On Stage
I have three buttons on the stage and when I click a one button a another buttons comeup. But when I click another button the previous buttons disappears. How would I make all three buttons. Comeup.
Would I make movie clip on the the buttons and use loadmovie? Can someone show me a thread or a tutorial or a simaliar way to to this. Thanks.
Strange Undefined Before Xml Loads
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!";
}
}
Make Global Variable, With External .txt Content
Hello!
I have a question about setting - I guess a global - variable.
I have a textfile which content I load into Flash, like this:
ActionScript Code:
myData = new LoadVars();
myData.onLoad = function(){
theTemp = this.temperature;
};
myData.load("weather/weather.txt");
Now, how can I access the value of "this.temperature" throughout my whole movie?
I would like to be able to do stuff like;
ActionScript Code:
if (theTemp == "43"){
tellTarget("something"){
gotoAndPlay("somethingelse)";
}
}
But when I trace "theTemp" it gives undefined, which I do find pretty obvious.
I've searched Google and the forums, and found things that are similar. But unfortunately I cannot get it to work..
Thanks a bunch so far!
B.
Button Remains Highlighted After External Mc Is Loaded?
Hi, I've got a couple of questions...
I've created a menu system that loads external .swf files and was wondering if it was possible to have a menu item remain highlighted after you've clicked on it? I attached the .fla files so you can see what I mean.
The items load nicely, but I'd like the sub menu eg "Company" to remain grey after you've clicked on it, until you click on a different subsection.
Oh yeah my second problem is that the first external swf loads automatically. Is it possible to make it so the page starts blank with just the three menu items?
Again if anyone has any ideas, they'd be greatly appreciated. Thanks.
External Movie Loads, But The Dynamic Text That Loads With It Won't Render HTML?
I have a set of SWFs that load when a button is pressed on the parent SWF file...they all load into an empty placeholder, and each contains it own dynamic text field. the problem i'm having is, the text loads, but the HTML won't render, so i get plain text and html tags
the script in my external SWF files is as follow.
var lv = new LoadVars;
lv._parent = this;
lv.onLoad=function(success){
if(success)this._parent.home.text = this.guide;
}
lv.load("guide.txt");
everything is filled out correctly in the Property menu, someone PLEASE help
Undefined Xml Content In Loaded Swf?
I have one swf (content.swf) that loads some texts from a xml-file. It works ok.
But when I try to load content.swf into a holder swf (holder.swf) then the text is 'undefined' (they are located in the same folder)
Guess it is some paths that is "broken", maybe the xml load: myXML.load("load_XML.xml")
Damn code stuff when you are more of a designer than hacker...
Any suggestions?
Scrollpane.content Undefined?
How can it be that once I set:
Code:
myScrollpane.scrollContent = "content_mc";
the movieclip loads into the scrollpane... but I can't access myScrollpane.content? (it just comes up undefined).
LoadMovie --> Movie Loads, No Content?
I've got a movie that loads XML content and produces a scrollable list. It works fine when I run the published html file, but when I attempt to load the swf as a movie within a master flash page it will load the
movie but the list will never appear. What are the possible reasons that this could happen? The clip plays through, but the list is never created.
Button With An Action That Loads Content
I am as n00b as n00b can be. I know all the basic basic stuff, but hardly know anything about action scripting. Anyone know any good sites for beginning tutorials and stuff? I download some .fla's and some things just don't make sense. Anyways, on to my real question.
If I have a site and someone clicks a button on it (a flash site that is) and I want the content to load at point B, like in the bottom corner. How do I do that? I know how to make a button, I just don't know how to create an action for a button. I know that sounds kinda weird explaining it, because I'm not the best at it. Like, if you click a button and I want a page to load, how do I do that?
Array Content 'undefined' In Simulate Download
One last time and then I abandon this idea of importing XML files forever
I have attached a sample .fla file plus folders with the other files in the Variables not found only on "simulate download" post if you want to try running it.
There are 42 XML text files and 42 buttons on stage. In 'Test Movie' all 42 external XML files load perfectly every time - switch to 'Simulate Download' and keep clicking. It won't take long to "break it" and an 'undefined' will appear. But if you keep clicking, the same text will be defined on the next time around - so this isn't simply a case of the array not being created properly.
This is the frame in the preloader that creates the array that holds the XML files - it loops until they are all loaded - the counter is set and incremented in the other preloader frames:
Code:
function loadXML(loaded) {
if (loaded) {
//loops back to load all text
var xnRootNode:XMLNode = this;
myText[nCounter] = xnRootNode;
gotoAndPlay(next);
}
}
var xmlData:XML = new XML();
xmlData.ignoreWhite = true;
xmlData.load(allText[nCounter], allPics[nCounter] );
xmlData.onLoad = loadXML;
This is the line of code that gets the XML content when a button is clicked - it's in a mc ('stageContent_mc') to make it available globally, therefore '_root.' is in the line below. This is definitely where 'undefined' happens - in the code that grabs the XML content from the array, right before it's dynamically put into the text field.
Code:
textForStage = _root.myText[textNum];
'textNum' will never fail to show the number clicked when 'undefined' appears - but 'textForStage' which is the actual text in the array will show 'undefined' in the output window.
Any ideas on how to solve this (after a year) would be GREATLY appreciated.
Thanks
Charles
P.S. Any idea why the gifs are actually not loading INTO the .fla file? There is a definite lag time when using real gifs with larger file size.)
Array Content 'undefined' In Simulate Download
One last time and then I abandon this idea of importing XML files forever
I have attached a sample .fla file plus folders with the other files if you want to try running it in the Variables not found only on "simulate download" post.
There are 42 XML text files and 42 buttons on stage. In 'Test Movie' all 42 external XML files load perfectly every time - switch to 'Simulate Download' and keep clicking. It won't take long to "break it" and an 'undefined' will appear. But if you keep clicking, the same text will be defined on the next time around - so this isn't simply a case of the array not being created properly.
This is the frame in the preloader that creates the array that holds the XML files - it loops until they are all loaded - the counter is set and incremented in the other preloader frames:
Code:
function loadXML(loaded) {
if (loaded) {
//loops back to load all text
var xnRootNode:XMLNode = this;
myText[nCounter] = xnRootNode;
gotoAndPlay(next);
}
}
var xmlData:XML = new XML();
xmlData.ignoreWhite = true;
xmlData.load(allText[nCounter], allPics[nCounter] );
xmlData.onLoad = loadXML;
This is the line of code that gets the XML content when a button is clicked - it's in a mc ('stageContent_mc') to make it available globally, therefore '_root.' is in the line below. This is definitely where 'undefined' happens - in the code that grabs the XML content from the array, right before it's dynamically put into the text field.
Code:
textForStage = _root.myText[textNum];
'textNum' will never fail to show the number clicked when 'undefined' appears - but 'textForStage' which is the actual text in the array will show 'undefined' in the output window.
Any ideas on how to solve this (after a year) would be GREATLY appreciated.
Thanks
Charles
P.S. Any idea why the gifs are actually not loading INTO the .fla file? There is a definite lag time when using real gifs with larger file size.)
Load Movie Loads Content Slowly Problem
Hi,
I am currently building a site where a main swf acts as a menu to load content swf's - Flash MX 2004 using the load movie behaviour to load the movies. This all works fine when I am viewing the site offline (as you would expect).
However, when I post the site to our web space and use it, there is a considerable delay before the movies begin to load (they vary in size from 8kb to 130kb and all have very simple preloaders attached).
If anyone has any ideas why this may be happenning or possible solutions - I'd love to hear form you!
Thanks in advance!
Xml Content Loads In When Publish Previewed In Flash, But Not In Browser
This swf file (attached) will load the xml content (rss) when I Publish Preview it in Flash CS3 (AS2), but not in the browser. This is an aggravating problem and I really need help!
I think that it may be flash stopping it from accessing the content but frankly I have no clue.
Please and Thank you,
motionman95
External Content Loader With Multiple Content Types (trouble Loading Graphics)
Hey all!
I am yet another new project. Our flash designer here isn't a big AS guy, and asked me to write a reusable class so that he can load a variety of content types using minimal amount of code on his part. It's also going to be the main component piece in a larger external content player once I'm done with the class itself, so I am making the loading functions into public methods of the loader object than can be called from a button, etc.
I have the code for the text and html parts working (although I can't get stage.width and stage.height to work in the class or from the frame).
The problem I have is that I can't get the graphics content to load (the swf/pic content). Could you please check my code and tell me what I'm missing? I'm sure it's something simple, like it always is.
thanks a million!
-Fish
-----------------------------
ActionScript Code:
package
{
/**
* External Multimedia Loader Class
* @author $(DefaultUser)
* Add new MultiLoader object and insert media type (all lowercase) and object path to control initial loaded object
* To load a new object, call the MultiLoader.load* methods (loadText, loadPic, loadSwf, or loadHtml as appropriate), passing the path to the external file.
*/
import flash.display.*;
import flash.events.*;
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.text.TextField;
public class MultiLoader extends MovieClip
{
private var media:String;
private var path:String;
public var textObj:TextField = new TextField;
public var picObj:MovieClip = new MovieClip;
public var swfObj:MovieClip = new MovieClip;
public var htmlObj:TextField = new TextField;
private var objLoader:Loader = new Loader();
private var objType:String;
private var textLoader:URLLoader = new URLLoader();
public function MultiLoader(mediaType:String,objPath:String)
{
media = mediaType;
path = objPath;
if (media == "text" || media == "TEXT" || media == "Text")
{
loadText(objPath);
}
else if (media == "pic" || media == "PIC" || media == "Pic")
{
loadPic(objPath);
}
else if (media == "swf" || media == "SWF" || media == "Swf")
{
loadSwf(objPath);
}
else if (media == "html" || media == "HTML" || media == "Html")
{
loadHtml(objPath);
}
else
{
trace("ERROR: Media type not supported. Media type must be 'text', 'pic', 'swf', or 'html'.");
}
}
public function loadText(txtPath):void
{
objType = "text";
if (this.numChildren > 0)
{
this.removeAllChildren();
}
this.addChild(textObj);
this.textLoader.load(new URLRequest(txtPath));
this.textObj.wordWrap = true;
this.textObj.multiline = true;
this.textLoader.addEventListener(Event.COMPLETE, addTextContent);
//this.textObj.width = this.width;
//this.textObj.height = this.height;
}
public function loadPic(picPath):void
{
trace("loadPic started");
objType = "pic";
if (this.numChildren > 0)
{
this.removeAllChildren();
}
this.addChild(picObj);
this.objLoader.addEventListener(Event.COMPLETE, addObjLoader);
this.objLoader.load(new URLRequest(picPath));
trace("loadPic completed");
}
public function loadSwf(swfPath):void
{
trace("loadSwf started");
objType = "swf";
if (this.numChildren > 0)
{
this.removeAllChildren();
}
this.addChild(swfObj);
this.objLoader.addEventListener(Event.COMPLETE, addObjLoader);
this.objLoader.load(new URLRequest(swfPath));
trace("loadSwf completed");
}
public function loadHtml(htmlPath):void
{
objType = "html";
if (this.numChildren > 0)
{
this.removeAllChildren();
}
this.addChild(htmlObj);
this.textLoader.load(new URLRequest(htmlPath));
this.htmlObj.wordWrap = true;
this.htmlObj.multiline = true;
this.textLoader.addEventListener(Event.COMPLETE, addTextContent);
}
private function removeAllChildren():void
{
if (objType == "pic")
{
this.picObj.removeChild(objLoader);
}
else if (objType== "swf")
{
this.swfObj.removeChild(objLoader);
}
else
{
trace("objType != 'pic' or 'swf.' objType = '" + objType + "'.");
}
while ( this.numChildren > 0 )
{
this.removeChildAt(0);
}
}
private function addObjLoader(event:Event):void
{
trace("addObjLoader started");
if (objType == "pic")
{
trace("trying to load pic");
this.picObj.addChild(this.objLoader);
this.picObj.objLoader.removeEventListener(Event.COMPLETE, addObjLoader);
}
else if (objType== "swf")
{
trace("trying to load swf");
this.swfObj.addChild(this.objLoader);
this.swfObj.objLoader.removeEventListener(Event.COMPLETE, addObjLoader);
}
else
{
trace("ERROR: Cannot add object loader. The 'objType' variable does not contain correct media type. The function 'addObjLoader' should only be called when objType is 'pic' or 'swf'. In this case, objType is '" + objType + "' .");
}
trace("addObjLoader completed");
}
private function addTextContent(event:Event):void
{
if (objType == "text")
{
this.textObj.text = event.target.data as String;
this.textLoader.removeEventListener(Event.COMPLETE, addTextContent);
}
else if (objType == "html")
{
this.htmlObj.htmlText = event.target.data as String;
this.textLoader.removeEventListener(Event.COMPLETE, addTextContent);
}
else
{
trace("ERROR: Cannot add text content. The 'objType' variable does not contain correct media type. The function 'addTextContent' should only be called when objType is 'text' or 'html'. In this case, objType is '" + objType + "' .");
}
}
}
}
Variable I Undefined
hi guys, i have a little problem of variable path.
i have a for loop and i attached dinamically my list of buttons.
But if i try to take the i value inside the event handler "on releale" of the button it returns undefined.
I want to know how i can use i using relative paths.
Thanx for help.
for (var i=1; i<=bt_array.length; i++) {
var namebt = bt_array[i];
this.menuContainer.attachMovie("myMc",namebt,i);
this.menuContainer[namebt]._y = y_increment;
this.menuContainer[namebt].onRelease = function() {
projectID = i;
trace(projectID); //problem: return undefined!!!
}
}
Undefined Variable
Hi all,
Why do i get undefined when i use the following;
Code:
loadVariablesNum ("quotes.txt", 0);
newquote = random(numQuotes);
_root.myquote = eval("quote" +newquote+ "txt");
Regards,
mic
Undefined Variable HOW?
Hi i am creating a variable called startAboutY which is used to store the Y position of my movie clip aboutContent_mc. To test that there are no errors i have placed this using trace statement trace("startAboutY variable" + startAboutY); on my actions layer line 40. However, when testing it i keep getting error "variable undefined" . So when i look at where i have defined it in my code it looks perfectly fine. So i really do not understand why it says that?? The code before it ie startHomeY, is perfectly normal so i don't get why my second variable is not working. Can somebody give me some assistance please.
Thanks
Undefined Variable
I'm using a conditional to set a variable based on the answer:
Code:
if ((H1 > 5) && (H1 < 11 )) {
setProperty (_root.checkKeyN, _visible, 1);
setProperty (_root.redXKeyN, _visible, 0);
var H1Score:Number = 1;
\trace (H1Score);
}else {
setProperty (_root.redXKeyN, _visible, 1);
setProperty (_root.checkKeyN, _visible, 0);
var H1Score:Number = 0;
\trace (H1Score);
}
Tracing the code (commented out in the example) gives me the respective value.
When I go to call that variable on a button release and display the variable's content in a dynamic text field, I get undefined, but I don't know why.
Here's the code
Code:
on (release) {
_parent.cardAScoretxt.text = H1Score;
}
Can someone please tell me what I am doing wrong?
[F8] Undefined Variable
im loading .txt files externally in to my swf, and when i test the movie it works, but qhe the swf or exe are exported its says variable undefined, i already checked the directorues and evething its working
can someone help me plz
Variable's Value 'undefined'?
Hi
I am trying to assing a variable the value of a text input component. But, when I trace my var, i get 'undefined'. The value I am trying to assing is a number.
this the code i have inside a function: (The value i should be getting is 2 as that's what appears on the text input)
Code:
var variable = textInput.text;
trace(variable);
Any help will be very much appreciated.
Thanks,
E
Variable Value Undefined...
Here is this code:
ActionScript Code:
for (t=1; t<5; t++) {
if (arrows[t] == true) {
test = '_root.arrow_'+t;
test._visible = true;
}
test._visible returns as undefined
I know that arrows[t] will always be true (at least for testing purposes)
So, arrows[1] = true, arrows[2] = true, etc.
_root.arrow_1 is a MC on the stage and has visibilty set to false first thing
What am I missing?
Thanks for any help!!!
Undefined Variable
Hi. I just can figure out why this code will not work!
var WhatString:String = WhatButton;
trace(WhatString);
var Substring:String = WhatString.substring(6,7);
trace(Substring);
WhatButton is a var from elsewhere in the code. The first trace statement works, but the second is undefined?!?
If i change the first line to :
var WhatString:String = "WhatButton";
it works fine, but its important that the WhatButton is a variable.
Anyone got a clue?
bmolbach
Undefined Variable. But Why?
Hello everyone.
I have troubles with an undefined variable.
I have three movieclips (a,b,c):
b scrolling limits are "controlled" by variable "i" setted in a.
c is a movieclip that must appear only for a certain value of "i" established as follow.
a has this script:
onClipEvent (mouseDown) {
if(this.hitTest(_root._xmouse,_root._ymouse,false) ){
if (_parent.i < 50) {
_parent.scrolling.fine -= 96;
_parent.i++;
}
}
}
In the first frame of main timeline is written:
i=1; // to let limits of scrolling movie
And adding:
if (i=1) {
mc._alpha=100; }
else {mc._alpha=0;}
it doesn't work!
c is visible but, after clicking on a to scroll b, c remains still visible (while, "i", that lets scrolling, has changed to 2).
How can I resolve, please?
Thank you very much.
Undefined Variable
on level 0 : I have variable1=23;
by clicking on a button : loadmovie test.swf on level 1
once the test.swf loaded :
on level 1 another button with AS :
dir=level0:variable1
on (release) {
_level0.gotoAndStop(dir); // but this button don't work
}
the error is in the AS of this button.
by typing the AS : _level0.gotoAndStop(23); everything is ok. The AS works.
So I made a trace(typeof(dir)) and the result is : undefined
who can I get this button to work ? do I have to transform the variable dir to a number ???
is there another possibility?
thanks for your help
Variable Undefined
we have this variable from the internet, val(0), in a dynamic text field we can see a digit from this variable. but when we use this variable in actionscript and test it with trace, the variable shows as undefined.
how can we make this work without it coming up as undefined??
Undefined Variable
on level 0 : I have variable1=23;
by clicking on a button : loadmovie test.swf on level 1
once the test.swf loaded :
on level 1 another button with AS :
dir=level0:variable1
on (release) {
_level0.gotoAndStop(dir); // but this button don't work
}
the error is in the AS of this button.
by typing the AS : _level0.gotoAndStop(23); everything is ok. The AS works.
So I made a trace(typeof(dir)) and the result is : undefined
who can I get this button to work ? do I have to transform the variable dir to a number ???
is there another possibility?
thanks for your help
Variable Undefined?
on the first frame of my movie I have
counter == 0;
a few frames later I have a trace(counter); and it says my variable is undefined? Why is this? Thanks!
Undefined Variable?
almost got this working, but still need a little help!
this is an example of what i type...
http://www.mysite.com/test.swf?folder=64
this is what i get...
undefined
I have created a test swf file to make sure the variable is sending and coming back the way i want it. here is my script in php....
if($member->active == 1){
$fileURL="http://www.mysite.com/test/",$folder,"/mytest.xml";
print "playurl=$fileURL";
}
i am not sure how exactly it pulls the variable from flash, but i think it works for my mysql stuff that i have in the php file.
Here is my actionscript in flash....
lvOut = new LoadVars();
lvIn = new LoadVars();
lvIn.onLoad = function (success)
{
_root.vartext.text = lvIn.playurl;
}
lvOut.folder = _level0.folder;
lvOut.sendAndLoad("http://www.mysite.com/variables.php?folder=" + _level0.folder + "", lvIn, "POST");
I got that script from a post on this site, but just edited it so it will work with my variables. the part where it says...
lvOut.sendAndLoad("http://www.mysite.com/variables.php?folder=" + _level0.folder + "", lvIn, "POST");
i tried loading just variables.php instead of the ?folder= blah, and that did not work either
if there is anything i need to change, please tell me!!!! i need to get this freakin script working!
Thanks!
Tim
Undefined Variable
Hello,
I am trying to dynamically stop a series of movie clips using the code below. The problem I am having is that I am getting an "undefined" error when I try to trace trans[i]. Is this not the proper way to evaluate the [i] variable? Can anyone tell me how this would be done?
Thanks!
var trans = 2
for (i = 1; i<=trans; i++) {
_root.trans[i].stop();
trace(trans[i]);
}
Variable 'undefined' With If/Else
Hi, what Have I done wrong! I want 'time' to return a number from the function it fires, So that it gets placed into the alphaTo Function ....>
OK have a look
Code:
blocks = 6;
for(i=0;i<blocks;i++){
var time:Number = xSym();
function xSym(){
if (i<blocks/2){
time = i;
}
else{
time = i - blocks;
}
}
_root["block"+i].alphaTo(0,time);
}
So you see that I want to return a Number to 'time' ... How do I Return the Number???????????
Help appreciated!
Variable Undefined
we have this variable from the internet, val(0), in a dynamic text field we can see a digit from this variable. but when we use this variable in actionscript and test it with trace, the variable shows as undefined.
how can we make this work without it coming up as undefined??
Undefined Variable
on level 0 : I have variable1=23;
by clicking on a button : loadmovie test.swf on level 1
once the test.swf loaded :
on level 1 another button with AS :
dir=level0:variable1
on (release) {
_level0.gotoAndStop(dir); // but this button don't work
}
the error is in the AS of this button.
by typing the AS : _level0.gotoAndStop(23); everything is ok. The AS works.
So I made a trace(typeof(dir)) and the result is : undefined
who can I get this button to work ? do I have to transform the variable dir to a number ???
is there another possibility?
thanks for your help
Variable Undefined?
on the first frame of my movie I have
counter == 0;
a few frames later I have a trace(counter); and it says my variable is undefined? Why is this? Thanks!
Undefined Variable. Why, Please?
Hello everyone.
I have troubles with an undefined variable.
I have three movieclips (a,b,c):
b scrolling limits are "controlled" by variable "i" setted in a.
c is a movieclip that must appear only for a certain value of "i" established as follow.
a has this script:
onClipEvent (mouseDown) {
if(this.hitTest(_root._xmouse,_root._ymouse,false) ){
if (_parent.i < 50) {
_parent.scrolling.fine -= 96;
_parent.i++;
}
}
}
In the first frame of main timeline is written:
i=1; // to let limits of scrolling movie
And adding:
if (i=1) {
mc._alpha=100; }
else {mc._alpha=0;}
it doesn't work!
c is visible but, after clicking on a to scroll b, c remains still visible (while, "i", that lets scrolling, has changed to 2).
How can I resolve, please?
Thank you very much.
AS3 Undefined Variable
Can someone help me out with why this error "ReferenceError: Error #1065: Variable navigation is not defined.at main_fla::MainTimeline/frame2()" keeps occurring. The code I am using is below.
ActionScript Code:
//Loads Navigation
function Nav()
{
var navigation:nav = new nav();
navigation.x = 440;
navigation.y = 432;
addChild(navigation);
}
Nav();
navigation.user_mc.addEventListener(MouseEvent.CLICK, onRollover);
function onRollover(event:MouseEvent):void {
trace("TRACE!");
}
I have no idea why this isn't working.
Thanks,
Chris
Undefined Variable
If I run this on flash1.swf
_root.container.loadMovie("enemy.swf");
Then on the second one I have a movie clip with this
onClipEvent (load) {
_root.enemyname = "Dragon";
_root.enemydef = 5;
}
Then back on flash1.swf why can't I do trace(_root.enemydef); I get undefined.
Dynamic Text Field Is Calling The Variable Name Instead Of Variable Content
I'm having a problem getting something to work. I'm sure it has something to do with string variables and my syntax, but can't figure it out.
I have variables named cust1, cust2, cust3, etc. that are being loaded from a text file (these are customer names that will display in a text ticker).
I want a dynamic text field to display the customer names in incremental order, so I created a variable that consists of the string "cust" + a numeric variable called custNumber. At the end of each pass of the movie, custNumber is increased by 1.
var custNumber = 1;
var custName = "cust"+custNumber;
I want the dynamic text field to call the variable custName, but I can't get it to work. It keeps displaying custName as a string ("cust1", "cust2", etc.).
So I created a new variable called scrollText for the dynamic text to call, and made scrollText = custName;. But it does the same as above.
How do I get my dynamic text to call the variable that I create with another variable?
I want my dynamic text field to display the variable cust1, cust2, cust3, which would be "Jones Plumbing," "Smith Electric" etc., but all I'm getting is "cust1", "cust2", "cust3" etc.
Thanks,
Thom
Hiding/Masking Off-stage Content (external Content)
Hi,
I'm loading an image gallery into another movie. The image gallery itself uses XML to generate a row of thumbnails dynamically. In it's own player, this is fine, but when loaded into the larger movie, the row of thumbnails extends far beyond the container clip.
I've set the size of the container clip with an onLoad function, but I have no idea how to appropriately mask it so there is no spillover. Using a mask in the gallery clip doesn't work because the gallery is 100% scripted (unless I'm missing something terribly basic).
Is there a general method to use, aside from creating infinitely large opaque boundaries around the stage?
Thanks for any tips or insight!
What Happens When A JS Variable Is 'undefined' And Sent To Flash?
Need to confirm this.
I have a JS variable that initially may be undefined to Javascript. Once this variable is sent to a Flash variable, if it is undefined originally, it becomes an empty string. "".
When evaluating in flash, undefined or null both fail, but "" correctly evaluates it as empty. However, in JS, evaluating it BEFORE it is sent ot flash returns undefined.
Is this consistent and correct behavior that I can rely on to occur 100% of the time?
Undefined Class Variable
Hi,
I have a class like this one:
PHP Code:
class Tank extends MovieClip {
var MyTank:MovieClip;
var UserName:String = '';
function Tank(_tank_id:MovieClip,_UserName:String){
MyTank = _tank_id;
UserName = _UserName;
trace(UserName);
}
public function RunEngine() {
trace(UserName);
}
}
So, the first trace does work, but the secound one returns undefined.
But the Variable MyTank is working just fine.
I just dong get it. What am i doing wrong?
Hope you can help me, thank
Testing For Undefined Variable
Hi folks,
Just trying to test for an undefined variable. Here's what doesn't work:
Code:
if (_global.count == undefined) {
trace ("worked");
}
Undefined Variable Outside Of Function HELP
Hi, im pulling in an xml document. Ive pushed all the nodes in to arrays and have successfully performed calculations on some variables. Now, i have the arrays defined as _.global arrays, but when i try and trace them outside the function they are undefined. They trace fine inside the function.
Is ther anyway of accessing these variables outside the function???
this is my file, as you can see at the botttom i am trying to trace the variables but it wont work???
PHP Code:
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("stocks.xml");
_global.indicename = new Array();
_global.currentprice = new Array();
_global.valuechange = new Array();
_global.newLocation = new Array();
function loadXML(loaded) {
if (loaded) {
for (i=0; i<3; i++) {
_global.indicename.push(this.firstChild.childNodes[i].childNodes[0].firstChild.nodeValue);
_global.currentprice.push(this.firstChild.childNodes[i].childNodes[1].firstChild.nodeValue);
_global.valuechange.push(this.firstChild.childNodes[i].childNodes[2].firstChild.nodeValue);
}
for (i=0; i<_global.indicename.length; i++) {
trace("Symbol = "+_global.indicename[i]);
trace("Current Price = "+_global.currentprice[i]);
trace("Value Change = "+_global.valuechange[i]);
_global.mySubstring = _global.valuechange[i].substr(0, 1);
if (_global.mySubstring == "+") {
_global.origprice = parseFloat(_global.currentprice[i])-parseFloat(_global.valuechange[i]);
trace("Original Price = "+origprice);
//Following finds percentage change
_global.percentage = parseFloat(_global.valuechange[i])/parseFloat(_global.origprice)*100;
trace("Percentage Change = "+percentage);
_global.newLocation[i] = _global.percentage*100;
trace("Move To >"+newLocation[i]);
}
if (_global.mySubstring == "-") {
_global.origprice = parseFloat(_global.currentprice[i])-parseFloat(_global.valuechange[i]);
trace("Original Price = "+origprice);
//Following finds percentage change
_global.percentage = parseFloat(_global.valuechange[i])/parseFloat(_global.origprice)*100;
trace("Percentage Change = "+percentage);
_global.newLocation[i] = _global.percentage*100;
trace("Move To >"+newLocation[i]);
}
if (_global.mySubstring == "0") {
_global.origprice = parseFloat(_global.currentprice[i])-parseFloat(_global.valuechange[i]);
trace("Original Price = "+origprice);
//Following finds percentage change
_global.percentage = parseFloat(_global.valuechange[i])/parseFloat(_global.origprice)*100;
trace("Percentage Change = "+percentage);
_global.newLocation[i] = _global.percentage*100;
trace("Move To >"+newLocation[i]);
}
}
}
}
trace(indicename[0]);
trace(currentprice[0]);
trace(newLocation[0]);
this is my xml file,
PHP Code:
<?xml version="1.0" encoding="utf-8" ?>
- <indices>
- <indice>
<BVSP>BVSP</BVSP>
<indiceprice>60532.40</indiceprice>
<valuechange>+80.30</valuechange>
</indice>
- <indice>
<MXX>MXX</MXX>
<indiceprice>30647.39</indiceprice>
<valuechange>+557.49</valuechange>
</indice>
- <indice>
<MERV>MERV</MERV>
<indiceprice>2085.20</indiceprice>
<valuechange>-4.51</valuechange>
</indice>
</indices>
Undefined Variable Trouble
Hi guys, i am having a LOT of poblems with this.... So i really appriciate it if anyone helps out. In my key frame i have the following code
Code:
var receiver:LoadVars = new LoadVars();
receiver.onLoad = function(ok:Boolean):Void {
if (ok) {
_root.numberttl = Number(receiver.total);
_root.ttl = Number(receiver.total)+1;
for (n=0; n<_root.ttl; n++) {
_root["id_"+n] = receiver["id_"+n];
trace(_root["tn"+n]=receiver["tn"+n]);
trace(_root["sold"+n]=receiver["sold"+n]);
trace(_root["listing"+n]=receiver["listing"+n]);
trace(_root["description"+n]=receiver["description"+n]);
trace(_root["price"+n]=receiver["price"+n]);
trace(_root["address"+n]=receiver["address"+n]);
// Actions
}
} else {
_root.gotoAndStop(3);
}
if (_root.cpage == 1) {
#include "1.as"
}
};
receiver.load(_root.connect1);
stop();
For those of you wondering what include1.as contains
Code:
_root.cmc1.onRelease = function() {
getURL("http://yourcapecoral.com/homes.php?id="+_root.id_1, "_self");
};
_root.i1.m1.loadMovie("http://yourcapecoral.com/wizard/data/"+receiver.tn1);
_root.cmc1.d.text = receiver.address1;
_root.cmc1.a.text = receiver.description1;
_root.cmc1.p.text = "Price - $ "+receiver.price1;
_root.cmc1.seller.text = receiver.sold1;
if (receiver.sold1 == true.toString()) {
_root.cmc1.f.gotoAndStop(3);
} else if (receiver.sold1 == false.toString()) {
_root.cmc1.f.gotoAndStop(2);
}
////////////////////////////////////////////////////////////////////////////////////////////
_root.cmc2.onRelease = function() {
getURL("http://yourcapecoral.com/homes.php?id="+_root.id_2, "_self");
};
_root.i2.m2.loadMovie("http://yourcapecoral.com/wizard/data/"+receiver.tn2);
_root.cmc2.d.text = receiver.address2;
_root.cmc2.a.text = receiver.description2;
_root.cmc2.p.text = "Price - $ "+receiver.price2;
_root.cmc2.seller.text = receiver.sold2;
if (receiver.sold2 == true.toString()) {
_root.cmc2.f.gotoAndStop(3);
} else if (receiver.sold2 == false.toString()) {
_root.cmc2.f.gotoAndStop(2);
}
////////////////////////////////////////////////////////////////////////////////////////////
_root.cmc3.onRelease = function() {
getURL("http://yourcapecoral.com/homes.php?id="+_root.id_3, "_self");
};
_root.i3.m3.loadMovie("http://yourcapecoral.com/wizard/data/"+receiver.tn3);
_root.cmc3.d.text = receiver.address3;
_root.cmc3.a.text = receiver.description3;
_root.cmc3.p.text = "Price - $ "+receiver.price3;
_root.cmc3.seller.text = receiver.sold3;
if (receiver.sold3 == true.toString()) {
_root.cmc3.f.gotoAndStop(3);
} else if (receiver.sold3 == false.toString()) {
_root.cmc3.f.gotoAndStop(2);
}
////////////////////////////////////////////////////////////////////////////////////////////
_root.cmc4.onRelease = function() {
getURL("http://yourcapecoral.com/homes.php?id="+_root.id_4, "_self");
};
_root.i4.m4.loadMovie("http://yourcapecoral.com/wizard/data/"+receiver.tn4);
_root.cmc4.d.text = receiver.address4;
_root.cmc4.a.text = receiver.description4;
_root.cmc4.p.text = "Price - $ "+receiver.price4;
_root.cmc4.seller.text = receiver.sold4;
if (receiver.sold4 == true.toString()) {
_root.cmc4.f.gotoAndStop(3);
} else if (receiver.sold4 == false.toString()) {
_root.cmc4.f.gotoAndStop(2);
}
////////////////////////////////////////////////////////////////////////////////////////////
_root.cmc5.onRelease = function() {
getURL("http://yourcapecoral.com/homes.php?id="+_root.id_5, "_self");
};
_root.i5.m5.loadMovie("http://yourcapecoral.com/wizard/data/"+receiver.tn5);
_root.cmc5.d.text = receiver.address5;
_root.cmc5.a.text = receiver.description5;
_root.cmc5.p.text = "Price - $ "+receiver.price5;
_root.cmc5.seller.text = receiver.sold5;
if (receiver.sold5 == true.toString()) {
_root.cmc5.f.gotoAndStop(3);
} else if (receiver.sold5 == false.toString()) {
_root.cmc5.f.gotoAndStop(2);
}
////////////////////////////////////////////////////////////////////////////////////////////
_root.cmc6.onRelease = function() {
getURL("http://yourcapecoral.com/homes.php?id="+_root.id_6, "_self");
};
_root.i6.m6.loadMovie("http://yourcapecoral.com/wizard/data/"+receiver.tn6);
_root.cmc6.d.text = receiver.address6;
_root.cmc6.a.text = receiver.description6;
_root.cmc6.p.text = "Price - $ "+receiver.price6;
_root.cmc6.seller.text = receiver.sold6;
if (receiver.sold6 == true.toString()) {
_root.cmc6.f.gotoAndStop(3);
} else if (receiver.sold6 == false.toString()) {
_root.cmc6.f.gotoAndStop(2);
}
////////////////////////////////////////////////////////////////////////////////////////////
_root.cmc7.onRelease = function() {
getURL("http://yourcapecoral.com/homes.php?id="+_root.id_7, "_self");
};
_root.i7.m7.loadMovie("http://yourcapecoral.com/wizard/data/"+receiver.tn7);
_root.cmc7.d.text = receiver.address7;
_root.cmc7.a.text = receiver.description7;
_root.cmc7.p.text = "Price - $ "+receiver.price7;
_root.cmc7.seller.text = receiver.sold7;
if (receiver.sold7 == true.toString()) {
_root.cmc7.f.gotoAndStop(3);
} else if (receiver.sold7 == false.toString()) {
_root.cmc7.f.gotoAndStop(2);
}
////////////////////////////////////////////////////////////////////////////////////////////
_root.cmc8.onRelease = function() {
getURL("http://yourcapecoral.com/homes.php?id="+_root.id_8, "_self");
};
_root.i8.m8.loadMovie("http://yourcapecoral.com/wizard/data/"+receiver.tn8);
_root.cmc8.d.text = receiver.address8;
_root.cmc8.a.text = receiver.description8;
_root.cmc8.p.text = "Price - $ "+receiver.price8;
_root.cmc8.seller.text = receiver.sold8;
if (receiver.sold8 == true.toString()) {
_root.cmc8.f.gotoAndStop(3);
} else if (receiver.sold8 == false.toString()) {
_root.cmc8.f.gotoAndStop(2);
}
////////////////////////////////////////////////////////////////////////////////////////////
_root.cmc9.onRelease = function() {
getURL("http://yourcapecoral.com/homes.php?id="+_root.id_9, "_self");
};
_root.i9.m9.loadMovie("http://yourcapecoral.com/wizard/data/"+receiver.tn9);
_root.cmc9.d.text = receiver.address9;
_root.cmc9.a.text = receiver.description9;
_root.cmc9.p.text = "Price - $ "+receiver.price9;
_root.cmc9.seller.text = receiver.sold9;
if (receiver.sold9 == true.toString()) {
_root.cmc9.f.gotoAndStop(3);
} else if (receiver.sold9 == false.toString()) {
_root.cmc9.f.gotoAndStop(2);
}
////////////////////////////////////////////////////////////////////////////////////////////
_root.cmc10.onRelease = function() {
getURL("http://yourcapecoral.com/homes.php?id="+_root.id_10, "_self");
};
_root.i10.m10.loadMovie("http://yourcapecoral.com/wizard/data/"+receiver.tn10);
_root.cmc10.d.text = receiver.address10;
_root.cmc10.a.text = receiver.description10;
_root.cmc10.p.text = "Price - $ "+receiver.price10;
_root.cmc10.seller.text = receiver.sold10;
if (receiver.sold10 == true.toString()) {
_root.cmc10.f.gotoAndStop(3);
} else if (receiver.sold10 == false.toString()) {
_root.cmc10.f.gotoAndStop(2);
}
Thing is what is soposed to load loads no probelm. but see i have all 10 defined up there, and if i dont want something to load it comes up undefined.... anyone have a solution for this?
(i tryed looping it, witch worked.... but the buttons wouldnt go anyplace....
plus when someone presses the next button cpage will change to 2 and a different as file will be included, wich looks exactly the same but with different numbers....)
I really do appriciate any help, and thank you for your time.
~Gabor Szauer
Undefined Defined Variable...
Hi guys, i have
Code:
c1.cardName = "A7";
trace(c1.cardName);
on my main timeline, but it traces "Undefined"....
Does anyone know what is wrong with this, or how to fix it?
I appriciate your time
~Gabor
Radio Variable - Every Other Undefined
I'm running multiple groups of radio buttons at differnt places in my timeline - all are named the same.
Each time I click to submit and go to the next section of frames / radio buttons I run this script to send the variables to a processing page:
---
on(release){
// int form variables:
formData = new LoadVars();
formData.d = "";
formData.i = "";
formData.s = "";
formData.c = "";
// Get radio button selections:
formData.d = d.getValue();
formData.i = i.getValue();
formData.s = s.getValue();
formData.c = c.getValue();
// Get querystring input global variable:
formData.id = id;
d = formData.d;
i = formData.i;
s = formData.s;
c = formData.c;
id = formData.id;
gotoAndPlay(126);
}
---
This works fine for the first set then I get undefined for the second.. works fine for the third set then I get undefined for the fourth.. and so on and so forth.. I assume that I'm not "closing" the variables correctly but I thought by setting them all to = "" at the start of each button I'd be alright. I've been trying to pick this apart forever and would appreciate any input - thanks!
Aaron
forwardtrends.com
|