PDA

View Full Version : can't concatinating 2 simple strings


ccarpo
03-02-2005, 12:27 AM
I'm a experienced programmer but new to flash & Macromedia...
When I try to run this script it just outputs "0" I was searching several hours on many sites ind pdfs but still haven't any idea what I'm doing wrong :(


_root.one:String = "one";
_root.two:String = "twooo";
trace(_root.one + _root.two);

Result: 0

It's the same without ':String' and the same with

_root.three = _root.one + _root.two;
trace(_root.three);


I'm using Flash MX 2004 Prof (Trial version)
Thnx for helping with such a stupid thing :-/

Xeef
03-02-2005, 12:39 AM
hi and welcome to As.Org

Hmmm i woud by supriced when you not get an error in the first version
type declarations dosen't working whit "."
eg
_root.a:String="q" will give an error
var _root.b:String ="Q" also
corect use
var b:String="Q"

_root.one = "one";
_root.two = "twooo";
trace(_root.one+_root.two);//out put "onetwooo"

ccarpo
03-02-2005, 01:06 AM
Thnx for the nice welcome and the fast answer :)

but with your hint it's the same result: 0
when I try this (Control -> Test Movie)

var one = "one";
var two = "twooo";
trace(one+two);

or this

var one:String = "one";
var two:String = "twooo";
trace(one+two);

I get

**Error** Scene=Szene 1, layer=Ebene 1, frame=1:Line 2: You must export your movie as Flash 5 to use this action.
var one = "one";


And I am as helpless as before :)

Xeef
03-02-2005, 01:37 AM
i just COPY & PASTE this

var one:String = "one";
var two:String = "twooo";
trace(one+two);

and it's working !!!

ccarpo
03-02-2005, 11:26 AM
Ok you're it IS working, but not in the .fla file which was handed to me.
Copy & Paste the original .fla into a new one and everything is fine.
Thanks for your help...