void CFlashUIEventNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo )
{
	switch (event)
	{
	case eFE_Initialize:
	{
		pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, true);
		m_events.clear();
		m_events.init( pActInfo->pGraph );
		ClearListener();
		m_iCurrInstanceId = GetPortInt(pActInfo, eI_InstanceID);
		if (m_iCurrInstanceId < -1)
			m_iCurrInstanceId = -1;

		SPerInstanceCall0 caller;
		caller.Execute(m_pElement, m_iCurrInstanceId, functor(*this, &CFlashUIEventNode::RegisterAsListener));
	}
	break;
	case eFE_Activate:
		if (IsPortActive( pActInfo, eI_InstanceID ))
		{
			m_iCurrInstanceId = GetPortInt(pActInfo, eI_InstanceID);
			if (m_iCurrInstanceId < -1)
				m_iCurrInstanceId = -1;
			ClearListener();

			SPerInstanceCall0 caller;
			caller.Execute(m_pElement, m_iCurrInstanceId, functor(*this, &CFlashUIEventNode::RegisterAsListener));
		}
		break;
	case eFE_Update:
		FlushNextEvent( pActInfo );
		break;
	}
}
void CFlashUIElementInstanceNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo )
{
	switch (event)
	{
	case eFE_Initialize:
		pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, true);
		m_events.clear();
		m_events.init( pActInfo->pGraph );
		if (GetElement()) GetElement()->RemoveEventListener(this);
		UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
		if (GetElement()) GetElement()->AddEventListener(this, "CFlashUIElementInstanceNode");
		break;
	case eFE_Activate:
		if (IsPortActive( pActInfo, eI_InstanceID ) || IsPortActive( pActInfo, eI_UIElement ))
		{
			if (GetElement()) GetElement()->RemoveEventListener(this);
			UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
			if (GetElement()) GetElement()->AddEventListener(this, "CFlashUIElementInstanceNode");
		}
		if (IsPortActive( pActInfo, eI_DestroyInstance ))
		{
			const int         instanceId = GetPortInt(pActInfo, eI_InstanceID);
			SPerInstanceCall0 caller;
			caller.Execute(GetElement(), instanceId, functor(*this, &CFlashUIElementInstanceNode::DestroyInstance));
		}
		break;
	case eFE_Update:
		FlushNextEvent(pActInfo);
		break;
	}
}
void CFlashUIDisplayNode::ProcessEvent( EFlowEvent event,SActivationInfo *pActInfo )
{
    if ( event == eFE_Initialize )
    {
        UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
    }
    else if ( event == eFE_Activate )
    {
        if ( IsPortActive( pActInfo, eI_UIElement ) )
        {
            UpdateUIElement( GetPortString( pActInfo, eI_UIElement ), pActInfo );
        }

        const int instanceId = GetPortInt( pActInfo, eI_InstanceID );

        if ( IsPortActive( pActInfo, eI_Show ) )
        {
            SPerInstanceCall1< bool > caller;
            caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIDisplayNode::SetVisible), true);
            ActivateOutput( pActInfo, eO_OnShow, true );
        }

        if ( IsPortActive( pActInfo, eI_Hide ) )
        {
            SPerInstanceCall1< bool > caller;
            caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIDisplayNode::SetVisible), false);
            ActivateOutput( pActInfo, eO_OnHide, true );
        }

        if ( IsPortActive( pActInfo, eI_Unload ) )
        {
            SPerInstanceCall0 caller;
            caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIDisplayNode::Unload));
            ActivateOutput( pActInfo, eO_OnUnload, true );
        }

        if ( IsPortActive( pActInfo, eI_RequestHide ) )
        {
            SPerInstanceCall0 caller;
            caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIDisplayNode::RequestHide));
            ActivateOutput( pActInfo, eO_OnRequestHide, true );
        }

        if ( IsPortActive( pActInfo, eI_Init ) )
        {
            SPerInstanceCall0 caller;
            caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIDisplayNode::Init));
            ActivateOutput( pActInfo, eO_OnInit, true );
        }

        if ( IsPortActive( pActInfo, eI_Reload ) )
        {
            SPerInstanceCall0 caller;
            caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIDisplayNode::Reload));
            ActivateOutput( pActInfo, eO_OnReload, true );
        }

        if ( IsPortActive( pActInfo, eI_UnloadBootstrapper ) )
        {
            if (GetElement()) GetElement()->UnloadBootStrapper();
            ActivateOutput( pActInfo, eO_OnUnloadBootstrapper, true );
        }

        if ( IsPortActive( pActInfo, eI_ReloadBootstrapper ) )
        {
            if (GetElement()) GetElement()->ReloadBootStrapper();
            ActivateOutput( pActInfo, eO_OnReloadBootstrapper, true );
        }
    }
}