variable undefined

  • bina
  • Born
  • Born
  • bina
  • Posts: 3

Post 3+ Months Ago

hi there... im using a variable from the internet called val(0), this variable gives me a value (digit).
the problem i am having is that, in the var field of the dynamic text field i have put val(0) and it works, but not in the actionscript., also i am getting an error called undefined.


please help!!!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Posts: 5149
  • Loc: SC-USA

Post 3+ Months Ago

with this little bit of information, I would guess your refering incorrectly(relative/absolute) to the variable. Do you know what the scope of the variable is (global or local)? If it works in your text field, it obviously exists, so, you should be able to just examine the path to it's location.

btw:I'm a little confused. Your variable val(0), looks like a function call that's passing the value "0" as an argument. ?¿?¿?¿
  • bina
  • Born
  • Born
  • bina
  • Posts: 3

Post 3+ Months Ago

we have got the variable from a php file, from the internet. ... the php file only has for example :
val(0) = 23.00

is displayed, there is no other information with this.
this variable doesnt work in the actionscript. could you tell me how to make this work? or another possibility.
the problem we are having is that we cannot change the name of the variable.

i hope to hear from you soon..!!! thanks :o)
  • carlosrapa
  • Newbie
  • Newbie
  • carlosrapa
  • Posts: 11
  • Loc: Fairview Heights, IL. (St. Louis Area)

Post 3+ Months Ago

try _root.val(0).... for the scope my be absolute... if not then you must find the instance of the movie clip and point to that... but i must agree with the others that the syntax of val(0) looks more like a function call... it might be a array call too though...
  • bina
  • Born
  • Born
  • bina
  • Posts: 3

Post 3+ Months Ago

This is my code:

the LoadVarsAndArrays-function:
Layer1:
[AS]
onClipEvent(load) {loadVarsAndArrays = function() {
function usage() {
trace("usage: loadVarsAndArrays( URL [, TARGET [, METHOD ]] )");
trace(" or TARGET.loadVarsAndArrays( URL [, METHOD ] )");
}
var URL = arguments[0];
if (arguments.length<1 || arguments.length>3) {
usage();
return false;
}
if (this._name+"" != "") {
var METHOD = (arguments[1] == "GET") ? "GET" : "POST";
var TARGET = this;
} else if (typeof (arguments[1]) == "string") {
this.createEmptyMovieClip(arguments[1], 99999);
var METHOD = (arguments[2] == "GET") ? "GET" : "POST";
var TARGET = this[arguments[1]];
} else {
usage();
return false;
}
TARGET.onData = function() {
for (var v in this) {
if (v.indexOf("[")>0) {
var ar = v.split("[");
if (!this[ar[0]]) {
this[ar[0]] = [];
}
this[ar[0]][int(ar[1].substr(0, -1))] = this[v];
delete this[v];
}
}
delete this.onData;
};
TARGET.loadVariables(URL, METHOD);
}

this.createEmptyMovieClip("timer",50);
timer.onEnterFrame = function()
{
if (this.startTime>0)
{
var diff = getTimer()-this.startTime;
if (diff>this.timerLength)
{
this.target.play(1);
this.startTime = 0;
}
}
};
function pauseFor(theTime)
{
stop();
timer.timerLength = theTime;
timer.startTime = getTimer();
timer.target = this;
}[/AS]



HTTP-call:
Layer3:
[AS]
loadVarsAndArrays("http://disch-systems.de/administration/proxy/get.php3?np=1&ga[0]=3/1/5&eis[0]=7", "_root","POST");[/AS]



The returns:
Layer6:

[AS]
trace("variable:");
trace(_root.val(0)); //return: undefined (why?)
digital = _root.val(0).substr(0,_root.val(0).indexOf(""));
digital = Math.abs(digital);
trace(digital); //return 0
temp_display = Math.round(digital);[/AS]



Can somebody check my AS?

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 8 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.