I am adding a new version of a custom component to the fla using jsfl.
This prompts the user to choose whether to replace the existing components or not.
If possible, I'd like to respond to this prompt through jsfl.
Thanks.
I am adding a new version of a custom component to the fla using jsfl.
This prompts the user to choose whether to replace the existing components or not.
If possible, I'd like to respond to this prompt through jsfl.
Thanks.
I would write a program (with a delay) to confirm the 'Resolve Library Conflict'-dialog and call it with FLfile.runCommandLine before calling fl.componentsPanel.addItemToDocument. I know how to do this in Windows but not on a Mac.
(In windows the program to confirm the replacement could be:
See Microsoft - Dev Center - Desktop > Samples > Enumerate top level windows fast in C#
using System;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace FlashHack
{
class Program
{
protected delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
protected static extern int GetWindowText(IntPtr hWnd, StringBuilder strText, int maxCount);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
protected static extern int GetWindowTextLength(IntPtr hWnd);
[DllImport("user32.dll")]
protected static extern bool EnumWindows(EnumWindowsProc enumProc, IntPtr lParam);
[DllImport("user32.dll")]
protected static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
internal static extern IntPtr GetParent(IntPtr hwnd);
[DllImport("User32.dll", EntryPoint = "SetForegroundWindow")]
private static extern IntPtr SetForegroundWindowNative(IntPtr hWnd);
protected static bool AnswerResolveLibraryConflictDlg(IntPtr hWnd, IntPtr lParam)
{
int size = GetWindowTextLength(hWnd);
if (size++ > 0 && IsWindowVisible(hWnd))
{
StringBuilder sb = new StringBuilder(size);
GetWindowText(hWnd, sb, size);
if (sb.ToString() == "Resolve Library Conflict")
{
IntPtr parent = GetParent(hWnd);
Console.WriteLine(sb.ToString());
if (parent != null)
{
SetForegroundWindowNative(parent);
SendKeys.SendWait("{TAB} {ENTER}");
}
}
}
return true;
}
static void Main(string[] args)
{
System.Threading.Thread.Sleep(1000); // Must wait for the 'Resolve Library Conflict'-dlg
Console.WriteLine("Now!");
EnumWindows(new EnumWindowsProc(AnswerResolveLibraryConflictDlg), IntPtr.Zero);
}
}
}
And in jsfl this program could be started with:
FLfile.runCommandLine("start ConfirmReplace.exe");
fl.componentsPanel.addItemToDocument( ... );
)