Using variables created from "this"

I am trying to select an object and use its path as a varible in flash


c1.c2.onPress =function () {
selected_object  = this
trace(selected_object)
selected_object = selected_object.substr(0, 2)
trace(selected_object)
}

The 1st trace command yields the full path, but the second trace command yields an “undefined”. This problem seems to exist all over, if I use the variable from “selected_objcet = this” for any thing it does not work unless I but “” around it - this of course, does not solve the problem.

Another way to point out the problem, if I do a comparison check in flash with the variable created from “this” I get:

c1.c2.onPress =function () {
selected_object = this
selected_object == c1.c2 <------- False in flash
selected_object == “c1.c2” <------- True in flash
}

Is there a way around this problem?