zoukankan      html  css  js  c++  java
  • C# to SWF Flash Compiler

    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-444553540000" width="300" height="100" codebase="http://download.macromedia.com/pub/shockwave/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. 
    Sunday August 17 2008 07:37 p.m.
     
    本文转自:
  • 相关阅读:
    JSON格式解析和libjson使用简介(关于cjson的使用示例)
    我还没死!!微信公众号——自媒体的营销之路
    android应用开发-从设计到实现 3-4 静态原型的状态栏
    一种绝对提高开发水平的方法
    年近30------职业回想与思考
    LeetCode Populating Next Right Pointers in Each Node
    uploadify在火狐下上传不了的解决方式,java版(Spring+SpringMVC+MyBatis)具体解决方式
    struct和typedef struct
    奔五的人学ios:swift竟然没有字符串包括,找个简单的解决方法
    Floyd算法解说
  • 原文地址:https://www.cnblogs.com/googlegis/p/2978910.html
Copyright © 2011-2022 走看看