« Older Entries Subscribe to Latest Posts

1 Feb 2010

DisplayObject.rotationX,Y,Z

Posted by derRaab. No Comments

Just a quick note about working with DisplayObject.rotationX,Y,Z:

Keep in mind that your DisplayObject rotates around it's center point. This may result in weird optics if you forget to align your DisplayObject properly.

Update: Well, there is much more to know!

There's need for an DisplayObjectContainer with an properly assigned PerspectiveProjection.

Copy & paste this code and you'll see what I'm talking about:

Actionscript:
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener( Event.RESIZE, onStageResize );

function onStageResize( event : Event ) : void
{
    draw();
}

function createRectSprite( w : int, h : int, rotationY : Number, container : Sprite, useProjection : Boolean ) : Sprite
{
    // 3D object
    var graphicSprite : Sprite = new Sprite();
        graphicSprite.name = "graphicSprite";
        graphicSprite.rotationY = rotationY;
        graphicSprite.buttonMode = true;
        graphicSprite.useHandCursor = true;

    // Make sure 3D objects content is centered
    var g : Graphics = graphicSprite.graphics;
        g.beginFill( 0, .5 );
        g.drawRect( w * -.5, h * -.5, w, h );
        g.endFill();

    // 3D Container
    var containerSprite : Sprite = new Sprite();
        containerSprite.addChild( graphicSprite );

    // Apply projection to 3D Container instead of 3D Object
    if ( useProjection )
    {
        var projection:PerspectiveProjection = new PerspectiveProjection();             
            projection.projectionCenter = new Point( 0, 0 );

        containerSprite.transform.perspectiveProjection = projection;
    }
       
    // Visualize center
    g = containerSprite.graphics;
    g.beginFill( 0xff0000 );
    g.drawCircle( 0, 0, 2 );
    g.endFill();

    container.addChild( containerSprite );   
    return containerSprite;
}

var left : Sprite;
var right : Sprite;
 
function draw() : void
{
    while ( numChildren> 0 ) { removeChildAt( 0 ); }

    var container : Sprite = new Sprite()
        container.name = "container";
        container.x = stage.stageWidth * .5;
        container.y = stage.stageHeight * .5;
    addChild( container );

    var stepX : int = stage.stageWidth / 3;

    var w : int = 200;
    var h : int = 200;

    left = createRectSprite( w, h, -60, this, true );
    left.name = "left";
    left.x = stepX;

    right = createRectSprite( w, h, 60, this, true );
    right.name = "right";
    right.x = stepX * 2;
   
    left.y =
    right.y = stage.stageHeight * .5;
}
 
function onEventHitTest( event : Event ) : void
{
    var containerSprite : DisplayObjectContainer;
    var graphicSprite : DisplayObject;
   
    containerSprite = this.getChildByName( "left" ) as DisplayObjectContainer;
    graphicSprite = containerSprite.getChildByName( "graphicSprite" ) as DisplayObject;
   
    trace( "hit left containerSprite:", containerSprite.hitTestPoint( mouseX, mouseY, true ) );
    trace( "hit left graphicSprite:", graphicSprite.hitTestPoint( mouseX, mouseY, true ) );
   
    containerSprite = this.getChildByName( "right" ) as DisplayObjectContainer;
    graphicSprite = containerSprite.getChildByName( "graphicSprite" ) as DisplayObject;
   
    trace( "hit right containerSprite:", containerSprite.hitTestPoint( mouseX, mouseY, true ) );
    trace( "hit right graphicSprite:", graphicSprite.hitTestPoint( mouseX, mouseY, true ) );
    trace( "" );
}

stage.addEventListener( MouseEvent.MOUSE_DOWN, onEventHitTest );
 
draw();

29 Jan 2010

ActionScript 3 API Reference for the iPhone

Posted by derRaab. No Comments

http://www.mikechambers.com/as3iphone/

Nice to have!

6 Nov 2009

Mac – Local Server Development Basics

Posted by derRaab. No Comments

Since I had to figure out some basics about local server development on my Mac, I really recommend these tools:

  • MAMP - Apache and MySQL Server
  • Virtual Host X - Create up to 3 virtual host with the free version.
    In other words: This provides an easy to use GUI which enables you to forward an local URL like "http://myProject.local" to your workspace directory.

But one thing sucks: You have to set read/write access (in finder) for everyone. I wonder if that might cause system security problems?

And I strongly recommend to read this nice tutorial about setting up virtual hosts manually: http://www.sawmac.com/mamp/virtualhosts/

30 Oct 2009

Blocking Flash in Safari

Posted by derRaab. No Comments

Firefox users probably know the Flashblock plugin and I just want to note a link to a similar plugin for webkit which works well with Safari.

http://rentzsch.github.com/clicktoflash/

29 Oct 2009

Zend Framework CLI Tool Usage

Posted by derRaab. 1 Comment

God damn it. I spent hours trying to generate the basic filestructure using the Zend_Tool (zf.php) shipping within the Zend Framework download. It didn't work and I got really frustrated.

Well, guess what. Now I downloaded the next version (1.9.5) and it works!

Just open the terminal, navigate to the bin directory within the framework download and type (Mac OS X):

./zf.sh create project ./

This is what get's generated: Zend_1_9_5_Structure

4 May 2009

Pixel Bender in Flash Player is not hardware accelerated

Posted by derRaab. No Comments

I just came across this little note http://theflashblog.com/?p=822 and thought that might help to get some clarification.

14 Apr 2009

Adobe Labs – Text Layout Framework

Posted by derRaab. No Comments

Weekly builds of text layout framework now available on Adobe labs:
http://labs.adobe.com/technologies/textlayout/

9 Apr 2009

Create Custom Flex Components with Flash

Posted by derRaab. No Comments

I found a Adobe TV Video which contains basic knowledge how to create custom Flex components with Flash CS3:

6 Apr 2009

Stanford Lectures for iPhone Application Programming

Posted by derRaab. No Comments

Stanford university offers the Spring 2009 quarter lectures for free via iTunes U.

I think that's my way into iPhone application programming.

Check out the standford website for details: http://www.stanford.edu/class/cs193p/cgi-bin/index.php

UPDATE:

Online resources for auditors and iTunes U viewers:
http://groups.google.com/group/iphone-appdev-auditors
http://cs193p.com/

6 Mar 2009

Dock and system tray with Adobe AIR

Posted by derRaab. No Comments

Nice tutorial I guess:

http://www.adobe.com/devnet/air/flash/quickstart/stopwatch_dock_system_tray.html