PDA

View Full Version : [any] Newbie question, calling functions from vars


Loque
02-07-2006, 11:41 AM
Hey all,

Just wondering how/if it is possible to do this in anyway;


function finale(){
finalFunc = "section" + _root.selectedSection
finalFunc();
}
_root.selectedSection = 1
finale();

function section1(){trace("moo")}
function section2(){}
I know what i am doing is wrong, just not sure how i would go about doing it. Im such an amateur :|

Many thanks!
L

Loque
02-07-2006, 12:47 PM
Godbless the people i work with;


function finale(){
finalFunc = _root["section" + _root.selectedSection]
finalFunc();
}
_root.selectedSection = 1
finale();

function section1(){trace("moo")}
function section2(){}