|
Step by step:
how to use SWF Slide Show Scout library in ASP.NET 2.00 projects with
"registration-free" deployment model (no need to register
DLL on web-server)
You can download the source code of this example here: swfslideshowscout_registration_free_in_asp_net2.zip This example provides a sample code to demonstrate how to use SWF SlideShow Scout library in ASP.NET 2 web-applications projects without registering SWFSlideShowScout.dll file on the web-server (using registration-free mode, this sample is based on an example from Maze Computers ) Create a new web-site project in Visual Studio
Enter name of new web-site and click OK
Right-click on project in Solution Explorer and select "Add Reference" command in popup menu invoked:
Browse for "ASPManifestHelpers.dll" (you can find it in ZIP with sample code) and select it and click OK to add reference:
Then create folder named "SWFSlideShowScout.assembly" by right-clicking on project in Solution Explorer and selecting "New Folder" command:
Type name of the folder "SWFSlideShowScout.assembly" and click OK to create a folder
Now you should add the following files into created folder: SWFSlideShowScout.dll To add files right-click on project in Solution Explorer and select "Add Existing Item" command:
File selection dialog will appear - select SWFSlideShowScout.dll and SWFSlideShowScout.assembly.manifest files (hold CTRL and click on each file to select) and click "Add" button to add files to the project:
Now add webapp.manifest file to the project: right-click on project in Solution Explorer and select "Add Existing Item..." command:
File selection dialog will appear. Select webapp.manifest file and click "Add":
Start project by clicking "Start Debugging" button as shown below:
Visual Studio will suuggest to add new Web.config file. Answer Yes as shown below:
Close Internet Explorer window and switch back to Visual Studio Web.config file will appear in the list of project files: Double click on web.config file
Visual Studio will open editor with Web.config file in it. Add the lines after <system.web> line. So you will see a code like on a screenshot below:
Now add reference to SWFSlideShowScout.dll file by doing the following: right-click on project name and select "Add Reference" command in right-click menu:
Browse /SWFSlideShowScout.assembly/ and select SWFSlideShowScout.dll file and click "OK" button to add reference
Now you will see that 2 new files appear in the list of files for
project:
Finally our web-site project is ready for coding swfslideshow generation using SWFSlideShowScout library! Double click on Default.aspx.cs file in Solution Explorer:
Editor window will appear with "Default.aspx.cs" file in
it
try
{
string path =
Server.MapPath(string.Empty);
//Put user code to initialize the page
here
SlideShow SlideShow;
SlideShow = new SlideShowClass();
// initialize library
SlideShow.InitLibrary("demo", "demo");
SlideShow.BeginSlideShow(320, 240);
// slide #1, show with "stetMosaicLarge"
effect, 1000 msec
SlideShow.AddSlideFromFileName(path +
"\\Slide1.jpg", SlideTransitionEffectType.stetMosaicLarge, 1000);
SlideShow.AddDelay(1000);
// slide #2, show with "stetBlur" effect,
1000 msec
SlideShow.AddSlideFromFileName(path +
"\\Slide2.jpg", SlideTransitionEffectType.stetBlur, 1000);
SlideShow.AddDelay(1000);
// slide #3, show with "stetZoomCircle"
effect, 1000 msec
SlideShow.AddSlideFromFileName(path +
"\\Slide3.jpg", SlideTransitionEffectType.stetZoomCircle, 1000);
SlideShow.AddDelay(1000);
// slide #4, show with "stetLiquid" effect,
1000 msec
SlideShow.AddSlideFromFileName(path +
"\\Slide4.jpg", SlideTransitionEffectType.stetLiquid, 1000);
SlideShow.AddDelay(1000);
// slide #5, show with "stetShuttersBias"
effect , 1000 msec
SlideShow.AddSlideFromFileName(path +
"\\Slide5.jpg", SlideTransitionEffectType.stetShuttersBias, 1000);
SlideShow.AddDelay(2000);
// get size of generated in-memory swf
file
int Size = SlideShow.BinaryImageSize;
// create new buffer with size equal to
generated swf file
byte[] buffer = new byte[Size + 1];
// get in-memory slideshow file as byte
stream
Array MemoryImage = (Array) SlideShow.BinaryImage;
// copy byte stream into buffer
Array.Copy(MemoryImage, buffer, Size);
// clear http output
Response.Clear();
// set the content type to SWF
Response.ContentType = "application/x-shockwave-flash";
// add content type header
Response.AddHeader("Content-Type", "application/x-shockwave-flash");
// set the content disposition
Response.AddHeader("Content-Disposition",
"inline;filename=slideshow.swf");
// write the buffer with swf file to the
output
Response.BinaryWrite(buffer);
Response.End();
}
catch (Exception ex)
{
if (!(ex is ThreadAbortException))
Debug.WriteLine(ex.Message);
}
Press F5 to start web-site project and swfslideshow file will be generated and you'll see swfslideshow generated by your web-site project. Generated swfslideshow document file opened in web page:
You can download the source code of this example here: swfslideshowscout_registration_free_in_asp_net2.zip "Hello, World!" flash slideshow movie generation examples for different programming languages will guide you step by step from the very beginning: |
|
|
Copyright © ByteScout, 2003-2010. Privacy Statement
Microsoft®, Windows®, Windows 2000®, Windows Server®, Windows Vista®, Internet Explorer®, .NET Framework®, ActiveX®, Visual Basic®, Visual C#®, ASP®, ASP.NET®, Excel®, PowerPoint®, are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Adobe®, Flash® and Acrobat® are registered trademarks of Adobe Systems, Incorporated. Mozilla®, Firefox® and the Mozilla and Firefox Logos are registered trademarks of the Mozilla Foundation. Other product names or brandnames used herein are for identification purposes only and might be trademarks or registered trademarks of their respective companies. We disclaim any and all rights to those marks. |
|