We broke Capuchin

While testing our Capuchin application we ran into some trouble with the DataRequest class. It turned out that after an X amount of calls and Y amount of data sent by the DataRequest class it would just fall over.

We were doing a DataRequest every 5 seconds to update the Flash UI and after around 80 to 100 calls it would just freeze. Now I don’t say this is the right approach for a situation like this, however, I don’t think Capuchin should just fail and do nothing either.

We solved the issue by switching to an event driven model and that seems to work very well at the moment.

Project Capuchin

Rocks! It’s very interesting to work with. Hopefully soon I can post about a first application.

Sony Ericsson’s Project Capuchin technology is a Javaâ„¢ ME API that defines a bridge between the Java ME and Adobe® Flash Liteâ„¢ programming environments.

In other words: You can have a Flash front-end talking to a Java back-end on a mobile phone. Now how cool is that?! 🙂

Link: Project Capuchin Docs and Tools

The class or interface ‘yourClass’ could not be loaded.

Warning: Illegal string offset 'language' in /var/www/vhosts/ansuz.nl/subdomains/blog/httpdocs/wp-content/plugins/igsyntax-hiliter/classes/frontend.php on line 510 Warning: ksort() expects parameter 1 to be array, string given in /var/www/vhosts/ansuz.nl/subdomains/blog/httpdocs/wp-content/plugins/igsyntax-hiliter/classes/frontend.php on line 513

This happens when you try to acces an external class on a frame that doesn’t have the import statement for the class. ie:

  1. // On frame 1:
  2. import yourClass;
  3.  
  4. //On frame 5:
  5. var something:yourClass = new yourClass();

The solution is to put the import statement (also) on frame 5.

XML and Latin-1 characters

Warning: Illegal string offset 'language' in /var/www/vhosts/ansuz.nl/subdomains/blog/httpdocs/wp-content/plugins/igsyntax-hiliter/classes/frontend.php on line 510 Warning: ksort() expects parameter 1 to be array, string given in /var/www/vhosts/ansuz.nl/subdomains/blog/httpdocs/wp-content/plugins/igsyntax-hiliter/classes/frontend.php on line 513

You should use the decimal character references for these characters to use them in your XML. So instead of writing á, you should write ‘& # 2 2 5 ;’ (remove the spaces). This way Flash will display the characters correctly.
A list of the char references can be found at: http://www.bbsinc.com/iso8859.html

EDIT: Another way of solving this is setting the XML encoding to UTF-8.

  1. <?xml version="1.0" encoding="utf-8"?>

DHTML

Warning: Illegal string offset 'language' in /var/www/vhosts/ansuz.nl/subdomains/blog/httpdocs/wp-content/plugins/igsyntax-hiliter/classes/frontend.php on line 510 Warning: ksort() expects parameter 1 to be array, string given in /var/www/vhosts/ansuz.nl/subdomains/blog/httpdocs/wp-content/plugins/igsyntax-hiliter/classes/frontend.php on line 513

The simplest of things can be so much fun.

Like changing the background color of a website when you change pages in a flash document. How you do this is quite simple. You just call a pice of JavaScript from Flash, like this:

  1. getURL("js:method(params)", "_self");

An example of this: http://vwg.net/test/su/

note: replace “js” above with “javascript”, somehow wordpress isn’t happy with me using that word… 😉

Send data to PHP

Warning: Illegal string offset 'language' in /var/www/vhosts/ansuz.nl/subdomains/blog/httpdocs/wp-content/plugins/igsyntax-hiliter/classes/frontend.php on line 510 Warning: ksort() expects parameter 1 to be array, string given in /var/www/vhosts/ansuz.nl/subdomains/blog/httpdocs/wp-content/plugins/igsyntax-hiliter/classes/frontend.php on line 513

In order to have a PHP script executed (and not opened in a window) through ActionScript use loadVars.sendAndLoad(url, your_data, method) instead of loadVars.send(url). In this way the opening of a new window isn’t necessary.

example:

  1. // create a new LoadVars instance
  2. var c_lv:LoadVars = new LoadVars();
  3.  
  4. // populate it with some data
  5. c_lv.bericht = input_bericht.text;
  6. c_lv.email = input_mail.text;
  7.  
  8. // offer the data to the PHP mail handler and execute it!
  9. c_lv.sendAndLoad("sendForm.php", c_lv, "POST");