Archive

Adobe Creative Suite is calling mummy

Just a quick note: http://www.heise.de/newsticker/meldung/101258

Adobe products are calling 2O7.net (192.168.112.2O7.net) and send statistics. Visit 2O7.net to disable this.

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:

Actionscript:
  1. package {
  2.     import flash.display.Sprite;
  3.     import flash.events.Event;
  4.     import flash.events.MouseEvent;
  5.  
  6.     public class ButtonModeTest extends Sprite
  7.     {
  8.         public function ButtonModeTest()
  9.         {
  10.             run();
  11.         }
  12.        
  13.         private function run(): void
  14.         {
  15.             //-- Start listening
  16.             addEventListener( MouseEvent.CLICK, onMouseEvent );
  17.             addEventListener( MouseEvent.MOUSE_OVER, onMouseEvent );
  18.             addEventListener( MouseEvent.MOUSE_OUT, onMouseEvent );
  19.            
  20.             //-- Button 1 on the main stage
  21.             var button1: Sprite = createButton( 1 );
  22.             addChild( button1 );
  23.            
  24.             //-- Button 2 within the container
  25.             var button2: Sprite = createButton( 2 );
  26.             var button2Container: Sprite = new Sprite();
  27.             button2Container.addChild( button2 );
  28.             button2Container.x = 150;
  29.             button2Container.name = "button2Container";
  30.             addChild( button2Container );
  31.            
  32.             // By default the mouse events will be dispatched by the buttons themself
  33.             // (the lowest sprites)
  34.            
  35.             // Setting containers buttonMode to true doesn't force the container to
  36.             // dispatch the mouse events ( so what the hell is button mode?)
  37.             button2Container.buttonMode = true;
  38.  
  39.             // Setting containers useHandCursor to true only works when it's buttonMode
  40.             // is also true. But the events will still be dispatched from the lowest
  41.             // sprite (even its a button!?!)
  42.             button2Container.useHandCursor = true;
  43.            
  44.             // Only setting mouseChildren to false forces the container to dispatch
  45.             // the mouse events
  46.             button2Container.mouseChildren = false;
  47.         }
  48.        
  49.         private function createButton( index: uint ): Sprite
  50.         {
  51.             var button: Sprite = new Sprite();
  52.             button.name = "button" + index;
  53.             button.graphics.beginFill( 0, 1 );
  54.             button.graphics.drawRect( 0, 0, 100, 100 );
  55.             button.graphics.endFill();
  56.            
  57.             return button;
  58.         }
  59.        
  60.         private function onMouseEvent( event: Event ): void
  61.         {
  62.             trace( "Event (" + event.type + ") dispatched from : " + event.target.name );
  63.         }
  64.     }
  65. }

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:
  1. ?>?>?>
  2.  
  3. <project default="asdoc" name="Documentation">
  4. <property environment="env"></property><!--
  5. Markus Raab - derRaab.com / superclass.de
  6. This ANT build.xml works on a Mac with a FLEX SDK 2.0.1 in the following location:
  7. /Applications/Adobe_AsDoc/FlexSDK_201
  8. For more informations see: http://blog.derraab.com/2007/11/23/running-adobe-asdoc-on-my-mac-using-ant/
  9. ATTENTION: Use relative paths (according to this build.xml)
  10. -->
  11.  
  12. <!--
  13. ActionScript directory location in source-path and doc-sources (both are needed?)
  14. -->
  15.  
  16. <property value="../src/as/" name="source-path"></property>
  17. <property value="../src/as/" name="doc-sources"></property><!--
  18. List with all your used library SWC files (using a directory causes asdoc not to write any documentation files?)
  19. -->
  20.  
  21. <property value="../src/as/mdm.swc ../src/as/layout.swc" name="library-path"></property><!--
  22. Documentation output directory
  23. -->
  24.  
  25. <property value="./classes" name="output"></property><!--
  26. SDK Location (without whitespace!)
  27. -->
  28.  
  29. <property value="/Applications/Adobe_AsDoc/FlexSDK_201" name="flex-sdk"></property><!--
  30. Location of the asdoc templates
  31. -->
  32.  
  33. <property value="${flex-sdk}/asdoc/templates" name="templates-path"></property><!--
  34. run
  35. -->
  36. <target name="asdoc">
  37. <exec executable="${flex-sdk}/bin/asdoc">
  38. <arg value="-source-path ${source-path}"></arg>
  39. <arg value="-doc-sources ${doc-sources}"></arg>
  40. <arg value="-library-path ${library-path}"></arg>
  41. <arg value="-output ${output}"></arg>
  42. <arg value="-templates-path ${templates-path}"></arg>
  43. </exec>
  44. </target>

AVM1 _globals are still global.

This is one of this quicknotes just for not forgetting a simple issue:While developing a "AS2Wrapper" for embeding AS2 contents in AS3 applications I recognised that _globals within the loaded AS2 SWFs still exist when you unload this SWF and load another. This seems to be quite apparent but I thought about the AVM1 as some kind of sandbox.

Android Preview

This is a interessting preview about Googles Andriod OS for mobile devices:

I think there will be more videos in the future: Andriod developers on YouTube.

AS3 Spell Check Engine

Grand Skinners Spell Check Engine could be really interessting for business projects. So keep it in mind!

FOAM Rigid Body Physics Engine Alpha

Wow again! Drew Cummins recently released a alpha version of his FOAM calles physics engine. You definitely should check it out here. It runs really stable...

ActionScript Performance Test

This performance test shows how fast the ActionScript AVM2 runs compared to the AVM1, Java(!) and JavaScript: See it

Adobe MAX Chicago - Pacifica Sneak Peek

Wow! I found another great Sneak Peek. Imagine you integrate your own skype like service on your website which enables costumers to call you on your cellphone using this little app. Great: Video

Adobe MAX Chicago - Flash on C Sneak Peek

Today I found a real interessting Sneak Peak Video about porting C / C++ or other librarys to ActionScript 3. This will make a lot of librarys available to ActionScript 3 without rewriting anything. Thing about different file formats and stuff like that! Great possibilities! Watch the video here.