Hi,
I have a problem with function(), and it’s bugged me all my day at work (over 7 hours so far :ogre:). I’ve been tearing my hear off trying to solve this, while throwing litres of espresso in me, finally I ended up running to the Kirupa forums for some expert help…
Here’s the deal: I have a function with some variables whereas one of them calls yet another variable. And that’s where my code fails. Below is the code (simplified), along with some brief explanation to help you through…
menu is the instance name of a ComboBox, and it sends the value “left”. This is proven to make it to the the function by using [COLOR=black]trace. The problem also occurs when replacing the ComboBox with for example an input text box. It seems to fail each time I don’t directly give the variable a value…[/COLOR]
Now: :ub:
The button:
on (release) {
myFunction(myMovieClip, 20, menu.value);
}
The actions layer:
myFunction = function(mc, alpha, align) {
mc._alpha = alpha;
align(mc);
trace(align); [COLOR=red]//this outputs left <-- ![/COLOR]
}
left = function(mc) {
mc._x = mc._width/2*-1;
mc._y = 0;
}
This does not work, even though it traces “left”, :h: however, this works;
on (release) {
myFunction(myMovieClip, 20, [COLOR=red]left[/COLOR]);
}
this works, too:
on (release) {
[COLOR=#ff0000]variable[/COLOR] = left;
myFunction(myMovieClip, 20, [COLOR=red]variable[/COLOR]);
}
but this[COLOR=black] doesn’t[/COLOR] work:
on (release) {
menu.value = [COLOR=red]variable[/COLOR];
myFunction(myMovieClip, 20, [COLOR=red]variable[/COLOR];);
}
?? :look: ??
Please, before I die of exhaustion =), we’re soon out of espresso at work, too !
If anyone could help in any way, I’d appreciate it aLOT
Thanks!
Peter