# Converting Data Type Problem

**URL:** <https://forum.kirupa.com/t/converting-data-type-problem/64471>\
**Category:** flash\
**Created:** [September 16, 2004, 4:38pm UTC](https://forum.kirupa.com/t/converting-data-type-problem/64471 "2004-09-16T16:38:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![asylum24](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@asylum24](https://forum.kirupa.com/u/asylum24)\
**Post date:** [September 16, 2004, 4:38pm UTC](https://forum.kirupa.com/t/converting-data-type-problem/64471/1 "2004-09-16T16:38:53Z")

</div>

So I’m importing this file called tbox.txt and in that file it has a variable, num, which equals 3. Now when I run the debug window, it comes back as num = “3”. So its a string. so I do num=num-0 to make it a number instead of a string. And it doesn’t work so I do a trace on num and it comes back as undefined… which is what I dont understand, how can it be “3” and undefined at the same time… please help…

---

<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:** [September 16, 2004, 5:24pm UTC](https://forum.kirupa.com/t/converting-data-type-problem/64471/2 "2004-09-16T17:24:44Z")

</div>

just use Number()

---

<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:** [September 16, 2004, 5:25pm UTC](https://forum.kirupa.com/t/converting-data-type-problem/64471/3 "2004-09-16T17:25:36Z")

</div>

newNum=Number(num);

---

<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:** [September 16, 2004, 6:53pm UTC](https://forum.kirupa.com/t/converting-data-type-problem/64471/4 "2004-09-16T18:53:50Z")

</div>

I tried those, but the problem is still the same, its undefined so its like its not getting anything imported in the first place, all though debug says I am.

---

<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:** [September 17, 2004, 8:34am UTC](https://forum.kirupa.com/t/converting-data-type-problem/64471/5 "2004-09-17T08:34:36Z")

</div>

Are you sure Vars are fully loaded when tracing?

```auto

myLoadVars.onLoad = function(success){
   if(success){
      trace(Number(this.num));
   }
}

```
