Page 1 of 1

query regarding f-in-box

Posted: Sat Oct 31, 2009 12:31 pm
by akshay
We are developing an flash application. Flash application has a wrapper swf in which all the other swf are loaded based on the button events. We are also loading sound.swf (for background music) which is loaded using "loadMovieNum" method,
where as other resources such as background images for swf are pulled using xml. We want encrypted flv and swf files to be used in application. Is it possible to show encrypted swf in other wrpaaer swf which is also an encrypted file?
And how to bind these swf files in control?

Posted: Sat Oct 31, 2009 8:26 pm
by Softanics
Thank you for your question.

Yes, it's possible.

At the first, you load your main swf from a stream using PutMovieFromStream:

Code: Select all

f_in_box__control1.PutMovieFromStream(stream);


To handle loading of child resources: xml, swf and so on, use the event OnLoadExternalResourceByRelativePath:

Code: Select all

private void OnLoadExternalResourceByRelativePath(object sender, String strRelativePath, System.IO.Stream Stream, ref bool Handled)   
{   
    System.IO.Stream FromStream = null;   
 
    if (strRelativePath == "images/embedded_image1.jpg")   
        FromStream = this.GetType().Assembly.GetManifestResourceStream
 
    if (FromStream != null)   
    {   
        const int size = 64 * 1024;   
        byte[] buffer = new byte[size];   
        int ReadBytes;   
 
        while ( (ReadBytes = FromStream.Read(buffer, 0, size)) > 0 )   
        {   
            try   
            {   
                Stream.Write(buffer, 0, size);   
            }   
            catch (System.IO.IOException /* e */ )   
            {   
                // Loading is interrupted   
                break;   
            }   
        }   
 
        Stream.Close();   
 
        Handled = true;   
    }   
}   


Thank you.