;

PDA

Click to See Complete Forum and Search --> : concatenating variables?


mmreed
06-05-2002, 02:29 PM
OK.. in my posting about parsing variables, I learned how to take a variable such as "John Doe" and split it into two variables, "John" and "Doe".

My next attempt is to be able to use these variables in a text paragraph as if they were part of it.

Such as a paragraph that read:

Hello Mr. Doe, I see your first name is John.

can this be done so that the variable fits withing the sentence and spacing is not an issue?

Bob Hartzell
06-05-2002, 02:33 PM
You concatentate strings with a +.

mmreed
06-05-2002, 02:39 PM
Originally posted by Bob Hartzell
You concatentate strings with a +.

In my example, would that mean I need to make an invisible string set?

I am looking to take variable and use them in a paragraph... such as:

The quick "variable1" fox, jumped over the "variable2" dog.

where var1 and 2 are inserted into a sentence. I dont want to have to make Var1="the quick" Var2=color Var3="fox, jumped over the" Var4=adjective Var5="dog."

Thats a ton of slicing text if the paragraph will have many variables.

Is there a way to drop them into a dynamic text paragraph? I know some apps use preceeding code to signify a variable such as:

The quick %$var1 jumped over the %$var2 dog.

and thats all that would be needed to entered.

Can this be done, or can it be an easy to add feature?

johnie
06-05-2002, 03:45 PM
It is already there but simpler...

To do what you are wanting it would simply be:

var3= "the quick "+ var1 + " jumped over the " + var2 + " dog"

It's that simple- this is consitent with ECMA, as is most of the Flash 5 AS Model, BTW.

mmreed
06-05-2002, 03:54 PM
Originally posted by johnie
It is already there but simpler...

To do what you are wanting it would simply be:

var3= "the quick "+ var1 + " jumped over the " + var2 + " dog"

It's that simple- this is consitent with ECMA, as is most of the Flash 5 AS Model, BTW.





So I would assign via action script to var3 the paragraph with the addition of the other variables then make a text box and rename it var3 correct?

Is there a limit to the length this paragraph can be? (within reason)

johnie
06-05-2002, 04:29 PM
From my example that would be correct. You can however use any variable name as long as it is not a restricted as syntax for the AS language.

If you wanted the variable to be named txt1 it would look like this:

txt1= "some text here" + myvar + "Some more text here".

In theory there is no limit to the size of the variable but the Flash Player does have some limits. However, conocating variables into Sentances I don't see how you would reach them.

mmreed
06-05-2002, 04:31 PM
Originally posted by johnie
From my example that would be correct. You can however use any variable name as long as it is not a restricted as syntax for the AS language.

If you wanted the variable to be named txt1 it would look like this:

txt1= "some text here" + myvar + "Some more text here".

In theory there is no limit to the size of the variable but the Flash Player does have some limits. However, conocating variables into Sentances I don't see how you would reach them.



Ok... next question... now that we have that behind us... is there a way to load an image as a variable and do so from a end user's pc using a browse button?

For example... if I had an INSERT YOUR PHOTOGRAPH where the user could load his picture into a variable for use in the flash movie?

johnie
06-05-2002, 05:06 PM
With the Flash 6 Player you can use Load Movie on JPG Images and MP3 Sounds. It works just like loading in a SWF. With this said it is also possible to use a variable in place of a URL in Load Movie however the User would have to know the Full Path Name... In otherwords this isn't overly pratical as most user will not be able to grasp the fact that you can specify a path on a local machine the same as a url- at least with Windows you can by designating the File:/// protocal.

There are projector enhancement tools and enhanced projectors that would allow this with a projector file but an unehanced projector would not fair very well.