I guess what you want to do is initialize this in C #, and not in Flash itself. This can be done, but there are limitations to this (for example, you may get strange security issues). Another caveat is only testing on VS 2010 / Flash 10, but it should work in any version in theory.
Well, let's say you used a standard mechanism to put the flash controls on the form. Also add the flash file that you want to use for the resources (or the built-in byte array, up to you).
Then use the following code to download the flash file.
private void InitFlashMovie(AxShockwaveFlash flashObj, byte[] swfFile)
{
using (MemoryStream stm = new MemoryStream())
{
using (BinaryWriter writer = new BinaryWriter(stm))
{
writer.Write(8 + swfFile.Length);
writer.Write(0x55665566);
writer.Write(swfFile.Length);
writer.Write(swfFile);
stm.Seek(0, SeekOrigin.Begin);
flashObj.OcxState = new AxHost.State(stm, 1, false, null);
}
}
}
Pass the flash object of the form and an array of bytes containing the loaded flash file, and it should work.
source
share