Microsoft Word error during HTML import

Since I have to use Microsoft Word 2008 for Mac I figured out some issue: During opening a clean XHTML file with external CSS declarations Word can find these CSS files only in the same directory. I tried serveral ways to declare the href tag, but only the last one works…

<link href="../style.css" rel="stylesheet" type="text/css" />
<link href="./../style.css" rel="stylesheet" type="text/css" />
<link href="..\style.css" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" />

Maybe there is a solution? I can’t figure it out.

Adobe technology platform RIA guide

This is simply the link list contained in the recently released Adobe technology platform ActionScript Reference PDF.

API References

Documentation

Developer Centers

Downloads

Miscellaneous Resources

Mailing Lists

Forums

Write with AIR applications to the application resource directory

AIR applications are not permitted to write to the application resource directory. This seems to be a security feature and makes sense, because some systems would not allow to write into this directory at system level.

But for testing purposes you might hack this by using a single line of code:

// Writing into that file would fail
var yourFileInAppDir: File = File.applicationDirectory.resolvePath( "yourFile.xml" );
// This is the simple hack:
yourFileInAppDir = new File( yourFileInAppDir.nativePath );

But this only avoids a AIR security error! You must be sure to have write access to the directory!

Using Sprite.buttonMode and Sprite.mouseChildren

Today I found something I really did not understand very well. I had to debug a application because one button displayed the handCursor and another did not. Both use the same script and actually I didn’t find out why the behaviour of this buttons was like that but I fixed it through a workaround.

The first thing I understood today is, that it’s possible to receive all mouse events without using buttonMode! Simply add a listener to your objects and you can work with them.

But if you like to work with a button that contains additional sprites (which might be very useful) you definitely should take care about their behaviour. By default mouse events will be dispatched by the lowest sprite, exept you set mouseChildren to false…

Have a look at this little code example:

package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
 
	public class ButtonModeTest extends Sprite
	{
		public function ButtonModeTest()
		{
			run();
		}
 
		private function run(): void
		{
			//-- Start listening
			addEventListener( MouseEvent.CLICK, onMouseEvent );
			addEventListener( MouseEvent.MOUSE_OVER, onMouseEvent );
			addEventListener( MouseEvent.MOUSE_OUT, onMouseEvent );
 
			//-- Button 1 on the main stage
			var button1: Sprite = createButton( 1 );
			addChild( button1 );
 
			//-- Button 2 within the container
			var button2: Sprite = createButton( 2 );
			var button2Container: Sprite = new Sprite();
			button2Container.addChild( button2 );
			button2Container.x = 150;
			button2Container.name = "button2Container";
			addChild( button2Container );
 
			// By default the mouse events will be dispatched by the buttons themself
			// (the lowest sprites)
 
			// Setting containers buttonMode to true doesn't force the container to
			// dispatch the mouse events ( so what the hell is button mode?)
			button2Container.buttonMode = true;
 
			// Setting containers useHandCursor to true only works when it's buttonMode
			// is also true. But the events will still be dispatched from the lowest
			// sprite (even its a button!?!)
			button2Container.useHandCursor = true;
 
			// Only setting mouseChildren to false forces the container to dispatch
			// the mouse events
			button2Container.mouseChildren = false;
		}
 
		private function createButton( index: uint ): Sprite
		{
			var button: Sprite = new Sprite();
			button.name = "button" + index; 
			button.graphics.beginFill( 0, 1 );
			button.graphics.drawRect( 0, 0, 100, 100 );
			button.graphics.endFill();
 
			return button;
		}
 
		private function onMouseEvent( event: Event ): void
		{
			trace( "Event (" + event.type + ") dispatched from : " + event.target.name );
		}
	}
}

Running Adobe AsDoc on my Mac using ANT!

Wow, this was really challenging! But now, finally, I found out how to use AsDoc on my Mac.There must be another solution out there, but I simply want to document this workaround hoping that this also works on your Mac.

What you need is a Flex SDK 2.0.1 which comes with Flex Builder or as a free download from Adobe and the knowledge how to use ANT (I use eclipse).

I tried this tutorial several times but it never worked for me. I don’t know why.But after hours of testing I Â hopefully found a proper solution which works find with Flex SDK 2.0.1. The main idea simply is separating the AsDoc functionality from the normal Flex Builder environment. Basically the only thing you have to do is avoiding whitespaces from your directory names. However I tried to use Flex Builder for this and Flex Builder installs into the directory “Flex Builder 3”.So this is what I did and you might try:

  • Create a new directory within the applications folder (don’t use whitespace!) “Applications/Adobe_AsDoc”
  • Copy the Flex SDK 2.0.1 into that “Adobe_AsDoc” directory
  • Rename the Flex SDK directory to “FlexSDK_201” (which might not be necessary, but I tried to avoid any special characters within the directory names)

Great. So all you have to do now is download and use this ANT build.xml (download):

<?xml version="1.0" encoding="UTF-8"?>
<project name="Documentation" default="asdoc">
 
	<property environment="env"/>
 
	<!--
			Markus Raab - derRaab.com / superclass.de
 
			This ANT build.xml works on a Mac with a FLEX SDK 2.0.1 in the following location:
			/Applications/Adobe_AsDoc/FlexSDK_201
 
			For more informations see: blog.derraab.com
 
			ATTENTION: Use relative paths (according to this build.xml)
	-->
 
 
	<!--
	ActionScript directory location in source-path and doc-sources (both are needed?)
	-->
	<property name="source-path" value="../src/as/"/>
	<property name="doc-sources" value="../src/as/"/>
 
	<!--
	List with all your used library SWC files (using a directory causes asdoc not to write any documentation files?)
	-->
	<property name="library-path" value="../src/as/mdm.swc ../src/as/layout.swc"/>
 
	<!--
	Documentation output directory
	-->
	<property name="output" value="./classes"/>
 
	<!--
	SDK Location (without whitespace!)
	-->
	<property name="flex-sdk" value='/Applications/Adobe_AsDoc/FlexSDK_201'/>
 
	<!--
	Location of the asdoc templates
	-->
	<property name="templates-path" value='${flex-sdk}/asdoc/templates'/>
 
 
	<!--
	run
	-->
	<target name="asdoc">
 
		<exec executable='${flex-sdk}/bin/asdoc'>
 
			<arg value='-source-path ${source-path}'/>
			<arg value='-doc-sources ${doc-sources}'/>
			<arg value='-library-path ${library-path}'/>
			<arg value='-output ${output}'/>
			<arg value='-templates-path ${templates-path}'/>
 
		</exec>
 
	</target>
 
</project>