23 March AsUnit on OS X
I’m looking at AsUnit to start unit testing the Floorplanner. Aral Balkan has written a post AsUnit-X: AsUnit XUL UI for OS X on an easy way to get started on OS X. I’ll keep you posted on the progress!
I’m looking at AsUnit to start unit testing the Floorplanner. Aral Balkan has written a post AsUnit-X: AsUnit XUL UI for OS X on an easy way to get started on OS X. I’ll keep you posted on the progress!
When you try to submit a form from Javascript, using form_remote_tag, like this:
Rails:
form_remote_tag :url => {:controller => "somecontroller", :action => "} , :html => {:id => "ajax-form-1">
If you just invoke form.submit(), like this:
var form = document.getElementById('ajax-form-1'); if(form) form.submit();
the form will be submitted to a new page, that’s not soo ajaxy you now think. Instead use:
var form = document.getElementById('ajax-form-1');<br /> if(form.onsubmit()){ form.submit(); }
Now your form will be submitted on the AJAX way!
6 Comments - Tags: Ajax, form
I finally found 2 good links to posts on how to configure FlashDevelop for AS3:
Today i’ve had some trouble getting the Flash Debug Player working on my new iMac. I downloaded the content debugger for Intel-based Macs from the Adobe Flash Player Support Center and installed it. The problem was, it didn’t work…. no mm.cfg, no flashlog.txt
After some surfing i found out that the easiest way to get things working is to install the fabulous Firefox Add-on Flash Tracer from Alessandro Crugnola. Besides the add-on itself, it creates 2 files: flashlog.txt (HD/Users/username/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt) and mm.cfg (HD/Users/username/Library/Application Support/Macromedia/mm.cfg). This makes all the difference! All the traces of my flash movie are stored in the flashlog.txt file and are shown in the Flash Tracer (when pointing it once to the flashlog.txt file)
If you don’t want to install Flash Tracer you can create the mm.cfg file manually. It should look something like this:
ErrorReportingEnable=0
TraceOutputFileEnable=1
MaxWarnings=500
I believe you also have to create an empty flashlog.txt file manually, but i’m not sure. Hope this helps!
You probably already know this, but I just found out yesterday that drawing lines is greatly enhanched in Flash 8 (and Actionscript 2). There are 5 new parameters added to the lineStyle function:
lineStyle(thickness:Number, rgb:Number, alpha:Number, pixelHinting:Boolean, noScale:String, capsStyle:String, jointStyle:String, miterLimit:Number)
This means that you have a lot more control over the style of your lines. You can do stuff like this:


See the Adobe Livedocs for more info.
When using:
var lElements = ["el1","el2","el3"]; foreach(var el in arr) { alert(el); }
in Javascript and afterwards you add the Prototype library, don’t forget it extends your array! When doing the foreach, all extra functions that the (still wonderfull) Prototype Library adds, will be displayed. I had some weird problems after adding the javascript source file of Prototype. It took me a while to understand why my code didn’t do what I intended. After displaying this foreach loop, I saw the problem!
UPDATE:
To fix the issue I discussed some days ago(see below) use:
System.security.allowDomain(”http://ip-adress”);
ip-adress is the IP you are developing on! This will fix the security issues!
While trying to let Actionscript talk to Javascript using the External Interface API of Actionscript I bounced upon a problem when Actionscript tried to invoke this Javascript function. In Firefox 2.0.0.2 an alert message shouted to me: “Error calling method on NPObject! [plugin exception: Error in Actionscript. Use a try/catch block to find error.].”.
My precise environment was, the html running on the localhost (Rails application) and the swf from an other domain and this seemed to be the problem. When I deployed the Rails application to this server, there was no problem at all invoking these functions. It looks like a bug in the flash player, cause I tried all the security settings possible in flash, the famous crossdomain.xml, adding all locations to the flash settings but no result. Somehow the SWF from that other domain had some troubles talking to the local javascript.
My way to solve this issue was to load the SWF also from the localhost. Everything works perfectly and I can continue testing.
7 Comments - Tags: crossdomain, Flash, security
After some diggin’ I finally figured out why Internet Explorer didn’t display my SWF movie. The width and the height of my movie are related to the width and height of the Stage. It seems that in IE the Stage isn’t available in the first frame. Therefore the movie has to wait a frame before it can acces the Stage properties.
public function Application() { addEventListener( Event.ENTER_FRAME, onEnterFrame ); } private function onEnterFrame( pEvent:Event ) : void { removeEventListener( Event.ENTER_FRAME, onEnterFrame ); setWidth( stage.stageWidth ); setHeight( stage.stageHeight ); }
3 Comments - Tags: Flash, Internet Explorer