ActionScript 3 API Reference for the iPhone

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

Nice to have!

Posted in ActionScript, Documentations, Flash, Flex, iPhone / iPad | Leave a comment

Mac – Local Server Development Basics

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/

Posted in Mac, Server | Leave a comment

Blocking Flash in Safari

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/

Posted in Flash in Browser | Leave a comment

Zend Framework CLI Tool Usage

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

Posted in PHP, Terminal | 1 Comment

Pixel Bender in Flash Player is not hardware accelerated

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

Posted in Flash, Flash in Browser, Flash Player, Pixel Bender | Leave a comment

Adobe Labs – Text Layout Framework

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

Posted in ActionScript, Flash, Librarys, Utils | Leave a comment

Create Custom Flex Components with Flash

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

Posted in Flash, Flex, How To..., Video | Leave a comment

Stanford Lectures for iPhone Application Programming

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/

Posted in iPhone / iPad | 1 Comment

Dock and system tray with Adobe AIR

Nice tutorial I guess:

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

Posted in AIR | Leave a comment

No flash events after PrintJob.start()

While developing the print functionality within a framework I got stuck on the behaviour of the Flash Player print implementation.

I couldn’t solve the following steps:

  1. Start the PrintJob and display the print dialog
  2. Procceed the following tasks for every print page:
    • Load dynamic data into view templates (images, text, video…)
    • Wait for the onLoadComplete event and add the displayed contents using PrintJob.addPage()
    • Repeat for next page…
  3. Call PrintJob.send()

I really thought this would be an easy task but now I think it’s not possible. Several attempts later I figured out that after calling PrintJob.start() there is no way to use the flash event model! This means loading contents after calling PrintJob.start() is impossible!

WOW!

So I used a workaround: I create all the print pages like I mentioned before, but without calls on the PrintJob-API. I simply store every print page as BitmapData and afterwards I create the PrintJob within a loop.

Now I have multiple other problems:

  • Hundreds of pages use a huge amount of RAM and often crash the application.
  • The bitmap resolution sucks so printout text quality is unsatisfying and due to point 1 I have no chance to work with higher quality.
  • I must avoid skript timeouts because after preparing all the bitmaps it takes much more that 15 seconds to add all these pages to a PrintJob.

Did I slip something?

Finally I created a small example to show you the disfunctionality (PrintJobProblem.as):

package  
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.geom.Rectangle;
    import flash.printing.PrintJob;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.utils.getTimer;    
 
    /**
     * @author Markus Raab - derRaab.com / superclass.de
     */
    public class PrintJobProblem extends Sprite 
    {
        private var _numPrintOuts : int;
        private var _printOutIndex : int;
        private var _printJob : PrintJob;
 
        /**
         * Starts a event based printout test after a loop based
         * test has successfully finished.
         */
        public function PrintJobProblem()
        {
            _numPrintOuts = 2;
 
            runLoopBasedTest( );
            runEventBasedTest( );
        }
 
        /**
         * Demonstrates and ensures the functionality.
         */
        private function runLoopBasedTest() : void
        {
            _printJob = new PrintJob();
 
            if ( _printJob.start() )
            {    
                for ( var i : int = 0; i < _numPrintOuts; i++ )
                {
                    addPage( i );
                }
 
                _printJob.send();
            }
        }
 
        /**
         * Demonstrates that after calling PrintJob.start() the internal
         * eventmodel doesn't dispatch any events at all. Everything is blocked
         * until the script times out.
         */
        private function runEventBasedTest() : void
        {
            _printJob = new PrintJob();
 
            if ( _printJob.start() )
            {
                trace( getTimer(), "PrintJob.start() called" );
                _printOutIndex = 0;
 
                startAddPagesOnEnterFrame();
            }
        }
 
        private function startAddPagesOnEnterFrame() : void
        {
            addEventListener( Event.ENTER_FRAME, onAddPagesOnEnterFrameEvent );
        }
 
        private function onAddPagesOnEnterFrameEvent(event : Event) : void
        {
            if ( _printOutIndex == _numPrintOuts )
            {
                stopAddPagesOnEnterFrame();
 
                _printJob.send();
                trace( getTimer(), "PrintJob.send()" );
            }
            else
            {
                addPage( _printOutIndex++ );
            }
        }
 
        private function stopAddPagesOnEnterFrame() : void
        {
            removeEventListener( Event.ENTER_FRAME, onAddPagesOnEnterFrameEvent );
        }
 
        private function addPage( pageIndex : int ) : void
        {
            var page : Sprite = createPrintPage( pageIndex );
 
            stage.addChild( page );
 
            var viewWidth : Number = page.width;
            var viewHeight : Number = page.height;
 
            var scaleX : Number = _printJob.pageWidth / viewWidth;
            var scaleY : Number = _printJob.pageHeight / viewHeight;
            var scale : Number = Math.min( scaleX, scaleY );
 
            page.scaleX = page.scaleY = scale;
 
            var printRect : Rectangle = new Rectangle( 0, 0, viewWidth, viewHeight );
 
            try
            {
                _printJob.addPage( page, printRect );
            }
            catch( e: Error )
            {
                trace( getTimer(), "PrintJob.addPage() failed" );
            }
 
            stage.removeChild( page );
        }
 
        private function createPrintPage( pageIndex : int) : Sprite
        {
            var page : Sprite = new Sprite();
 
            var textField : TextField = new TextField();
                textField.autoSize = TextFieldAutoSize.LEFT;
                textField.text = "Page " + pageIndex;
 
            page.addChild( textField );    
 
            return page;
        }
    }
}

Posted in Flash, Flash in Browser, Flash Player | Tagged , | 5 Comments