C# to SWF Flash Compiler


  快乐,是知识的源泉,知识,是学习的动力。学习是成功的基础。成功是money的条件。 本博客的文章出特殊说明外均为网络所来,仅供学习,其著作版权归原作者所有。
  
  ArcGIS Object
  
  ArcGIS Desktop
  
  ArcGIS Engine
  
  ArcGIS IMS
  
  ArcGIS MO
  
  ArcGIS Pad
  
  ArcGIS SDE
  
  ArcGIS Server
  
  asp.net 
  
  Bing Map 
  
  C# 
  
  Delphi 
  
  Eclipse 
  
  F#
  
  Google Map
  
  Java 
  
  Mapx
  
  MapxMobile
  
  Mapxtreme
  
  MapxTreme for Java
  
  Netbeans 
  
  Oracle
  
  Silver Light
  
  SQL server
  
  Tomcat
  
  Unix linux
  
  VB 
  
  VC 
  
  windows 
  
  嵌入式开发
  
  软件测试
  Today I came across GOA WinForms for Adobe Flash, which allows you to write C# code in Visual Studio 2005 and compile it into a Flash SWF file. I was quite impressed, having been a C# web developer for some time now I thought this is great way to create Flash applications without having to become an expert at Flash or Flex. I have always found it difficult to get my head round the Adode interface for creating flash applications. I downloaded and installed the free version of GOA WinForms for Adobe Flash. GOA WinForms for Adobe Flash is promoted as: "GOA WinForms is an implementation of the standard System.Windows.Form .NET library for both Adobe Flash and Microsoft Silverlight. It allows .NET developers to write standard WinForms applications that will run on these two RIA platforms." There are over 40 samples that can be found in the folder C:\Program Files\NETiKA\GOA WinForms for Flash\samples. I had a good look through the samples; there are plenty of samples to start you off. I tried creating a simple application of my own. Initially it's easy to forget you are writing code that will be compiled into flash rather than a fully fledged desktop application. I quickly noticed that not all of the System.Windows.Form namespace is implemented, just the bits that relate to what can be done in flash. You still have all of the restrictions of flash. GOA WinForms for Adobe Flash cannot be used with the Visual Studio debugger, this is due to Visual Studio not having access to what is happening inside of the flash SWF. Sample Hello World: id="swfapp" classid="clsid:D27CDB6E-AE6D-11CF-96B8-44455354000 0" width="300" height="100" codebase="http://download.macromedia.com/pub/shock wave/cabs/flash/swflash.cab#version=8,0,22,0" align="center">The sample loads the text from a flash parameter. It was quite straight forward to create. The compiled SWF file is quite large at 89KB I would expect only a few KB for this sort of thing in flash. Sample C# Code: using System; 
  using System.Drawing; 
  using System.Collections; 
  using System.ComponentModel; 
  using System.Windows.Forms; 
  namespace GOAApplicationStarter 
  { 
  public class MyForm : System.Windows.Forms.Form 
  { 
  Label label1; 
  private System.ComponentModel.Container components = null; 
  public MyForm() 
  { 
  InitializeComponent(); 
  } 
  private string GetParam(string name, string defaultValue) 
  { 
  AppDomain domain = AppDomain.CurrentDomain; 
  string paramValue = (string)domain.Parameters[name]; 
  if (paramValue == null) 
  { 
  return defaultValue; 
  } 
  return paramValue;    
  } 
  protected override void Dispose(bool disposing) 
  { 
  if (disposing) 
  { 
  if (components != null) 
  { 
  components.Dispose(); 
  } 
  } 
  base.Dispose(disposing); 
  } 
  private void InitializeComponent() 
  { 
  SuspendLayout(); 
  this.label1 = new System.Windows.Forms.Label(); 
  this.label1.Location = new System.Drawing.Point(10, 0); 
  this.label1.Width = 280; 
  this.label1.Height = 100; 
  this.label1.Font =  new System.Drawing.Font(this.label1.Font.FontFamily, 25 ); 
  this.label1.TextAlign =  System.Drawing.ContentAlignment.MiddleLeft; 
  this.label1.Text = GetParam("label", "..."); 
  this.Controls.Add(label1); 
  this.BackColor = Color.Lime; 
  ResumeLayout(false); 
  } 
  public static void Main() 
  { 
  Application.Run(new MyForm()); 
  } 
  }  }   
  I do think GOA WinForms for Adobe Flash is defiantly a tool for a specific purpose. It takes some tasks, like animation, that flash is good at and makes then difficult. A lot of tasks can more easily be achieved using Adobe Flash or HTML and AJAX or perhaps even Silverlight. I think in general flash is best saved for interactive components in a web site such as the nice charts in Google Analytics rather than full websites. 

猜你喜欢

转载自xu162xu.iteye.com/blog/1574356
今日推荐