# AHHH! Can't Concatenate!

**URL:** <https://forum.kirupa.com/t/ahhh-cant-concatenate/13937>\
**Category:** flash\
**Created:** [February 20, 2003, 1:24am UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937 "2003-02-20T01:24:32Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Random\_Hero](https://avatars.discourse-cdn.com/v4/letter/r/2acd7d/32.png) [@Random\_Hero](https://forum.kirupa.com/u/Random_Hero)\
**Post date:** [February 20, 2003, 1:24am UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/1 "2003-02-20T01:24:32Z")

</div>

ok, I have some variables, and I’ve tried nine ways to sunday to get them to load.

Here’s what I’ve got…

loadVariablesNum(“reader.txt”, 0);

this[client + newline + address + newline + city + ", " + state + " " + zip] = “business”;

// loads text into fields, creates new field based on store name & address

I’ve also tried this…

this[client + newline + address + newline + city + ", " + state + " " + zip] = business;

and this…

business = client + newline + address + newline + city + ", " + state + " " + zip;

and this…

business = “” add(client + newline + address + newline + city + ", " + state + " " + zip);

and a million other varients…

HELP, PLEASE…I’M GOING MAD! 😱

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 2:16am UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/2 "2003-02-20T02:16:16Z")

</div>

you’re quite confused

First things first:  
what is your text file?  
what do you want to do with its contents?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 2:19am UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/3 "2003-02-20T02:19:21Z")

</div>

exerpt from text file…

&client=B. Atman  
&address=500 West Batcave Road  
&city=Gotham  
&state=NY  
&zip=99412

I want to load the variables into a single variable, which is then dumped into a multiline dynamic text field.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 2:25am UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/4 "2003-02-20T02:25:59Z")

</div>

the end hope is to have all the variables go into the “business” variable, like so…

```auto
business = (B. Atman) + newline + (500 West Batcave Road) + newline + (Gotham) + ", " + (NY) + " " + (99412)

```

and will show up in the dynamic text field like this…

\<center\>B. Atman\<br\>500 West Batcave Road\<br\>Gotham, NY 99412\</center\>

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 2:49am UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/5 "2003-02-20T02:49:49Z")

</div>

1. Your variables in the textfield will each contain a newline when loaded into flash. To prevent this, keep them all on one line or do this

&client=B. Atman&  
&address=500 West Batcave Road&  
&city=Gotham&  
&state=NY&  
&zip=99412&

1. Your using MX so make use of the LoadVars object. This will let you load your variables into this one object and be able to access them from that.

Because you are LOADing variables in from an external source, the variables wont be loaded right away meaning you will NOT be able to access them directly after you call the variable loading command. You’ll have to wait a little while until they’re fully loaded into Flash. A LoadVars object helps us here with its onload. Heres an example:

```auto

identity = new LoadVars()
identity.onLoad = function(){
	business = this.client +"
"+ this.address +"
"+ this.city +", "+ this.state +" "+ this.zip;
}
identity.load("reader.txt");

```

This makes a loadVars instance called “identity” where the variables of the text file are loaded (from the load command) when loaded, the onLoad function is called and all those variables are put into the business variable in that format you specified. Now, assuming you have a dynamic textfield on the stage (pre-centered) with a VAR set to be business, it will then correctly display the name and address appropriately once the variables have successfully loaded into flash.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 2:58am UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/6 "2003-02-20T02:58:45Z")

</div>

```auto
variable = "business",
    text = "B. Atman\r500 West Batcave Road\rGotham\r, NY\r 99412",

```

Ok, that’s what the variable says now, but what appears on the screen is this…

\<center\>  
B. Atman

500 West Batcave Road

Gotham  
\</center\>

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 3:03am UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/7 "2003-02-20T03:03:05Z")

</div>

Before you flame my obvious stupidity, I know I forgot the &…fixing now…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 3:06am UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/8 "2003-02-20T03:06:44Z")

</div>

