Function calls
- Started
- Last post
- 7 Responses
- ********
if I want to call a function in actionscript called intro3
becase a certain variable =3how do i do that?
- maximillion_0
so you could have intro2 or intro1 as functions??
assuming they all have diff functionality then you could have a "master" function with individual functions inside it then pass the number as an argument with a switch statement calling the individual functions
- ********0
i'm trying to seperate stuff as need to make obvious for who i'm delivering the stuff for...
worked it out... an eval and then put () after it...
think i tried everything but...
- maximillion_0
try this then, works with vars but ive not tried it woth functions
_root["intro"+id](){
}or
_global["intro"+id](){
}there needs to be something on the left hand side for it to eval, thus the reasons for _root or _global
- mac100
try make a second function
function introPicker(intro_id){
if(intro_id == 1){
intro1();
}if(intro_id == 2){
intro2();
}if(intro_id == 3){
intro3();
}}
introPicker();
if not try eval again
function introPicker(intro_id){
eval("intro"+intro+"();")
}hope this helps
Mac
- ********0
"hey intro1, you function!"
that's how real men do it.
- mac100
sorry the eval bit should have been
eval("intro"+intro_id+" ();")
you call the function like this
introPicker(2);
- ********0
cheers you lot... ding it like this...
initCaller = eval("init"+menuMode);
initCaller();