Add, Count, and Remove Flex Applications in the Flex Launcher
Source code
'This example opens UFT with the Web and Flex add-ins and specifies some Flex applications to open.
'It then uses the Count, Item, and Remove methods to determine how many applications are defined and removes all
'applications except the first application.

'This example assumes that there is no unsaved test currently open in UFT.
'For more information, see the example for the Test.SaveAs method.
Dim qtApp 'As QuickTest.Application ' Declare the application object variable
Set qtApp = CreateObject("QuickTest.Application") ' Create the application object

qtApp.SetActiveAddins Array("Flex", "Web") 'Load the Flex and Web Add-ins
qtApp.Launch ' Start UFT
qtApp.Visible = True ' Make the UFT application visible
qtApp.Test.Settings.Launchers("Flex").Active = True ' Instruct UFT to open specified Flex applications when a record or run session begins

Set flexApps = qtApp.Test.Settings.Launchers("Flex").Applications
HostApplicationTypeValue = 2
flexApps.AddApplicationInFlashPlayer "DummySWF0.swf"
flexApps.AddApplicationInIE32 "DummySWF2.swf"
flexApps.AddApplicationInFlashPlayerWithRuntimeLoader "DummySWF1.swf"

If flexApps.Count > 1 Then
 Set list = CreateObject("System.Collections.ArrayList")
 For Each Iterator In flexApps
  If Iterator.HostApplicationType = HostApplicationTypeValue Then
   list.Add Iterator
  End If

 For Each i in list
  flexApps.Remove i
End If

Set qtApp = Nothing 'Release the Application object