Is there a way / I would like to know how to use a variable dynamically. My idea is to have a movieclip calling a function at the same time passing a parameter. The parameter value will then be pass to the function for more script.
How to make use of the function's parameter variable, use its value to execute as instanceName.method with in the function?
Sample Code, I have two movieclip with instance names, box1 and box2. once, any of the movieclip is press, the function will execute.
// movieClip, instance name : box1
on(press){
_root.functionName(this._name);
}
on(release){ stopDrag(); }
- movieClip, instance name : box2, has the same code.
- there identity is being passed to the function through "this._name"
Finally, here is the code for the function. I trace "b" in order to know its value. Added startDrag() to be able to drag the movieclip. "How can I able to trace "--drag "+b while dragging the movieclip?"
Thank you in advance. I have thought of using this code. Is this allowed?
function functionName(b){
trace(b+" selected.");
startDrag(b);
b.onMouseMove = function(){ // <---- please help
trace("--drag "+b);
}
}
The code may look simple and useless :) This is not really the code I am working with. I am just trying to get the proper line to execute onmousemove inside a function.
function functionName(param_var){
object.eventMethod = function () {
// some code here.
}
}
CAN I MAKE USE OF THE PARAMETER VARIABLE AS OBJECT?