Trouble Wih LoadVars Object
I can't seem to get this object to work correctly. Im trying to laod text into my mc called BioInfo. I know the link is ok and the variable names are ok. Anyone see anything?
Code: MyLoadVars = new loadVars(); MyLoadVars.load("D:MultimediaProjectsRiversideCdTypes12667Bio.txt,BioInfo"); MyLoadVars.onLoad = function(success) { if (success) { trace("done loading"); } else { trace("not loaded"); } }; not loaded Error opening URL "D:ultimediaProjectsiversidedTypesV67Bio.txt,Bi oInfo"
FlashKit > Flash Help > Flash MX
Posted on: 06-12-2003, 10:28 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[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 !
[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 !
Trouble With Loadvars
Trying to load a file with the url encoded copyright symbol
Here's tthe contents of the file:
copyrighttext=©2003 Don Johles Bike World
Result is a blank text field. What am I doing wrong?
LoadVars Trouble
please.....
I REALLY NEED HELP.
i need someone explain me how can i make send and recive a variable from flash to asp and then from asp to flash using the loadVars method.
PLEASE...............
Trouble Using LoadVars
Im trying to put the finishing touches on a site and am having some problems using LoadVars.
I am using the following code right now to try and pull images from a page.
Code:
myLoadVars = new LoadVars();
myLoadVars.load("http://xxxx.xxxxx.com/new/edit-images.jsp");
myLoadVars.onLoad = function() {
//create links
this.sm_01_images.sm_01a.sm_01aimg.contentPath = "http://xxxx.xxxxx.com" + String(myLoadVars.myImage1);
this.sm_01_images.sm_01b.sm_01bimg.contentPath = "http://xxxx.xxxxx.com" + String(myLoadVars.myImage2);
this.sm_01_images.sm_01c.sm_01cimg.contentPath = "http://xxxx.xxxxx.com" + String(myLoadVars.myImage3);
this.sm_01_images.sm_01d.sm_01dimg.contentPath = "http://xxxx.xxxxx.com" + String(myLoadVars.myImage4);
trace(this.sm_01_images.sm_01a.sm_01aimg.contentPath = "http://xxxx.xxxxx.com" + String(myLoadVars.myImage1));
}
and the trace is able to give me the correct location of the image but its not showing up, so if I run a trace just on the contentPath I get undefined.
any ideas?
LoadVars Trouble
HI, BEFORE ALL SORRY ABOUT MY ENGLISH... DON'T MENTION TO SCRUL THE LANGUAGE..
I'M NEW IN THE FORUM, BUT I'VE ALREADY READ A LOT. ..IN MY RESEARCH I THINK THAT IS THE BEST FORUM ON ACTIONSCRIPT, BUT NOT FOUND WERE I'M GOING WRONG IN THIS SCRIPT. I'M TRYING DO MAKE A CHAT, WITHOU XMLSocket, IT'S FAR FROM MY KNOWLEDGE.
ActionScript Code:
stop();
envia_lv = new LoadVars();
recebe_lv = new LoadVars();
cont_xml = new XML();
cont_xml.ignoreWhite = true;
ativo = 1;
inicio = 1;
ultReg = -1;
nicksGrupo = "";
recebe_lv.onLoad = function() {
cont_xml.parseXML(recebe_lv.arqXML);
for (var i=ultReg;i<cont_xml.childNodes.length;i++) {
if (inicio) {
ultReg = cont_xml.childNodes.length;
textoEnvia = "entrou na conversa...";
envia();
inicio = 0;
break;
} else {
novo = cont_xml.childNodes[i].attributes.ativo;
novo != undefined ? carregaNicks() : delete novo;
texto_txt.text += cont_xml.childNodes[i].firstChild.nodeValue+newline+newline;
texto_txt.scroll = texto_txt.maxscroll;
ultReg++;
}
}
}
function montaNicks() {
nicksGrupo = "";
for (var x=1;x<nicks.length;x++) {
nicksGrupo += nicks[x]+newline;
}
}
// ## LISTA E MONTA ARRAY COM NICKS ATIVOS ##
function carregaNicks() {
// ## ARRAY COM OS NICKS NA CONVERSA ##
nicks = new Array("");
// LOOP NOS NÓS DO XML
for (var i=0;i<cont_xml.childNodes.length;i++) {
// VALOR DE NICK ATIVO
var nickAtivo = cont_xml.childNodes[i].attributes.ativo;
if (nickAtivo == 1) {
// ADICIONA NICK NO FINAL DO ARRAY
nicks.push(cont_xml.childNodes[i].attributes.nick);
} else if (nickAtivo == -1) {
// GUARDA NICK
var verInativo = cont_xml.childNodes[i].attributes.nick;
// VERIFICA QDO NICK INATIVO É IGUAL NICK DO ARRAY (nicks)
for (var w=0;w<nicks.length;w++) {
if (verInativo == nicks[w]) {
// EXCLUI NICK DO ARRAY
nicks.splice(w,1);
}
}
}
}
montaNicks();
}
function recebe() {
recebe_lv.load("leia.php");
}
function envia() {
envia_lv.frase = textoEnvia;
envia_lv.nick = nick;
envia_lv.ativo = ativo;
textoEnvia = "";
ativo = 0;
// envia_lv.sendAndLoad("grava.php",envia_lv,"POST");
envia_lv.send("grava.php","_blank","POST");
}
setInterval(recebe,3600);
NOTE: IN envia FUNCTION . ..IF I USE sendAndLoad DON'T WORK AND IF I USE send WITHOUT target AND "POST" DON'T WORK TOO.
IN THIS WAY WORKS. BUT A GET A WINDOW IN RESPONSE.
HOPE I EXPLAIN RIGTH
THANKS
LoadVars Trouble
HI, BEFORE ALL SORRY ABOUT MY ENGLISH... DON'T MENTION TO SCRUL THE LANGUAGE..
I'M NEW IN THE FORUM, BUT I'VE ALREADY READ A LOT. ..IN MY RESEARCH I THINK THAT IS THE BEST FORUM ON ACTIONSCRIPT, BUT NOT FOUND WERE I'M GOING WRONG IN THIS SCRIPT. I'M TRYING DO MAKE A CHAT, WITHOU XMLSocket, IT'S FAR FROM MY KNOWLEDGE.
ActionScript Code:
stop();
envia_lv = new LoadVars();
recebe_lv = new LoadVars();
cont_xml = new XML();
cont_xml.ignoreWhite = true;
ativo = 1;
inicio = 1;
ultReg = -1;
nicksGrupo = "";
recebe_lv.onLoad = function() {
cont_xml.parseXML(recebe_lv.arqXML);
for (var i=ultReg;i<cont_xml.childNodes.length;i++) {
if (inicio) {
ultReg = cont_xml.childNodes.length;
textoEnvia = "entrou na conversa...";
envia();
inicio = 0;
break;
} else {
novo = cont_xml.childNodes[i].attributes.ativo;
novo != undefined ? carregaNicks() : delete novo;
texto_txt.text += cont_xml.childNodes[i].firstChild.nodeValue+newline+newline;
texto_txt.scroll = texto_txt.maxscroll;
ultReg++;
}
}
}
function montaNicks() {
nicksGrupo = "";
for (var x=1;x<nicks.length;x++) {
nicksGrupo += nicks[x]+newline;
}
}
// ## LISTA E MONTA ARRAY COM NICKS ATIVOS ##
function carregaNicks() {
// ## ARRAY COM OS NICKS NA CONVERSA ##
nicks = new Array("");
// LOOP NOS NÓS DO XML
for (var i=0;i<cont_xml.childNodes.length;i++) {
// VALOR DE NICK ATIVO
var nickAtivo = cont_xml.childNodes[i].attributes.ativo;
if (nickAtivo == 1) {
// ADICIONA NICK NO FINAL DO ARRAY
nicks.push(cont_xml.childNodes[i].attributes.nick);
} else if (nickAtivo == -1) {
// GUARDA NICK
var verInativo = cont_xml.childNodes[i].attributes.nick;
// VERIFICA QDO NICK INATIVO É IGUAL NICK DO ARRAY (nicks)
for (var w=0;w<nicks.length;w++) {
if (verInativo == nicks[w]) {
// EXCLUI NICK DO ARRAY
nicks.splice(w,1);
}
}
}
}
montaNicks();
}
function recebe() {
recebe_lv.load("leia.php");
}
function envia() {
envia_lv.frase = textoEnvia;
envia_lv.nick = nick;
envia_lv.ativo = ativo;
textoEnvia = "";
ativo = 0;
// envia_lv.sendAndLoad("grava.php",envia_lv,"POST");
envia_lv.send("grava.php","_blank","POST");
}
setInterval(recebe,3600);
NOTE: IN envia FUNCTION . ..IF I USE sendAndLoad DON'T WORK AND IF I USE send WITHOUT target AND "POST" DON'T WORK TOO.
IN THIS WAY WORKS. BUT A GET A WINDOW IN RESPONSE.
HOPE I EXPLAIN RIGTH
THANKS
LoadVars Trouble
Can anyone tell me why the following is happening?
I'm loading data from a external txt file. See code below:
Code:
var myRef = this;
var loadVar = new LoadVars();
var idFileName = "SomeData.txt";
loadVar.onData = function(src:String) {
if (src != undefined) {
myRef.results.text += chr(13) + "RESULT: " + src;
} else {
myRef.results.text += chr(13) + "ERROR: Collecting coursesettingsid failed! ("+this.httpStatus+")";
}
};
var sysDir = "system/";
if (_level0._url.contains("\\") != -1) {
sysDir = "system\";
}
results.text += "INFO: Collect data from textfile ("+ sysDir + idFileName +")...";
loadVar.load(sysDir + idFileName);
Running the swf from http works fine.
Running from file:\ protocol works fine when running from i.e. \somePathsystemSomeData.txt
But running from i.e. \somePath.comsystemSomeData.txt will fail WHY???
Please advise!
Thanks!
LoadVars() Trouble
hey guys,
in the first block of code below i have the desired out put of a thumbnail gallery, but the array of the images is defined manually.
the second block shows how i load php vars to define the same array. i know the array is defined because i have the movie also write out the contents of the array into a text box to make sure the values have been uploaded. but the images do not appear when they are dynamically loaded. am i placing the loadMovie commands in the worng place?
Attach Code
/*---------
WORKS
---------*/
var totalImages = 12
var xVal = 0;
var yVal = 0;
var rowCounter = 0;
var imageArray:Array = new Array();
imageArray[0] = 0;
imageArray[1] = "thisimage1.jpg";
imageArray[2] = "thisimage2.jpg";
imageArray[3] = "thisimage3.jpg";
imageArray[4] = "thisimage4.jpg";
imageArray[5] = "thisimage5.jpg";
imageArray[6] = "thisimage6.jpg";
imageArray[7] = "thisimage7.jpg";
imageArray[8] = "thisimage8.jpg";
imageArray[9] = "thisimage9.jpg";
imageArray[10] = "thisimage10.jpg";
imageArray[11] = "thisimage11.jpg";
imageArray[12] = "thisimage12.jpg";
for(i=1; i<=totalImages; i++){
_root.attachMovie("thumb","thumb"+i,_root.getNextHighestDepth(), {_x:xVal, _y:yVal});
rowCounter++
if(rowCounter == 5){
xVal = 0;
yVal = 105;
rowCounter = 0;
} else
xVal = xVal + 105
this["thumb"+i].loadMovie(imageArray[i],i);
}
/*---------------------
DOESNT WORK
---------------------*/
var xVal = 0;
var yVal = 0;
var rowCounter = 0;
var myData:LoadVars = new LoadVars();
myData.onLoad = function(success){
if(success){
var imageArray:Array = this.imageString.split("****");
var totalImages = imageArray.length - 1;
for(i=1; i<=totalImages; i++){
_root.attachMovie("thumb","thumb"+i,_root.getNextHighestDepth(), {_x:xVal, _y:yVal});
rowCounter++
if(rowCounter == 5){
xVal = 0;
yVal = 105;
rowCounter = 0;
} else
xVal = xVal + 105
this["thumb"+i].loadMovie(imageArray[i],i);
}
}
}
myData.load("url.php");
LoadVars Trouble In MX2004
Hello all.
I am writing an authorization script. I've created a LoadVars object to hold data both in flash and my server-side (php). I've used this before, but something doesn't seem to be working.
1. I've created the LoadVars object.
2. Then I've given it an onData operation.
3. I set some variables up that are defined in textfields in the same movie.
4. I trace out my varibles to double check them.
5. My variables return as undefined. WTF! I can see this as a problem for my loading of server-side vars, but I just set these object fields up right before the trace and they should work. Does anyone have any suggestions? Below is my code:
code: myVars = new LoadVars();
myVars.onData = function(){
trace(myVars.auth);
trace(myVars.returnemail);
if(myVars.auth == 1){
gotoAndPlay("authorized");
}
else{
gotoAndPlay("invalid");
}
}
// Add some fields to the myVars object
myVars.user = emailaddr;
myVars.pass = userpass;
// Trace out all the fields in the myVars object
for(var j in myVars){
trace(j + ": " + this[j]);
}
// call my script and send and recieve data into the myVars object
myVars.sendAndLoad("http://localhost/login.php", myVars, "POST");
Trouble With LoadVars.send
I'm having a little trouble with basic LoadVars.send in MX.
I'm just sending a variable to a database.
If I open a new window:
saveLoadVars.send("update.cfm","_blank","post")
everything works fine but I'd prefer not to open a window, I'd prefer to send my variables to a page that doesn't appear onscreen and allow my flash app to just keep running).
But if I just send the variables without specifying anything else:
saveLoadVars.send("update.cfm")
It doesn't write to the database (I have a second window open where I can monitor this).
I know this is a really basic thing to do, and I can't figure out what I'm doing wrong.
Any help would be appreciated.
Scope Trouble With LoadVars
[AS1][loadVars] Scope trouble with loadVars !
Hi everybody,
I'm new on this server !
You will 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 !
Scope Trouble With LoadVars
[AS1][loadVars] Scope trouble with loadVars !
Hi everybody,
I'm new on this server !
You will 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 !
Trouble With LoadVars.send
I'm having a little trouble with basic LoadVars.send in MX.
I'm just sending a variable to a database.
If I open a new window:
saveLoadVars.send("update.cfm","_blank","post")
everything works fine but I'd prefer not to open a window, I'd prefer to send my variables to a page that doesn't appear onscreen and allow my flash app to just keep running).
But if I just send the variables without specifying anything else:
saveLoadVars.send("update.cfm")
It doesn't write to the database (I have a second window open where I can monitor this).
I know this is a really basic thing to do, and I can't figure out what I'm doing wrong.
Any help would be appreciated.
Scope Trouble With LoadVars
[AS1][loadVars] Scope trouble with loadVars !
Hi everybody,
I'm new on this server !
You will 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 :
ActionScript Code:
//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 !
Trouble With LoadVars Variable.
I am modifying a quiz that imports a number from an external text file in order to tell flash which xml file to load (the file that has the quiz questions). The variables seem to load (I've checked list variables), but when I try to concatenate the variable I get an 'undefined'. How to I call this variable?
//loadVars from Data Source
myVariables = new LoadVars();
myVariables.load("data.txt");
myVariables.onLoad = function(success){
if(success){
trace(this.quiznumber);
} }
//Generate Question Array
var quizItems=new Array();
var myData=new XML();
myData.ignoreWhite=true;
myData.onLoad=onQuizData;
myData.load("quiz"+quiznumber+".xml");
stop();
Trouble With LoadVars.send
I'm having a little trouble with basic LoadVars.send in MX.
I'm just sending a variable to a database.
If I open a new window:
saveLoadVars.send("update.cfm","_blank","post")
everything works fine but I'd prefer not to open a window, I'd prefer to send my variables to a page that doesn't appear onscreen and allow my flash app to just keep running).
But if I just send the variables without specifying anything else:
saveLoadVars.send("update.cfm")
It doesn't write to the database (I have a second window open where I can monitor this).
I know this is a really basic thing to do, and I can't figure out what I'm doing wrong.
Any help would be appreciated.
Scope Trouble With LoadVars
[AS1][loadVars] Scope trouble with loadVars !
Hi everybody,
I'm new on this server !
You will 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 :
ActionScript Code:
//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 Ondata Trouble
I'm trying to read a textfile of file names into a 2 dimensional array using loadvars. This is being done in a class with #initclip 1. The array will be input into a slideshow - another class with #initclip 2.
It will load the array with the values from the text file. That doesn't seem to be a problem. What is a problem is WHEN it happens. For some reason, the 'onData' function doesn't run until the end. I can see this happen when I step thru the code. Sequentially, it goes like this:
(Scene 1)
1. var imageinfo_arr = [];
2. var oD = new oDataLoader("fileinfo.txt");
(goes into the oDataLoader class and does some stuff.)
3. oD.loadData(); (Passes over this statement!)
4. imageinfo_arr = oD.data_arr; (imaginfo_arr is empty!)
5. this.attachMovie("slideshow", "show", 10, {... (goes into this class and starts the slideshow!)
...
x. oDataLoader.prototype.onData = function(dat) {
trace("In OnData");
var fieldnames_arr = [];
... etc.
Step x is the last thing to execute! And it executes fine! I don't get it!
I must admit I'm a newbie re: Flash. Also, I realize the slideshow isn't setup for the 2 dimensional array yet but that's not the problem. The array in the oDataLoader class isn't loading until the end. Any help here is greatly appreciated. Thanks!
My code is below....
Scene 1
=========
var imageinfo_arr = [];
var oD = new oDataLoader("fileinfo.txt");
oD.loadData();
imageinfo_arr = oD.data_arr;
this.attachMovie("slideshow", "show", 10, {
_x:0, _y:0, _visible:false, fps:12, nFrames:24, alphaIncr:5,
slides_arr:imageinfo_arr, slideDepth:1, repeat:true,
slideTracker:"currentSlide"});
trace('name='+imageinfo_arr[0][fieldnames_arr[0]]+'; title='+imageinfo_arr[0][fieldnames_arr[1]]);
// tell _root (this) to listen for events broadcast by show
show.addListener(this);
this.onSlideLoaded = function(i) {
//trace('slide '+ i + ' loaded');
};
this.onAllSlidesLoaded = function() {
show._visible = true;
show.beginTransitions();
};
this.onShowOver = function() {
//set repeat:false in show for this to be called
//trace('slideshow is over');
};
toggle_mc.onRelease = function() {
// if playing
if (this._currentframe == 1) {
this.gotoAndStop("stopped");
// stop the show on the current slide
show.stopTransitions();
// make sure current picture is displayed at 100 alpha
for (var t=0; t<pic_arr.length; t++) {
if (t==currentSlide) {
show["slide"+t]._alpha = 99;
} else {
show["slide"+t]._alpha = 0;
}
}
// if stopped
} else {
// start up transitions from current slide
this.gotoAndStop("playing");
show.activateInSeq(currentSlide);
}
};
oDataLoader class
========================
#initclip 1
oDataLoader = function(filename) {
trace("oDataLoader Created");
this.filename = filename;
}
oDataLoader.prototype.onData = function(dat) {
trace("In OnData");
var fieldnames_arr = [];
// try splitting on
(ok for file on windows server)
var input_arr = dat.split('
');
// if that doesn't work, split on
(file on linux server)
if (input_arr.length==1) {
input_arr = dat.split('
');
}
// fieldnames_arr will have one element per field name
fieldnames_arr = input_arr[0].split(',');
for (var i=1; i<input_arr.length; i++) {
var fields_arr = input_arr[i].split(',');
this.data_arr.push({});
for (var j=0; j<fields_arr.length; j++) {
this.data_arr[i-1][fieldnames_arr[j]] = fields_arr[j];
}
}
trace('name='+this.data_arr[0][fieldnames_arr[0]]+'; title='+this.data_arr[0][fieldnames_arr[1]]);
};
getArray = function(){
return this.data_arr;
};
oDataLoader.prototype.loadData = function(){
this.loaded = false;
this.load(this.fileName);
};
oDataLoader.prototype.addProperty("data_arr", getArray, null);
oDataLoader.prototype.data_arr = new Array();
oDataLoader.prototype.loaded = false;
oDataLoader.prototype.fileName = null;
oDataLoader.prototype.__proto__ = LoadVars.prototype;
oDataLoader.prototype.superClass = LoadVars.prototype.constructor;
Object.registerClass("oDataLoader", oDataLoader);
#endinitclip
Slideshow class
============
#initclip 2
Slideshow = function() {
trace('slideshow created');
ASBroadcaster.initialize(this);
this.loadInSeq(0);
}
Slideshow.prototype = new MovieClip ();
Slideshow.prototype.loadInSeq = function(i) {
var slide = this.createEmptyMovieClip("slide" + i, this.slideDepth++);
// hide all slides loading on top of first one
if (i > 0) slide._alpha = 0;
slide.loadMovie(this.slides_arr[i]);
checkLoadedID = setInterval(function(i, mc) {
if (mc["slide" + i]._width > 0) {
mc["slide" + i]._visible = true;
mc["slide" + i]._x = ((800 - mc["slide" + i]._width) / 2);
mc.broadcastMessage("onSlideLoaded", i);
clearInterval(checkLoadedID);
// start next one loading (if not last)
if (i < mc.slides_arr.length-1) {
mc.loadInSeq(i + 1);
} else {
mc.broadcastMessage("onAllSlidesLoaded");
}
}
}, 1000/this.fps, i, this);
};
Slideshow.prototype.beginTransitions = function() {
var holdTimeMs = 1000 * this.nFrames / this.fps;
holdID = setInterval(function(mc) { mc.activateInSeq(0); clearInterval(holdID); }, holdTimeMs, this);
};
Slideshow.prototype.stopTransitions = function() {
delete this.onEnterFrame;
};
Slideshow.prototype.activateInSeq = function(i) {
//trace('in activateInSeq1, i='+i);
if (++i < this.slides_arr.length) {
this["slide" + i]._visible = true;
this["slide" + i]._alpha = 0;
this["slide" + i].swapDepths(this.slideDepth++);
this["slide" + i]._x = ((800 - this["slide" + i]._width) / 2);
this._parent[this.slideTracker] = i;
this.onEnterFrame = function() {
if (this["slide" + i]._alpha >= 99) {
var counter = this.nFrames;
this.onEnterFrame = function() {
if (!counter--) {
delete this.onEnterFrame;
this.activateInSeq(i);
}
};
} else {
if (i>0)
{ if (this["slide" + (i-1)]._alpha <= this.alphaIncr)
{
this["slide" + (i-1)]._alpha = 0;
}
else
{
this["slide" + (i-1)]._alpha -= this.alphaIncr;
}
}
else
{
if (this["slide" + (this.slides_arr.length-1)]._alpha <= this.alphaIncr)
{
this["slide" + (this.slides_arr.length-1)]._alpha = 0;
}
else
{
this["slide" + (this.slides_arr.length-1)]._alpha -= this.alphaIncr;
}
}
this["slide" + i]._alpha += this.alphaIncr;
}
};
} else {
if (this.repeat)
{
this.activateInSeq(-1);
}
else this.broadcastMessage("onShowOver");
}
};
Object.registerClass("slideshow", Slideshow);
#endinitclip
Trouble Using LoadVars To Return A Url For LoadMovie
Hi there.
I hope that someone can help me. I think I'm trying to do something pretty basic and it's just not working.
OK, I have a movieclip on my main timeline that contains some text along with ANOTHER movieclip inside it that I'm using a loadMovie call on. Ok here's my problem...
on the first frame I'm using this actionscript in an attempt to load the url that contains the swf file:
*******
loadVariables("http://localhost/adurl.php", "this");
loadMovie(url, adclip);
stop();
********
Then the PHP file "adurl.php" contains this code:
*******************
<?
$string = "http://localhost/ads/backpain.swf";
print '&url=' . urlencode($string);
?>
*******************
I've tried several ways to grab the value of "url" from the php file and then use it in another function (or maybe for anything else) but no matter what I do it just doesn't work. I know the movie can be loaded because when I put the literal url in place of my variable "url" it works lovely. I also know that the PHP file is returing the value because when I run it thru my browser that works just fine.
But the functionality I'm aiming for is more dynamic than that.
Help anyone? What am I doing wrong?
Trouble With Listener / LoadVars Mechanism
I'm building a fairly simple dynamic photo gallery script with PHP and MySQL. The variables are loaded using loadVars, images are loaded into movie clips stacked on top of one another, and the back / next buttons change the _alpha on the stack of images to "switch" between them. This much of the script works fine - it's when I try to replace the existing images with a new set.
The way I want users to be able to toggle between projects (the images are organized by project) is by a pulldown menu component. The pulldown populates, functions and displays correctly.
PHP Code:
for (i=1; i<=imageinfo.total_projects; i++) {
project_id = 'project'+i+'id';
project_title = 'project'+i+'title';
pulldown.addItem({data:imageinfo[project_id], label:imageinfo[project_title]});
}
var cbListener:Object = new Object();
cbListener.change = function(evt_obj:Object) {
trace("Newly selected project: "+evt_obj.target.selectedItem.data);
_root.selected_var = evt_obj.target.selectedItem.data;
_root.gallery_pics.removeEventListener("change", cbListener);
_root.gallery_pics.gotoAndPlay(1);
};
pulldown.addEventListener("change", cbListener);
stop();
By the way, all of this is going on in _root.gallery_pics.
The actual problem occurs when I select a new project from the pulldown. I've got trace actions in place to see what's going on, but the movie goes into an infinite loop and freaks out. The listener sends the movie back to frame 1 - this is intended to delete the existing movie clips and unset the variables... I'm not entirely sure the latter part is necessary, but I'm pretty much grabbing at straws here.
PHP Code:
for (i=this.imageinfo.total; i>0; i--) {
this['img'+i].removeMovieClip();
trace('Deleting img'+i);
}
delete imageinfo.total_projects;
this.imageinfo.length = 0;
delete this.imageinfo;
delete _root.gallery_pics.i;
this._alpha = 0;
delete _root.gallery_pics.picStatus;
trace('Images and variables reset');
gotoAndPlay(2);
This frame seems to go through just fine. But when the script goes to frame 2, that's when the problem occurs.
PHP Code:
stop();
// Plays the movie once images are loaded
this.onEnterFrame = function() {
_root.gallery_pics._alpha = 0;
percent = (_root.gallery_pics.last_image.getBytesLoaded()/_root.gallery_pics.last_image.getBytesTotal())*100;
if (percent == 100) {
_root.gallery_pics._alpha = 100;
_root.gallery_pics.play();
delete this.onEnterFrame;
}
};
// Loads variables
imageinfo = new LoadVars();
if (_root.selected_var == undefined) {
// No project selected, load the latest
imageinfo.load("http://bya.localhost/scripts/flash_gallery.php");
trace('Loading latest project');
} else {
// Load selected project
imageinfo.load("http://bya.localhost/scripts/flash_gallery.php?project="+_root.selected_var);
trace('Loading project number '+_root.selected_var);
}
trace('Begin onLoad');
imageinfo.onLoad = function(success) {
if (success) {
trace("Variables loaded");
_root.gallery_pics.i = imageinfo.total_photo;
trace('Total Photos: '+imageinfo.total_photos);
// Loop to load images
for (counter=1; counter<=imageinfo.total_photos; counter++) {
this.imageName = 'img'+counter;
this.imageLoc = this[this.imageName];
trace('Image name: '+this.imageName+', Image location: /'+this.imageLoc);
_root.gallery_pics.createEmptyMovieClip(this.imageName, counter+100);
with (_root.gallery_pics[this.imageName]) {
loadMovie('http://bya.localhost/'+this.imageLoc);
_x = 33;
_y = 108;
}
if (counter == imageinfo.total_photos) {
_root.gallery_pics.last_image = _root.gallery_pics[this.imageName];
}
}
_root.gallery_pics.i = _root.gallery_pics.imageinfo.total_photos;
_root.gallery_pics.picStatus = _root.gallery_pics.i+' of '+_root.gallery_pics.imageinfo.total_photos;
} else {
trace("Error loading variables");
}
};
The output window indicates that the script starts to hang during the onLoad event. It tells me the script is causing the movie to run slowly and asks me to abort.
The only thing I could imagine is that I'm doing something wrong with loadVars that I don't know about. Like maybe I shouldn't be trying to load new variables into the same object? Maybe I'm not deleting it properly? Can anyone help?
Trouble Writing A Function Using LoadVars
I'm loading external text files into a textbox when you click buttons, like so:
ActionScript Code:
blueBtn.onRelease=function(){
loadText=new LoadVars();
loadText.load("blueText.txt");
loadText.onLoad=function(success){
if(success){
newsBox.html=true;
newsBox.htmlText=this.myNews;
}
}
}
This works fine, no problem. But I've got a bunch of buttons. So, I write this as a function:
ActionScript Code:
function grabText(file, fileVar) {
loadText = new LoadVars();
loadText.load(file);
loadText.onLoad = function(success) {
if (success) {
trace("I have your data, Commander.")
newsBox.html = true;
newsBox.htmlText = file.fileVar;
}
};
}
blueBtn.onRelease = function() {
grabText("blueText.txt", "myNews");
};
And then I have trouble. The trace works fine, but "undefined" appears in the textbox.
Any ideas what I'm doing wrong? I'm sure it's something simple/stupid, but I can't find it. Thanks!
Trouble Accesing Data Using LoadVars()
Hello all,
I'm having so much trouble using laodVars() even after reading the tutorial on this site and others as well. All i want to do is store some variables in a text file instead of having it hardcoded. I've tried variations of using loadVar(). It seems to load the variables but i can't access them.
The code i have is:
Code:
data = new loadVars();
data.load("themes/color.txt")
data.onLoad = function( success ){
if(success){
trace("variables loaded");
trace(data.color1);
trace(data.color2);
trace(data.color3);
} else {
trace("Error loading page");
}
And in color.txt are different colors like:
color1=0x99FF99&color2=0xFF99FF&color3=0xAA99FF
So the hex colors are stored in the txt file and i would like to load them into variables so i can use them in flash. The trace in the above code is undefined...
Any ideas? thanks in advance!
Trouble Accesing Data Using LoadVars()
Hello all,
I'm having so much trouble using laodVars() even after reading the tutorial on this site and others as well. All i want to do is store some variables in a text file instead of having it hardcoded. I've tried variations of using loadVar(). It seems to load the variables but i can't access them.
The code i have is:
Code:
data = new loadVars();
data.load("themes/color.txt")
data.onLoad = function( success ){
if(success){
trace("variables loaded");
trace(data.color1);
trace(data.color2);
trace(data.color3);
} else {
trace("Error loading page");
}
And in color.txt are different colors like:
color1=0x99FF99&color2=0xFF99FF&color3=0xAA99FF
So the hex colors are stored in the txt file and i would like to load them into variables so i can use them in flash. The trace in the above code is undefined...
Any ideas? thanks in advance!
Trouble Assigning Link To Image Loaded With Loadvars In As 2.0
I'm working on a pretty simple image gallery using LoadVars. Images are loaded into a movieclip (framesMC) and I'm trying to assign a link to each loaded image dynamically as well (as the images changes so should the link). So I set up a separate LoadVars (urlLV) to load the URL from a text file and assign it to the movieclip by using getURL once the image has loaded. The text file gets loaded and the image becomes a link but the URL that's linked 1) replaces symbols (periods and slashes) w/ code and 2) also includes the URL of the site where the gallery is. To illustrate an example:
my text file contains: info=http://www.waterloorecords.com
the site hosting the swf of the gallery is [url]www.douglasbenjamin.com[/url]
when I click the link on the site the URL it tries to navigate to is:
[url]http://www.douglasbenjamin.com/info=http%3A%2F%2Fwww%2Ewaterloorecords%2Ecom[/url]
here's code for the gallery:
[code]var curFrameNum:Number = 0;
var slideInfoLV:LoadVars = new LoadVars();
slideInfoLV.load("vars/slide_info.txt");
function loadFrame() {
var urlLV:LoadVars = new LoadVars();
var clipLoader = new MovieClipLoader();
var preloader = new Object();
var slideURL:String;
clipLoader.addListener(preloader)
clipLoader.loadClip("images/web" + curFrameNum + ".jpg", this.framesMC);
_level0.myLV.load("slidetext/web" + curFrameNum + ".txt", this.loadedInfo);
// loading the URL...
urlLV.load("slideurl/web" + curFrameNum + ".txt");
var slideURL = urlLV;
preloader.onLoadComplete = function (framesMC){
framesMC.onPress = function() {
getURL(slideURL, _blank);
}
}
}
loadFrame();
// ----<next slide>---- \
this.nextSlideBtn.onRelease = function() {
if (curFrameNum < Number(slideInfoLV.totalFrames) - 1) {
curFrameNum ++;
} else {
curFrameNum = 0;
}
loadFrame();
}
// ----<prev slide>---- \
this.prevSlideBtn.onRelease = function() {
if (curFrameNum == 0) {
curFrameNum = Number(slideInfoLV.totalFrames) - 1;
} else {
curFrameNum --;
}
loadFrame();
}[/CODE]
Is there some attribute I should be referencing for urlLV to make this work? Or am I missing something else? Thanks in advance for any advice.
Help With LoadVars Object
ok so I have a book that I am reading from and it is giving me the code to load variables from an external txt file into my flash movie using the LoadVars Object. It is a simple task that I wish to perform. I have a txt file called "pass.txt" that is located in the folder named "properties" which is in the same directory as my flash movie itself. In the file pass.txt is says:
pw=flash&
The very first frame of my flash movie has the following lines of code:
loadPass = new LoadVars();
submit.onPress = function() {
loadPass.load("properties/pass.txt");
trace(dammit.pw);
};
According to my book I should be able to see the word "flash" in my output window but it is not working. HELP
New LoadVars Object
Hi,
i have th following action
var VarObj = new LoadVars();
VarObj.textVar;
VarObj.load("text.txt")
trace(VarObj.toString());
trace(VarObj.textVar);
but i get no output
WHY?
New LoadVars() - Is It Possible To Get This Object's Name?
Hi,
I've created a new LoadVars object.
Is it possible to get the name of this created object?
Code:
postVars = new LoadVars();
postVars.p = 5;
trace(postVars);
When I trace postVars I get the object's property and it's value.(p=5)
I've even tried trace(postVars._name); but to no avail.
Can anyone help please? Thanks.
Php And The LoadVars Object
I am trying to connect to a php file that returns the files in the current directory, and the swf seems to be getting back the uncompiled code in the loadVars object.
This is the code from the flash movie:
var phpVars = new LoadVars();
phpVars.onLoad = function(success)
{
if (success)
{
trace(this.n + " files in this directory");
var i = 0;
}
else {
trace("error!");
}
}
phpVars.sendAndLoad("browseDir.php",phpVars,"POST" );
and this is the php code:
<?php
// fill an array with all items from a directory
$handle = opendir('.');
$i=0;
$rstring = "";
while ($file = readdir($handle)) {
if ($i> 1 )
{
$rstring .= "&file"."$i"."=" . urlencode($file);
//$files[] = $file;
}
$i++;
}
closedir($handle);
$i-=3;
$finaloutput ="n=".$i.$rstring;
print $finaloutput;
?>[php]
I can't seem to figure out why it's not working, b/c when i test the php file, it outputs the exact urlencoded string...
Dave
LoadVars Object With PHP
Well I've spent hours and hours searching with no luck, maybe someone here can help me.
All I want to do is take variables from a mySQL database via PHP, and deliver them to Flash. I'm just using very simple example code until I get it to work - I haven't even introduced mySQL yet.
This is the php code in "passvars.php":
<?php
$lastName = "Anderson";
$phone = "301-424-5555";
echo "lastName=".$lastName."&phone=".$phone;
?>
And this is the code I'm using to retrieve the variables in Flash:
function showValues() {
returnvals.text = "returned from php:
";
for (i in this) {
returnvals.text += i + " = " + this[i] + "
";
}
}
var c = new LoadVars();
c.onLoad = showValues;
c.load("passvars.php");
This is straight from another tutorial and should output something like this:
returned from php:
phone = 301-424-5555
lastName = Anderson
onLoad = [type Function]
In my text box "returnvals."
But instead I get:
returned from php:
phone = ".$phone;
?>
<?php
$lastName = "Anderson";
$phone = "301-424-5555";
echo "lastName=".$lastName."
Which I can't do anything with. I don't know why Flash isn't getting the variables. Can anyone help?
LoadVars Object
Using the loadVars Object, how can I reference the variables I load in a loop script?
Heres what I'm trying to accomplish:
Code:
loadVarsText = new loadVars();
loadVarsText.load("myvars.txt");
for (i=1; i <=loadVarsText.totalPos; i++) {
this.myPos = "pos" + i;
trace(this.myPos);
_parent.details_txt.text += myPos;
}
I have a variable in myvars.txt named totalPos that equals 5.
I have 5 variables named pos1 through pos5 that each contain text.
I'm trying to access those 5 pos variables and load their text into my dynamic text object - details_txt.
I'm just not sure how to call the variables in loadVarsText - I've tried tracing them and they return undefined - the text file is in the same directory as my flash movie (swf file).
I'm using Flash MX.
Thanks
LoadVars Object
Hi there,
Going through some threads and tutorials I can't seem to find a way to load let's say 5 variables in an object..
I pass some variables to ASP using loadMovie "POST" and when I look at the output I have 200+ variables sendt... I would like to just send the 5 variables I choose to put in my object, as Im pretty sure the MEGA string passed to ASP is confusing it, and allso makes it hard to debug as I have to look for my variables between the 200+ other variables from components and textfields and what other things I stuffed in the little poor movie..
It's like flash just´is emptying everything out ...
can I have my output be only var0,var1,var2,var3...n
I havn't been able to find any tutorials or threads covering this problem..
Thanks
Using LoadVars Object
I'm trying to assign value in
the onload method of the loadVars object
to class variable.
when referring to that class variable
out of the onLoad method the variable is 'undefined'
class className{
var retObj;
dataFromServer.onLoad = function ()
{
var obj = new object()
//ret obj is variable defined in the class that contain
//the loadVar object
retObj = obj;
}
trace (retObj) // will show undefined
}
how can I keep the assigned value in the variable
out of the onLoad method?
LoadVars Object
I'm using a Load Vars object to load URLs from a text file, which is all working fine and dandy.
What I'm having problems with is moving the variables/value pairs out of the object onto the movie root to make them accessible to later scripts. I have another variable (prefix) which is loaded via FlashVars, I need to append this value to each of the URLs held in the text file.
I want to do this by building something into the onload handler but am having real difficulty. Any hints or suggestions gratefully received!
code:
stop();
mapLoadVars = new LoadVars();
mapLoadVars.load("some_urls.txt");
mapLoadVars.onLoad = function (success) {
if (success) {
// I want to use a for loop here to move the variables to the _root and append another variable value (loaded via FlashVars) to each
}
}
LoadVars Object
Hello.
I need to handle variables of a loadvars object. It would be easy to assign variable values to elsewhere but the thing is that I don´t know the variable names and they may be different every time loaded...
Can I convert loadVars somehow into an array?
Help!
LoadVars Object
Hello all, I was tinkering with the LoadVars for a blog template, and I have a tiny problem. The line of code which I have a problem is this:
myBlog.load("blog.html");
Is there any way to get flash to load variables from the HTML page that it is in, instead of using an absolute/relative path like this? Or do I have to use Java to somehow detect the HTML that flash is in, then parse this value to flash? Someone please help me...
LoadVars() Object
Can anyone help me locate any tutorials out there that would help me learn up this object?
I find using the loadVariables method rather difficult not being able to preload but cant happen to find any tutorials on the loadVars object....
thanks...
Clearing A LoadVars Object
I've created a form in Flash that is submitted to a PHP validation script. Everything works fine, but I want the Array of returned variables in the LoadVars object to be cleared once they have been returned so that any subsequent form submission creates a fresh Array of variables.
Code:
formdata = new LoadVars();
function showReply() {
var j = new Array();
var mes;
for (x in this) {
if (this[x] == "no") {
formdata.sendAndLoad("vas.php",formdata,"post");
} else if (this[x] == "yes"){
nombre.text = "";
email.text = "";
formdata.sendAndLoad("vas.php",formdata,"post");
} else {
j.push(this[x]);
}
}
j.reverse();
mes = j.pop();
message.text += String(mes);
}
formdata.onLoad = showReply;
If the name field is blank or the e-mail field is incorrect an error message is printed. Otherwise, a success message is printed. The sendAndLoad lines you see post to dummy scripts as a workaround to the need to double click on subsequent submissions (Mac/IE bug). The validation works properly everytime, but the message that is returned to the user randomly comes back incorrect. That is why I need to clear the Array, so the mes = j.pop(); line is always returning the right variable. Any ideas?
Thanks.
Problem With Loadvars Object
Hi,
I have code to update database with teh values in input texts.
when i assign a constant string to my 'tempvar' variable i get it in my ASp and it updates properly, but if i assign the scrrenvales with the for loop as shoen in code below, it just does not come to ASP...
pls, if anybody can point out any mistakes i will be very tahnkful to you,
Code in my flash
var c = new LoadVars();
c.onLoad = showContent;
var tempvar = "";
i = 1;
var x = Number(_global.numbars);
for(i = 1;i < x+1;i++)
{
tempvar = tempvar + eval("_root.movie"+i+".mid.text") + "," + eval
("_root.movie"+i+".slot.text") + "," + eval("_root.movie"+i+".errthresh.text") + ",";
}
//tempvar = tempvar+",";
//trace( "TEMPVAR"+tempvar);
//tempvar = "1,2,30,1,4,50,"; //This one gets to The ASP page but with the for loop i just
//get nothing
c.passvalue = tempvar;
c.sendAndLoad("dmm2.asp",c,"POST");
And code in my ASP is:
var script_mar1 = Request("passvalue");
Thanks,
Shilps
LoadVars Object Vs. LoadVariables()
has anybody worked with the LoadVars Object?
I'm wondering if it is worth using it, rather than the easy and simple loadVariables (which I am familiar with)?
Also i would appreciate if you could include a short sample of code (an extensive sample is ok too, but it's your time) since the AS-Dictionary doesn't include that and because it is easier to understand than a description.
thanks a lot and greets from zurich
Help Needed With LoadVars (object)
Hi guys am having a small problem I want to load up some text
into a file I am using the loadVars object to load it up into the file BUT seams that by doing it this way u can not render the variable as Html tags. Any way i can load up my text using the loadVars object while still beeing able to use html tags on the text file variable ? any help would be apreciated thanks.
Omar
LoadVars Object Probs
I can't seem to access my variables from my loadVars object?
My text file looks like this
name1=Jason&name2=Nathan&name3=John&
I load in my variables from a text file using this code
on (release) {
myvar=new LoadVars();
myvar.load ("test.txt");
}
then I have a dynamic text field set up with a variable name of
myvar.name1
I've checked and the myvar object contains my data from the txt file but I don't know why I can't get it into my text field?
Help
Thanks
Jason
Possible To Clear A Loadvars Object
Hi Peeps. Say I have a loadvars object called myData and have finished using it and dont want to use it anymore can it be cleared or deleted using a command from actionscript? I have about 10 variables in it that I want to get rid off so I could do with either a method to empty everything in a loadvars object or to delete the entire thing.
Thanks
LoadVars(object) Fail?
This object makes me mad...Only few lines of action but it doesn't give me what I expected.
I have a txt file (file.txt) with content:
name=Eric&sex=M&topic=flash
Also I create a flash file. Here is the action I have written:
myData = new LoadVars();
myData.load("file.txt");
percentLoaded = myData.getBytesLoaded() / myData.getBytesTotal();
trace(percentLoaded)
On the stage there are 3 dynamic text field with var name myData.name, myData.sex & myData.topic. Nothing is shown in text fields. The trace command gives me "NaN" for the output.
I have no idea what problem i have made. The loadVariablesNum works perfectly, but not loadVars object. Would someone give me some hints for this problem? thanks.
Attached can find my source file
LoadVars Object Question
Hi,
I created a simple form with three fields: name (fieldName), email (fieldEmail), message (fieldMessage). With it, I created a dynamic field called formStatus. Then, I created a loadVars object like this:
Code:
scriptVars = new LoadVars();
scriptVars.mailStatus = "not send";
In the form, the "send" button has this actions attached to it:
Code:
on (release){
scriptVars.sendAndLoad("sendMail.php",this,"POST");
formStatus.text = scriptVars.mailStatus;
}
Ok, and this is how the PHP script (sendMail.php) looks like:
PHP Code:
<?
$ToEmail = "me@myprovider.com";
$ToName = "Sixpack Runner";
$ToSubject = "PHP Mail Test";
$EmailBody = "Name: $fieldName
Emailaddress: $fieldEmail
Message:
$fieldMessage
";
$EmailFooter="
This should be the footer...";
$Message = $EmailBody.$EmailFooter;
mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From: ".$fieldName." <".$Email.">");
echo "&mailStatus=ready";
?>
Ok, what's this all about. Well, I want to send information back to the SWF movie but it just doesn't happen. I don't understand why because these steps where taken from a tutorial. Can anyone explain me what I'm doing wrong?
Thanks!
LoadVars Object In Flash MX Ver 6.0
I am trying to read a simple text file into Flash MX Ver6.0 using LoadVars(); and I just can't get it to work. I have tried all the tutorials I can find and searched high and low. All the demos I try just don't seem to work.
According to the manual you can create a text file myfile.txt
name=John&age=25&wife=Kelly
then use actionscript
myData = new LoadVars();
myData.load("http://www.myDomain.com/myfile.txt");
Once this loads you are supposed to have access to the variables
myData.name
myData.age
myData.wife
Has anyone got this to work or have another way of getting these variables into flash MX?
Thanks for your help
very frustrated
The attached zip file contains a flash movie that loads an array of jpg names and then displays them randomly. If you comment out the first two lines of code and uncomment the third line, the file works from the array built in actionscript - this works. If you uncomment the first two lines and comment out the third line then the array is loaded from a text file as documented above - but it doesn't work. ahhhhhh !
LoadVars Object Question
ok, i have a test page for loading array variables from an external source. there are two dynamic text boxes. they are named data1 and data 2. data1's variable value is set to array_data_test[0] and data2 is set to array_data_test[1](the creation of these will be explained later) i am wondering why these don't automatically change as these values become available and have to be manually set with data1.text=array_data_text[0], and the same for data2.
The data comes in in this format:
&data_test=value1|value2&complete_data_test=yes &
heres my AS
frame1:
Code:
var homevars=new loadVars();
homeVars.load("datatest.php");
homeVars.onLoad=function() {
_global.array_data_test=this.data_test.split("|");
}
frame3:
Code:
if(homeVars.complete_data_test!="yes") {
gotoAndPlay(2);
}else{
data1.text=_global.array_data_test[0];
data2.text=_global.array_data_test[1];
stop();
}
Why wouldn't the dynamic text fields yust automatically update as the variables are created?
LoadVars Object Never Loaded
I am using the loadVars object to load a jpg, before using the loadMovie function to load it into my movieclip, upon success of the load.
I also use another movieClip to track the amount of data loaded into the loadvars object (with the getByteLoaded, getBytesTotal), and sometimes the load gets stuck, and actualy is never loaded. (onLoad is never called back) The percent loaded varies between 15 and 45. The getBytestotal is returning a valid number.
I have tried to set a number of retry to load the jppg when the loadVars object had not loaded for more than x seconds, but the retry is NEVER successful.
I have therefore increase the time I allow to loadVars object to be "loaded" to 10 seconds, but it seems that it always gets stuck after just a second and giving 10 second does not make any difference.
What could be the reason for that?
It seems to be happening more on the mac than the pc, and more on mozilla than safari on the mac, more mozilla than ie on the pc.
I read about loadVars failing loading jpg on "aol" browser, whatever that is, for a mimeType reason(???). Is that relevant ?
Thank in advance for your advices.
BTW: worst yet, sometime I have to reload my page quite a few time to see the Flash showing up? Could that be part of the same problem?
geraldine
Can We Add A Listener To A LoadVars Object?
Hi im dynamically loading an external text file into a text field infoLoader_txt on stage..while it is loading i want the percentage loaded to show in the text field load_txt ...but for some reason its not showing..in fact trace(myLV_lv.getBytesTotal()); shows undefined ...does anyone know whats going on here? Is there a better way to do this..for example can we add a listener to the loadVars object? Thanks for your help in advance
Code:
var myLV_lv:LoadVars = new LoadVars();
myLV_lv.load("information/aboutme/about.txt");
loadStuff();
function loadStuff():Void{
_root.onEnterFrame = function():Void{
load_txt.text = (myLV_lv.getBytesLoaded()/myLV_lv.getBytesTotal())*100;
trace(myLV_lv.getBytesLoaded());
trace(myLV_lv.getBytesTotal());
}
}
myLV_lv.onLoad=function(bSuccess:Boolean):Void{
if(bSuccess){
delete _root.onEnterFrame;
infoLoader_txt.text = myLV_lv.info;
}
}
|