Test de code AS 2
by Martin Arvisais | septembre 9, 2005 | In Uncategorized | No Comments
Petit test pour essayer une petite trouvaille, un surligneur de code AS 2.0 en flash!
[ftf w="325" h="500"]import com.ss.workflowTools.FlowAbstract;
import mx.remoting.debug.NetDebug;
import com.ss.exception.*;
class com.ss.workflowTools.WorkflowManager extends com.ss.generic.Generic implements com.ss.workflowTools.WorkflowManagerInterface
{
private var _aFlows:Array;
public var className:String = “WorkflowManager”;
public function addElement(refFlow:FlowAbstract):Void
{
if(_aFlows == undefined){ _aFlows= new Array(); }
_aFlows.push(refFlow);
}
public function removeElement(Void):Void
{
if(getLength() > 0)
{
_aFlows[0].removeEventListener(“onFlowComplete”,this);
_aFlows.shift(); ;
}
}
public function removeAllElement(Void):Void
{
delete _aFlows;
}
public function exec(Void):Void
{
_aFlows[0].addEventListener (“onFlowComplete”, this);
try
{
_aFlows[0].exec();
}
catch(e:Error)
{
trace(“ERROR FOUND”);
switch(e.nLevel)
{
case 1:
// CAN LOG
NetDebug.trace(“>ERROR LEVEL 1 from WF_Manager on execution flow >>> “+ e.toString());
break;
}
}
}
private function onFlowComplete(Void):Void
{
removeElement();
if (getLength() > 0 ){ exec(); }
if(getLength() == 0)
{
delete _aFlows;
dispatchEvent ({type : “onWorkFlowComplete”,target:this})
}
}
public function getLength(Void):Number
{
return _aFlows.length;
}
}
[/ftf]


