Help, Adobe Air for Linux ate my mimetypes?

April 2nd, 2008

**note** - I would have posted this in the bug list, but I can’t find it, the link from the FAQ just goes to the products page?

**fixed** - Ashutosh from Adobe provided a working fix in the comments below, nice one!

After installing the new Alpha of Adobe Air for Linux yesterday on Ubuntu 7.1 the mime types for .zip files seem to be broken and I can’t figure out how to fix them. When I clicked on a standard .zip file it used to open in FileRoller, it now gives me an error that the filename indicates it’s a zip but the contents indicate it’s an Air Application. I need to use ‘Open With’ to select FileRoller. Not the end of the world but a bit of a pain. Also, the files have a zip icon but this changes to a .air icon when I click it.

Poking around a bit I found xdg-mime included in the files installed with Air (side note, why? I’ve already got these installed, isn’t that the point of using the package manager to install this stuff?) and also an accompanying AdobeAir.xml file…

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
 
  <mime-type type="application/vnd.adobe.air-application-installer-package+zip">
    <comment>Adobe AIR Application</comment>
    <glob pattern="*.air"/>
    <magic priority="100">
      <match type="string" value="PK\003\004" offset="0"/>
    </magic>
  </mime-type>
</mime-info>

…not sure what the magic stuff does but it looks ok? Also testing with xdg-mime seems to point to the mime types being correct?

adam@ubuntu:~$ xdg-mime query filetype ~/Desktop/08_04_02.zip 
application/zip
adam@ubuntu:~$ xdg-mime query default application/zip
file-roller.desktop
adam@ubuntu:~$ xdg-mime query default application/vnd.adobe.air-application-installer-package+zip
AdobeAIR.desktop

There’s also an air.mime file that also looks ok to me..

application/vnd.adobe.air-application-installer-package+zip
        ext: air

I’ve also just spotted, the files have been simlinked incorrectly into /usr/share/mime-info/ …

ls -la /usr/share/mime-info/air.*
 
adam@ubuntu:~$ ls -la /usr/share/mime-info/
lrwxrwxrwx   1 root root      54 2008-03-31 20:26 air.keys -> /opt/Adobe AIR/Versions/1.0/xdg-utils/support/air.keys
lrwxrwxrwx   1 root root      54 2008-03-31 20:26 air.mime -> /opt/Adobe AIR/Versions/1.0/xdg-utils/support/air.mime

the links should be to /opt/Adobe AIR/Versions/1.0/support/* , no xdg-utils, so I’ve tried …

adam@ubuntu:~$ sudo unlink /usr/share/mime-info/air.keys 
adam@ubuntu:~$ sudo unlink /usr/share/mime-info/air.mime 
adam@ubuntu:~$ sudo ln -s /opt/Adobe\ AIR/Versions/1.0/support/air.keys /usr/share/mime-info/air.keys 
adam@ubuntu:~$ sudo ln -s /opt/Adobe\ AIR/Versions/1.0/support/air.mime /usr/share/mime-info/air.mime

but this doesn’t seem to fix anything. Any other ideas anyone?

———
note to self, may be time to look at a liquid layout for the blog :)

Targeting movieclip from an AS3 class file - reply

January 15th, 2008

This is a reply to Brian Chau’s post here, but my comment didn’t go through too well, so I’ll repeat it here…

————————————-

As Tink says, it’s normally better to encapsulate the functionality of each class using events and public methods instead of exposing the internals.

For this simple example, you might rewrite it something like…

Test.as

package
{
 import flash.display.MovieClip;
 
 public class Test extends MovieClip
 {
  private var blackbox_mc:BlackBox;
	 
  public function Test()
  {
	blackbox_mc = new BlackBox();
	this.stage.addChild(blackbox_mc);
	var myTest:Control = new Control(this);
  }
  
  public function positionBlackBox(x=null,y=null) : void {
	blackbox_mc.x = (x==null)?blackbox_mc.x:x;
	blackbox_mc.y = (y==null)?blackbox_mc.y:y;
  }
 }
 
}

Control.as

package
{
	import flash.display.MovieClip;
 public class Control
 { 
  private var view:MovieClip;
  public function Control(mc:MovieClip)
  {
	view = mc;
    view.positionBlackBox(null,100);
  }
 }
}

..although to me this still feels a bit odd as the main class is the view, it kinda shows how to break the two. The controller only knows what to view controll and what public methods it’s allowed to call on the view, nothing of how the view works internally.

If you then want to use a design time created blackbox you can simply plop the mc on stage, call it blackbox_mc and delete the instantiation references from the view, e.g….

Test.as

package
{
 import flash.display.MovieClip;
 
 public class Test extends MovieClip
 {
	 
  public function Test()
  {
	var myTest:Control = new Control(this);
  }
  
  public function positionBlackBox(x=null,y=null) : void {
	blackbox_mc.x = (x==null)?blackbox_mc.x:x;
	blackbox_mc.y = (y==null)?blackbox_mc.y:y;
  }
 }
 
}

As the blackbox_mc is already on the views stage flash auto creates the reference, so you can just use blackbox_mc without creating it.

Hope that helps.

A