Extremely sweet…worked like a charm. I’ve got to send you a cookie. Ok, where exactly did my thinking turn south on this one? I was about to try to load them all into an array and try that, but…I’m babbling. Thanks again…I’m not worthy, etc.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 9:28am UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/9 "2003-02-20T09:28:23Z")

</div>

ok, sorry to beat a dead dog, but I want to see what you think…

any way to get out of putting the & on the data?

here’s what I’ve got, and, of course, it doesn’t work…(NOTE: \* added to prevent the board from messing with the code)

the text file…

```auto

color=#B50102
&font=Impact

&email=bman@thecave.com
&ephrs=Email the Cave!

&wsite=http://www.waynemanor.com/deepdarkcave
&sphrs=View Web Site!

&numbr=1 (800) BAT-CALL
&clint=B. Atman
&addrs=500 West Batcave Road
&hcity=Gotham
&hstat=NY
&zpcde=99412

&pctag=<*p align='center'>&
&ahtag=<*a href='&
&mttag=*mailto:&
&ittag=<*i>&
&cltag=*&' target='_blank'>&
&catag=&<*/a>&
&cctag=&<*/p>
&citag=&<*/i>&
&cftag=<*/font>&
&fopen=<*font color='&
&fmidl=&' style='&
&fclse=&'>&
&bdaid=&

```

the flash file…

```auto

identity = new LoadVars()
identity.onLoad = function(){
	business = pctag + fopen + color + fmidl + font + fclse + citag + clint + bdaid + "/n" + bdaid + hcity + ", " + state + " " + zpcde + citag + cftag + cctag
}
identity.load("bman.txt");

```

tried this too, with no avail…

```auto

identity = new LoadVars()
identity.onLoad = function(){
	business = "<*p align='center'><*font color'&" + color + "&' style='&" + font + "&'>&" + ittag + "&" + clint + "&" + citag + "&<*/font></p>"
}
identity.load("bman.txt");

```

where am I messing up, or is it a point of where to start?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 11:49am UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/10 "2003-02-20T11:49:33Z")

</div>

1. ditch the html tags in the loaded variables. Thats unnecessary. You can add them in flash. str = “\< **i\>" + a + "\<** /i\>”;

2. the only way of getting out of not using the & at the end is by either putting all the variables on one line (as I mentioned before) or stripping the  
and \r tags off (removing them from) the variables once they are loaded into flash.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 11:51am UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/11 "2003-02-20T11:51:36Z")

</div>

I wanted to be able to dynamically change the color of the text as well as the font style, that’s why I’m trying to make the ramshackle code.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 1:28pm UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/12 "2003-02-20T13:28:55Z")

</div>

If anyone else can help me on this one, I’d appreciate it.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 2:42pm UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/13 "2003-02-20T14:42:02Z")

</div>

Hey sen, how would you add Html tags to the flash string?

for example how would you bold “You are about to send this message”

```auto

message2send = "Hallo " + sender_name + " !" + Newline + " You are about to send this message: " + Newline + message + Newline + "Your E-mail is: " + Newline + sender_email;

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 2:48pm UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/14 "2003-02-20T14:48:19Z")

</div>

Know it wasn’t for me, but here you go anyway.

message2send = “Hallo " + sender\_name + " !” + Newline + " You are about to send this message: " + Newline + message + Newline + “\<_b\>" + "Your E-mail is: " + Newline + sender\_email + "\<_/b\>”;

remove \*, of course.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 2:50pm UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/15 "2003-02-20T14:50:28Z")

</div>

i dont see any changed to the code i gave you??

::: i take that back, lol, went too early to the post lol, thanx dude 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 2:57pm UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/16 "2003-02-20T14:57:20Z")

</div>

its including the html tags in the flash movie, ?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 3:10pm UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/17 "2003-02-20T15:10:22Z")

</div>

in the onLoad you have to use this. to preceed the variables (see my first example)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2003, 3:15pm UTC](https://forum.kirupa.com/t/ahhh-cant-concatenate/13937/18 "2003-02-20T15:15:44Z")

</div>

you also need to escape your “=” in the text file, otherwise flash will try to make a variable out of it (or something)

= should be %3D
