var S:MouseEvent = new MouseEvent(MouseEvent.CLICK);
ff(S);//does runfunction ff(e:MouseEvent):void{trace("ok")}stage.addEventListener(S.type, ff);
I know you were using that code as an example, but is there any time in a project that you would actually use that code? It seems to me like that would be quite a reduntant way of doing things.
__________________ JynxStudio
"Knowledge is power."
"Show no fear in the face of adversity." Please use the [ as ][ /as ] tags for your code.
Yes I do use some of that sometimes but anyway it's just good to know we can do that. A good example could be dispatching event. You could have a method checking which event you need to dispatch and pass that to your dispatcher as in:
ActionScript Code:
dispatchEvent(getEvent());
Where the getEvent method would return the event:
ActionScript Code:
privatefunction getEvent():Event{//check which event you needreturn//whatever}
So i managed to fix most of my problems by simplifying what I needed to do all the way down to just a few trace statements and it seems like some of my functions either aren't being called or they are not doing what I need them to do. I think its more that they are being called but what I am having them do is not actually taking place. Meaning... they are returning their strings but are not producing my trace statements. Any thoughts?
"Main Script"
ActionScript Code:
package {import flash.events.*;
import flash.display.*;
//public class interfaceSCRIPT is an extension of a movie clip and is implementing the ITest interfacepublicclass interfaceSCRIPT extendsMovieClipimplements ITest {//creates variable var1 and provides it with the string "tracer"var var1:String = newString("tracer");
publicfunction interfaceSCRIPT (){//trace statement to show this function is being called and runs testFunct() functiontrace("--");
testFunct ();
}//function implemented by the ITest interfacepublicfunction testFunct ():String{
var1 = "trace++";
return var1;
trace(var1);
}}}
Nevermind I figured it out. I can't run a trace statement from withing the interface function because the function is returning a value and not being actually "run" like other functions. Traced the var1 from within the main script and it showed the value assigned to it from within the interface function.
Sorry I didn't check your code before but the reason the trace wasn't working is because it was placed after the return statement which not only returns a value but also terminate the execution of the current method code.