Posts Tagged ‘Open Source’
Plasma pong
Finally I finished the video from FlashGAMM 2011 Moscow where we exhibited our multi-touch table with Fluid Pong game based on MSA Fluid library. The game was developed using Scala and Processing and was a major success at the conference.
Multi-touch Fluid Pong from InteractiveLab on Vimeo.
What’s more, it is open source and is availabale at GitHub.
Tags: FlashGamm, GitHub, MSA FLuid, multitouch, Open Source, Pong, Processing, Scala
/tuio/3ASCur – parsing OSC/TUIO in AS3
Meet yet another AS3 OSC/TUIO parser! We have just released it open-source.
Sources can be found on GitHub — https://github.com/InteractiveLab/tuio.3ASCur
Continue Reading | No Comments
Tags: Open Source, OSC, TUIO
MXML in AS3 projects and fixing mxmlc
Not many people actually know that you can use MXML in pure AS3 projects. Here’s an example.
Create a new AS3 project, create a new file in package cp. Call it App.mxml. Flex Builder will not allow you to create an MXML component in a pure AS3 project, so you have to do it manually. Here’s my App.mxml.
<?xml version="1.0" encoding="utf-8"?>
<cp:Component xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:cp="cp.*" >
<cp:Component var1="123"/>
<cp:Component var1="124111"/>
<cp:Component />
</cp:Component>
Notice that I’m using my own namespace and no flex components. Now define Component class in cp/Component.as.
package cp {
import flash.display.Sprite;
[DefaultProperty( "children" )]
public class Component extends Sprite {
public function Component() {
super();
}
private var _children:Array;
public function get children():Array {
return this._children;
}
public function set children(value:Array):void {
this._children = value;
trace( value );
}
public var var1:String;
}
}
In main project file I put:
package {
import cp.App;
import flash.display.Sprite;
public class mxml_test extends Sprite {
public function mxml_test()
{
this.addChild( new App() );
}
}
}
To compile it you need to have framework.swc in library path though. And [DefaultProperty( "children" )] doesn’t work neither in 3.4 SDK nor in 4.0 for some reason. People say it should work in 4.0 but it doesn’t.
That’s weird that Flex SDK 3.4 and Flex SDK 4.0 produce different code from MXML files. 4.0 adds much more useless Flex stuff to resulting SWF. If you want you can add -keep-generated-actionscript compiler parameter to check converted code. Flex 4.0 adds such functions for every object in original MXML.
private function _App_Component2_i() : cp.Component {
var temp : cp.Component = new cp.Component();
temp.var1 = "123";
_App_Component2 = temp;
mx.binding.BindingManager.executeBindings(this, "_App_Component2", _App_Component2);
return temp;
}
I don’t like that executeBindings thing in my code and useless mx.* classes it puts in SWF making it 3.5Kb in size. So I decided to patch Flex SDK since it’s kind of open source. Flex SDK SVN can be found at opensource.adobe.com/svn/opensource/flex/ and it contains everything you should need to rebuild your own version of SDK. These links helped me a lot too, and thanks God I found those Eclipse projects inside after trying to resolve libraries issues for an hour.
There are only 2 places where I found this executeBindings stuff, both classes are in flex2.compiler.mxml.gen package. I commented this code and compiled mxmlc.jar. I’ve been doing it all evening but couldn’t get rid of it. I can’t get why. I am totally sure that new mxmlc.jar is used but this stupid string is there anyway.
I consider the final result to be a failure but at least I now know that you can patch Flex SDK as you wish. But I didn’t have time to try to understand how the whole compiler code works and where it handles bindings exactly. I didn’t find much on the internet so I guess not many people actually tried to build their own versions of compiler.
Tags: Compiler, executeBindings, Flex, Flex Builder, Java, MXML, Open Source
