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.
     
    本文转自:
  • 相关阅读:
    webpack配置之代码优化
    react组件生命周期
    javascript记住用户名和登录密码
    ajax异步请求原理和过程
    深入理解ajax系列第五篇——进度事件
    ajax多次请求,只执行最后一次的方法
    CentOS6.8下MySQL MHA架构搭建笔记
    HTTP状态码
    什么是 Redis 事务?原理是什么?
    Redis 通讯协议是什么?有什么特点?
  • 原文地址:https://www.cnblogs.com/googlegis/p/2978910.html
Copyright © 2011-2022 走看看