Hi everyone! I'm having trouble with this issue:
function rew(m:MovieClip, f:Function) {
m.onEnterFrame = function() {
var cf:Number = m._currentframe;
var tf:Number = m._totalframes;
if (cf<=tf && cf>1) {
m.gotoAndStop(--cf);
} else if (cf==1) {
m.stop();
if(f) f();
delete m.onEnterFrame;
}
};
}
When I call this function in an action frame it's like this:
rew(targetpath_movieClipName, _root.play);
What I want is that the function I've passed as a parameter works like a
function later in the code. Messy explanation?? OK OK...
Let's see if I can explain better. If I do something like this:
function rew(m:MovieClip, f:String {
m.onEnterFrame = function() {
var cf:Number = m._currentframe;
var tf:Number = m._totalframes;
if (cf<=tf && cf>1) {
m.gotoAndStop(--cf);
} else if (cf==1) {
m.stop();
if(f == "play") play();
delete m.onEnterFrame;
}
};
}
it works perfectly, but I want to call any function and don't wanna have to
make a switch for every kind o function.
Has anyone got it?
Ciao.
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com