all groups > flash actionscript > july 2004 >
You're in the

flash actionscript

group:

Specific actionscript question:



Specific actionscript question: suicidePills
7/10/2004 11:13:57 PM
flash actionscript: I am passing a string such as "movieclip" to the following function:

onClipEvent(load){
function loadContent(section){
loadMovie("movie/"+this[variable]+".swf",this,"GET")
}
}

The function is called with the following actionscript from a button:

on(press){
_root.movieClipWithFunction("movieclip")
}

What SHOULD happen is, a swf file named 'movieclip.swf' which resides in
'/movie' folder should be loaded into '_root.movieClipWithFunction'

The problem is, 'this[variable]' remains undefined. I am guessing there is a
different way to specify the variables in a function when calling them the way
I have above?

Thanks

Re: Specific actionscript question: Jack.
7/11/2004 12:17:47 AM
try opening the scope of the function -

onClipEvent(load){
_global.loadContent = function(section){
this.loadMovie("movie/"+section+".swf");
}
}

on(press){ loadContent("movieclip"); }

hth
Re: Specific actionscript question: suicidePills
7/11/2004 1:48:07 AM
Yes, I found that switching "this[section]" to "+section+" worked just fine

thanks for the help

AddThis Social Bookmark Button