Feeds:
Posts
Comments

Archive for the ‘Tutorials’ Category

Our team uses Neutron inside our main product ReviewBasics. That is a really big Visual Studio 2005 solution (55+ projects), including several Neutron projects. In other words, our team is “building next generation Rich Internet Applications that combine Flash on the front-end and .NET on the server-side”, as the home page of Neutron website says.

Currently our flash front-end uses some quite big 3rd-party AS2 libraries which are referenced to Neutron projects (see the note below). The classes within the libraries participate in code complete operations, so it takes some time for IntelliSense database initialization while the project is loading.

Note: Neutron supports Zip reference feature that allows you to link an external library as a zip file, and Neutron automatically unzips and references classes within.

Actually, such possibilities are not needed for our server-side .NET part of the team. Most of them never touch the AS2.0 code. All they need is to compile this code while rebuilding the entire solution.

Well, that can be easily switched off. To disable IntelliSense database creation on project loading go to ‘Tools’ -> ‘Options’ in the main Visual Studio 2005 menu. Select ‘Projects and Solutions’ -> ‘Neutron Project Settings’ in the appearing Options dialog, and uncheck ‘Enable IntelliSense’ checkbox. Next time the projects will be loaded without IntelliSense initialization phase.

In addition, on this option page you can set the path, where MTASC compiler is located. That can be useful if you want to compile with HAMTASC instead. See How To: Substitute MTASC with HAMTASC tutorial.

Also, you can manage cache directory for ZIP references used in your Neutron project.

Enjoy!

 

~ Dmitry

Advertisements

Read Full Post »

SharpStyle Neutron uses excellent open source ActionScript compiler called MTASC developed by Nicolas Cannasse. Click here to read Comparison with Macromedia ActionScript compiler. But if you are an advanced ActionScript developer, you might also be familiar with HAMTASC. SharpStyle Neutron makes it very easy to substitute one compiler with another.

This tutorial will demonstrate how to substitute MTASC with HAMTASC.

Actually, it is very easy in Neutron. There are a few steps to do:

1. Open Hello World sample in Visual Studio 2005 and compile it. As you can see in Output window screenshot below, HelloWorld project has been successfully built with MTASC:

Compilation result in Visual Studio Output window

2. Now let’s substitute MTASC with HAMTASC compiler. You can set the path to the compiler in Visual Studio under Tools -> Options -> Projects and Solutions -> ActionScript Project Settings -> MTASC path. Browse the HAMTASC executable file mtasc.exe and then press OK to apply the changes. 

Tools -> Options -> Projects and Solutions -> ActionScript Project Settings -> MTASC path 

3. Build the project again, but this time with HAMTASC compiler:

Compilation result in Visual Studio Output window

4. As you might know HAMTASC uses some additional compilation options, which can be added to compilation command thanks to Neutron Project Properties:

HelloWorld project Project Properties in Visual Studio 

Enjoy!

 

~ Dmitry

Read Full Post »

This tutorial will demonstrate how to setup a project in order to easily trace your code.

We will be using Powerflasher SOS.

Powerflasher SOS (SocketOutputServer) is an XML Socket server with a graphic user interface. Connected clients can send messages to SOS. These messages are shown in SOS. Further on commands from SOS to Client can be sent. These are freely configurable.

It requires JavaVM starting from 1.3: http://java.com/en/download/index.jsp

This tutorial will demonstrate the following steps:

  • Download and run Powerflasher SOS
  • Create new ActionScript Application
  • Write code that will allow our application to “trace” to Powerflasher SOS using XMLSocket
  • Specify additional compilation parameter: -trace “Main.myTrace”. Compiler will replace all “trace()” statements with a call to Main.myTrace which will send messages over XMLSocket to SOS
  • We will then add
    • new ActionScript Class
    • two SWF files that will serve as ON/OFF states
  • We will then show the following
    • Loading resources
    • MovieClip.onRollOver, MovieClip.onRollOut events

Source code is here.

Click the image below to launch:

 

Here is the code for your reference:

class Main
{
    private static var sock : XMLSocket;
    static function main()
    {
        Stage.align = "TL";
        Stage.scaleMode = "noScale";
        
        if (_root.enableTrace == "true")
        {
            enableTrace();
        }
        trace("main() called");
        var app : App = new App();
        app.Start();
    }
    private static function enableTrace() : Void
    {
        sock = new XMLSocket();
        sock.connect("localhost", 4444);
        trace("connected");
    }
    public static function myTrace(obj : Object, fullclass : String, file : String, line : Number) : Void
    {
        sock.send("msg: " + obj + " (class: " + fullclass + ", line: " + line + ")\n");
    }
}
 
 
class App
{
    public function App()
    {
        
    }
    public function Start() : Void
    {
        var button : MovieClip = _root.createEmptyMovieClip("button", _root.getNextHighestDepth());
        button._x = 20;
        button._y = 20;
        
        var imageOn : MovieClip = button.createEmptyMovieClip("imageOn", button.getNextHighestDepth());
        imageOn.loadMovie("smiley_happy.swf");
        
        var imageOff : MovieClip = button.createEmptyMovieClip("imageOff", button.getNextHighestDepth());
        imageOff.loadMovie("smiley_sad.swf");
        
        button.onRollOver = function()
        {
            trace("");
            this.imageOff._visible = false;
        }
        
        button.onRollOut = function()
        {
            trace("");
            this.imageOff._visible = true;
        }
    }
}

~Mike

Read Full Post »

This tutorial will demonstrate how to create “resources” SWF that might contain required UI elements and then load them into your ActionScript application.

This tutorial will demonstrate the following steps:

  • Create new Flash Document using Macromedia Flash Professional 8
  • Create new Movie Clip (Linkage: Export for ActionScript, Export in first frame)

  • Add an image and create a simple motion tween
  • Publish to produce SWF
  • Create new ActionScript Application
  • Specify “input SWF” pointing to the produced SWF
  • Show code required to load needed Movie Clip

Source code is here.

Click image below to launch:

Read Full Post »

This tutorial will build upon our previous “Hello World ActionScript Application” tutorial.

A few concepts:

  • Please review our previous post for information about swfobject.js and _SwfHtmlTemplate.htm: Files included in default project (Neutron)
  • You might also find the following post useful: SharpStyle Neutron Project Properties
  • This tutorial starts with an existing ActionScript project
  • We will add to the solution an ASP.NET Web Application
  • We will then configure “output path” of the ActionScript project to output compiled SWF into a subfolder of the Web Application
  • We will copy necessary HTML code from _SwfHtmlTemplate.htm into Default.aspx. This will allow us to display SWF

Source files are here.

Click the image below to launch:

 

~Mike

Read Full Post »

Tutorial — Hello World

This tutorial will provide a quick introduction to compiling a very simple ActionScript application using SharpStyle Neutron.

Tutorial will present the following concepts:

  • Creation of a simple “Hello World” ActionScript 2.0 Application
  • Default files includes in a new ActionScript Project
    • _SwfHtmlTemplate.htm — template used to create HTML file containing SWF
    • Main.as — default ActionScript file
    • swfobjects.js — JavaScript Flash Player detection and embed script (more information here: http://blog.deconcept.com/swfobject)
  • Displaying output within Visual Studio and in a default web browser
  • Visual Studio IntelliSense support
  • Error list integration
  • “Go To Definition” functionality

 

Click the image below to launch:

Read Full Post »