Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Flash - ActionScript

construct Array name dynamically / Part4

 
Jump to:  
 
luciewong
PostPosted: Sun Aug 31, 2008 11:24 am    Post subject: construct Array name dynamically / Part4
       
part 4>
the code line in Part 3 / line above (contains(un.....(this["colName"]));

Quote:
(un... ,,should be the word >even again I cannot write it / so I try [ its
the opposite of "escape"] < was not accepted / is a censored word

very funny guys / but not my fault

so I continue with my code, what a time waste

var noAmp:String = realString.split(amp).join("&").toString();
var theColumn:String = noAmp;//.toString();

Above works, I get now for ex. a column name like > "Art >ampersand< Design"<

but my Array construction as before does not work anymore>

_root[theTable+[theColumn]+"_array"] = new Array();//< returns undefined<<<<

the Array would look like:

_root["GaleriesArt >ampersand< Design_array"] = new Array();

How can I construct the Array name including the >ampersand< wow??

Really appreciate your help and thanks for your patience, blame Adobe.
Thanks
 

 
kglad
PostPosted: Mon Sep 01, 2008 6:33 am    Post subject: Re: construct Array name dynamically / Part4
       
you can't have an ampersand in a variable or object name.
 

 
luciewong
PostPosted: Mon Sep 01, 2008 12:28 pm    Post subject: Re: construct Array name dynamically / Part4
       
Hi kglad,
unfortunately I must have it, bec data comes from a Client DB, and they have
Quote:
ampersands< in column names and in Field values.
I've got it to work with the code below.


All the code is included in the LV (success){

var zi:Number = 0;//

while(zi<recsT){ //<no of columns<

var amp = "&";
var realString:String = new String(un..>censored
word<,,,escape(this["cName"+zi]));
var noAmp:String = realString.split(amp).join("&").toString();

var thecolName:String = noAmp;
col_array.push(thecolName);//I have now a array with all column names (some
also include "&")

var colName:String = thecolName.toString();//not sure if necc.

//<I construct now new different arrays for each column 1 including "&" in the
name
_root[Table+colName+"_array"] = new Array();

zi = zi+1;
}


//in the new created arrays I wonna have now the values/all values in 1
column/then the next>

for(var xb:Number = 0;xb<recsT;xb++){ //<<the no of columns<
var theName:String = col_array[xb].toString();

var dd:Number = 0;
while(dd<recsNo){ //<how many recs[rows/pages] I have for this Table?

_root[Table+[theName]+"_array"].push(un...<you know the censored
word>..escape(this[theName+dd]));
dd=dd+1;//
}
}
//end of for

I can now access the dynamic arrays and write out all values, some including
Quote:
&<.

Thank you for your interest and your help
Bye,
Lucie
 

 
kglad
PostPosted: Mon Sep 01, 2008 3:38 pm    Post subject: Re: construct Array name dynamically / Part4
       
there's never a need for having an ampersand as part of a variable name or
object name.

if you need it for a variable value and it (or any other symbol like foreign
language characters and certain other punctuation symbols) is "translated"
after loading from an external source, you can always use split(translated
symbol).join(desired symbol).
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

rolety żaluzje hale namiotowe projektowanie wnętrz zabawki edukacyjne