Home > Articles > Web Development > Dreamweaver & Flash

  • Print
  • + Share This
This chapter is from the book

Understanding the Limits of Flash

There are some limitations to using the iPhone Packager for Flash CS5 (New!). The first is that you cannot load external SWF movies. You can, however, load external JPG and PNG files and sound files such as MP3.

There are also performance problems between different versions of the iPhone. For instance, the iPhone 3GS is literally twice as fast as the iPhone 3G and original iPhone. There some simple tricks you can do to speed up things. The following code will prevent event Bubbles starting:

override public function dispatchEvent(evt:Event):Boolean {
if (hasEventListener(evt.type) || evt.bubbles) {
return super.dispatchEvent(evt);
}
return true;
}

A second optimization trick you can do is to restrict your use of vector based images inside of Flash. Use PNG formatted images where possible. The good news is that that the iPhone has great support for PNG files.

If you do need to use vector images you can fool the iPhone into thinking it’s a bitmap image by using the cahceAsBitmapMatrix.

  • orange-circle-1.jpg Create a new image. Add code import the Flash Geom Matrix:
    import flash.geom.Matrix;
    
  • orange-circle-2.jpg Create a new shape:
    var my_shape :MyShape = new MyShape();
    addChild(my_shape);
    
  • orange-circle-3.jpg Add the cachasBitmap property to ensure that all objects that create are cached:
    my_shape.cacheAsBitmap = true;
    my_shape.cacheAsBitmapMatrix = new Matrix();
    
  • orange-circle-4.jpg Create images on the screen that the iPhone thinks are bitmaps.

A final significant limitation is the use of audio files. Audio files can have a short delay between an event happening and the sound playing. This is because the audio file is not in the iPhone’s cache for playback. You can avoid this by exporting your audio file to be triggered in the first frame of your movie.

What Flash Does Not Allow You To Do

Adobe has gone to great lengths to allow you to build applications for the iPhone using traditional Flash tools. BUT (and it is a big BUT) there are some things that Flash does not allow you to do using the iPhone Packager.

The biggest challenge you will have is the inability to use ActionScript 1.0 and 2.0. All of your apps must be developed using ActionScript 3.0. There are tens of thousands of great ActionScript 1.0 and 2.0 apps that can not be published to the iPhone due to the ActionScript 3.0 limitation.

You also have to be careful using video. Only Flash Video will work. You can use a URL link to load a MPEG4 video, but this is really a cheat as you are running the video through the iPhone’s Mobile Safari Web browser.

If you are familiar developing iPhone Apps using the iPhone SDK then you may expect core iPhone Cocoa Touch kits available to you in Flash. This includes the StoreKit (for “in App purchase”), GameKit, MapKit and other rich media tools. These useful kits are simply not available to the Flash developer.

The good news is that Adobe is well aware that the Flash CS5 iPhone Packager is not complete. Expect releases for the iPhone Packager to keep coming during the lifecycle of Flash CS5.

  • + Share This
  • 🔖 Save To Your Account