PDA

View Full Version : function call keeps returning undefined !?



RedSox
October 3rd, 2004, 09:23 AM
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!

Aulumpiter
October 3rd, 2004, 10:35 AM
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);

RedSox
October 3rd, 2004, 10:59 AM
Ah, see what you mean...let me give that a try :) Thanks!