# Function call keeps returning undefined !?

**URL:** <https://forum.kirupa.com/t/function-call-keeps-returning-undefined/66163>\
**Category:** Uncategorized\
**Created:** [October 3, 2004, 1:23pm UTC](https://forum.kirupa.com/t/function-call-keeps-returning-undefined/66163 "2004-10-03T13:23:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RedSox](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@RedSox](https://forum.kirupa.com/u/RedSox)\
**Post date:** [October 3, 2004, 1:23pm UTC](https://forum.kirupa.com/t/function-call-keeps-returning-undefined/66163/1 "2004-10-03T13:23:30Z")

</div>

This really puzzles me. I have 5 buttons that onRelease (= when clicked) calls the same function with each a different variable.

contentLoader(profile);  
contentLoader(projects);  
and so on.

the function is:  
function contentLoader(sName:String) {  
trace(sName);  
}

Now the trace returns ‘undefined’…what I am doing wrong ? I just do NOT see it anymore 🙂

The idea behind is that I want to use a moviecliploader to load in the content corresponding with the clicked button (projects.swf,  
so it’ll use myMCL.loadClip(sName + “.swf”);

That trick always worked, but like I said, it keeps returning undefined. Did I make a mistake by strict data typing sName as a String ?

Thanks!

---

<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:** [October 3, 2004, 2:35pm UTC](https://forum.kirupa.com/t/function-call-keeps-returning-undefined/66163/2 "2004-10-03T14:35:20Z")

</div>

well did you try wriittin the name like this:  
verify that your variable still a string before reaching the function call.

var profile:String =“the\_name”;  
contentLoader(profile);

---

<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:** [October 3, 2004, 2:59pm UTC](https://forum.kirupa.com/t/function-call-keeps-returning-undefined/66163/3 "2004-10-03T14:59:45Z")

</div>

Ah, see what you mean…let me give that a try 🙂 Thanks!
