Tag Archives: Professional

REVIEW: Adobe Digital Publishing Suite

The Overlay Creator

The Overlay Creator panel is the DPS component that InDesign designers will spend most of their time in. The Overlay Creator panel, a plugin that works with InDesign CS5 and later, is the interface for adding multimedia and interaction to InDesign files for inclusion in digital publications. You can add a variety of interactive features to InDesign documents, not all of which are new to InDesign:

  • Image Sequences display multiple images, which has a variety of applications including time-lapse sequences, animated clips and 360-degree views. Image Sequences can auto-play or respond to user “scrubbing.”
  • Audio & Video insert audio and video assets into InDesign documents. Thanks to the multimedia features that have been added to InDesign in the past few years, adding audio and video is easy to do and the media controls generated by InDesign are good.
  • Hyperlink overlays will add links to your digital publications that link to online content, articles within the publication and more. Quick tip: Apple provides a method to write hyperlinks that send SMS text messages. Apple has a URL Scheme Reference that explains how to build these links.
  • Like the Image Sequence, the Slideshow overlay displays a slideshow in digital publications. Think of Slideshow as a traditional slideshow, incorporating InDesign elements including text and graphics, while Image Sequence is more of a “flip book” slideshow format with only images.
  • Pan & Zoom is one of my favorites, allowing users to pinch and expand images in digital publications. The designer has to think ahead when using Pan & Zoom and insert large images in their graphic frames. These can be scaled down to the desired default view, but the digital publication will retain the full-resolution image so it can be blown up when the user enlarges it. The DPS does not enlarge images on its own.
  • Panorama will combine multiple images into a panorama. This can be tricky because the user needs to load six photographs into InDesign with the right angle and order so it can be stitched together automatically. There are also some esoteric settings in the Overlay Creator including field of view and limit vertical pan. Reading through the instructions and a little playing around with the controls will help users grasp the Panorama overlay, and there are tutorials online for shooting images to be stitched into panoramas.
  • Web Content, which used to be called “Web View,” will embed online webpages or an HTML file within digital publications. It’s really surprising and very cool to see a webpage loaded in an InDesign publication, but it works and users can even interact with the webpage. The process is actually fairly easy to implement.

Creating interactivity with the Overlay Creator does a good job of condensing extensive interaction into a panel with a few settings, but I think Adobe’s development team can make the process more intuitive, particularly with bringing multimedia onto the page. The current InDesign has a lot of panels to sift through and the Overlay Creator adds quite a bit more chrome to the package. Keeping track of all the user interface elements involved with Overlay Creator was my biggest challenge, not bugs or a lack of interactive features.

The Folio Builder

The other component of DPS that resides in InDesign is the Folio Builder panel, where users combine articles into .folio files for publication and also finalize the document’s orientation. Working with articles and folios can be a mundane task but this part of the process is where designers can see their work on a tablet for the first time through the Content Viewer, an Adobe app available on the desktop or on the Apple App Store, Android Market, BlackBerry App World and for webOS.

Articles can be pulled from multiple documents, so you can build a horizontal and vertical version of a publication and combine it into one app in the Folio Builder. Creating two versions of a publication is not ideal, but it’s necessary if you want a publication that changes orientation properly. Adobe seems to be at least on the right track in creating “liquid layouts” in InDesign that will re-orient themselves depending on the orientation, which would be a wonderful new feature. Here’s a demo of the technology at Adobe MAX.

Adding articles and pushing folios up to the Content Viewer is most of what the Folio Builder does, but there are also some sharing features which I think is very important in a production environment. The Folio Builder panel’s menu has a Share option which will let users share a publication with other users who have an Adobe ID. You can also append a subject and message to the share notice. This is very useful but I would also like an interface in the DPS website where you can set up groups of multiple users so you can grant rights and share folios with groups of people at once. This is what I do when developing Facebook applications. Even though you can share to multiple individuals at once in Folio Builder, groups and shared rights make collaboration easier.

Sky’s the Limit: AKQA Shows the Possibilities with Flash CS4 (Part 3 of 3)

NOTE: This is one of three articles commissioned by Adobe and written by separate design agencies to demonstrate the variety of techniques available in Flash CS4 Professional. In these examples, three techniques are shown for creating realistic fireworks effects; all require intermediate to advanced ActionScript 3 skills. Enjoy! —Jeremy Schultz

Introduction by Kristan Jiles, Senior Product Marketing Manager, Adobe Systems Incorporated

Three design agencies that are given an identical initial directive, using the same tool, will return with very different project results. The creative process is essential in determining the end result; it’s how professionals use their tools to bring their work to life. We asked design agencies AgencyNet, AKQA and Vasava to develop a tutorial on how to create a fireworks display using Adobe Flash CS4 Professional to demonstrate how the same tool used to design the same project can yield such unique and differing results. At Adobe, we’re inspired by seeing how each creative uses their knowledge of the product to create amazing and fun projects that can be shared with others. Flash was developed to provide a variety of design and development options for any project and this is only one example. With animation, 3D transformation, rich drawing capabilities, and ActionScript development, we encourage designers and developers to continue experimenting with Flash to produce amazing work!

Tutorial by AKQA

When trying to imitate nature and real-life motion, a significant understanding of math and physics is necessary. To create realistic fireworks shows in Flash involve some kind of particle effect. Making a particle engine from scratch to achieve the effect is not a particular easy task. It requires a certain level of math knowledge on the part of the Flash developer, and is a meticulous time intensive task.

Like any good cooking show, we cheat a little, and rely on one of the publicly available ActionScript engines that have most of the heavy lifting built-in. For this project we’ve chosen to utilize the Flint particle system, which allow developers of almost all levels to create a variety of particle effects with ease. Flint is also one of the more complete particle engines API made for AS3 that is easy to understand and use. It is an active open-source project with the support of a community on their website. Thanks for lending a hand guys!

In this tutorial, we will show you how to use Flint to easily create a cool fireworks effect that not only seems real, but also forms any desired graphic you specify. To showcase this we’ve chosen the AKQA logo.

akqa-image-1

Setup

1. Go to http://code.google.com/p/flint-particle-system/ and download the Flint Particle System codebase.

2. Create the desired PNG image with transparency for the fireworks to emulate. In this tutorial, we use the AKQA logo:

akqa-image-2

3. Create your class to hold the graphic. Make sure it extends the BitmapData class. In this case we are creating it for our logo:

akqa-image-3

4. Create a new FLA for your fireworks and name it Fireworks.fla.

5. Import your PNG into your library, then link your class from Step 3 to the PNG:

akqa-image-4

6. Create a new class, name it Fireworks.as, and use it as your document class:

akqa-image-5

7. Go to http://flintparticles.org/examples/logo-firework and copy the code from the demo and paste it into your document class from Step 6.

8. We are ready to do some coding.

Coding

1. Before we can edit the code to make the fireworks look right in our file, let’s first see what each line does.

Standard instantiating code:

var emitter:Emitter2D = new Emitter2D();
1500 denotes the amount of particles to create:
emitter.counter = new Blast( 1500 );

The particles use colors randomly picked between the two values given below:

emitter.addInitializer( new ColorInit( 0xFFFF3300, 0xFFFFFF00 ) );

How long this sequence of particles last before getting destroyed:

emitter.addInitializer( new Lifetime( 6 ) );

The DiscZone defines a circular area with a hole in the middle, telling where to start the particles:

emitter.addInitializer( new Position( new DiscZone( new Point( 0, 0 ), 10 ) ) );

Pass the PNG to the particles engine to emulate:

var bitmapData:BitmapData = new Logo( 265, 80);

Because the particles are moving according to Flash’s coordinate system, which is based on top left corner, the particles will move in a lower-right direction. Since the fireworks need to explode from the center, the values “-132” and “-300” offset the particles’ direction so that they are shooting out from the center:

emitter.addInitializer( new Velocity( new BitmapDataZone( bitmapData, -132, -300 ) ) );

The following lines do the actual explosion of the fireworks and are pretty self-explanatory (If you’re on Eclipse or Flex, make sure Quadratic comes from the org.flintparticles.common.energyEasing package or it throws a wrong number of parameters compile error if it comes from another package):

emitter.addAction( new Age( Quadratic.easeIn ) );
emitter.addAction( new Fade( 1.0, 0 ) );
emitter.addAction( new Move() );
emitter.addAction( new LinearDrag( 0.5 ) );
emitter.addAction( new Accelerate( 0, 70 ) );

Restart the sequence once this sequence is complete:

emitter.addEventListener( EmitterEvent.EMITTER_EMPTY, restart );

Tells the engine the area to draw the particles:

var renderer:PixelRenderer = new PixelRenderer( new Rectangle( 0, 0, 500, 300 ) );

Gives it a BlurFilter which seems to emulate fireworks’ sparks:

renderer.addFilter( new BlurFilter( 2, 2, 1 ) );

Gives a ColorMatrixFilter which helps to add to the realistic feel of the fireworks:

renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0.96,0 ] ) );

Tie it all together:

renderer.addEmitter( emitter );

Add to display list:

addChild( renderer );

Position the particles emitter:

emitter.x = 250;
emitter.y = 300;

Have to call start() to get it going:

emitter.start( );

2. Now we need to pass our PNG to the fireworks so the particle engine knows what graphic to emulate.

We do this by changing the following two lines of code:

var bitmapData:BitmapData = new Logo( 265, 80);
emitter.addInitializer( new Velocity( new BitmapDataZone( bitmapData, -132, -300 ) ) );

to take our logo:

var bitmapData:BitmapData = new AKQALogo( 0, 0);
emitter.addInitializer( new Velocity( new BitmapDataZone( bitmapData, -bitmapData.width / 2, -bitmapData.height/2 - 50) ) );

3. Finally, knowing what the other values represent we adjust them to fit our file. The following is the complete source code from the class Fireworks.as:

package com.akqa.tutorials.fireworks
{
import flash.events.Event;
import com.akqa.mvc.AbstractSprite;
import org.flintparticles.common.actions.Age;
import org.flintparticles.common.actions.Fade;
import org.flintparticles.common.counters.Blast;
import org.flintparticles.common.energyEasing.Quadratic;
import org.flintparticles.common.events.EmitterEvent;
import org.flintparticles.common.initializers.ColorInit;
import org.flintparticles.common.initializers.Lifetime;
import org.flintparticles.twoD.actions.Accelerate;
import org.flintparticles.twoD.actions.LinearDrag;
import org.flintparticles.twoD.actions.Move;
import org.flintparticles.twoD.emitters.Emitter2D;
import org.flintparticles.twoD.initializers.Position;
import org.flintparticles.twoD.initializers.Velocity;
import org.flintparticles.twoD.renderers.PixelRenderer;
import org.flintparticles.twoD.zones.BitmapDataZone;
import org.flintparticles.twoD.zones.DiscZone;
import flash.display.BitmapData;
import flash.filters.BlurFilter;
import flash.filters.ColorMatrixFilter;
import flash.geom.Point;
import flash.geom.Rectangle;
/**
* @author kenny lin
*/
public class Fireworks extends AbstractSprite
{
// how many particles to generate
private var particleAmount:Number = 1500;
// how long the fireworks last
private var lifeSpan:Number = 6; // seconds
// thickness of the area populated by particles
private var thickness:Number = 3;
// the BitmapData used as a guide for the fireworks to generate
private var bitmapData:BitmapData = new AKQALogo();
/*
* The fireworks shoot lower-right by default
* The following correct the direction (try setting them to 0 to see what happens)
*/
private var correctLogoOffsetX:Number = 0;
private var correctLogoOffsetY:Number = 0;
public function Fireworks()
{
correctLogoOffsetX = -bitmapData.width / 2;
correctLogoOffsetY = -bitmapData.height/2 - 50;
}
/*
* Because I want to reference the stage's dimension
* I set up all my stuff after it's been added to stage
*/
override protected function onAddedToStage(e:Event):void
{
// call super to remove event
super.onAddedToStage(e);
// setup starts
var emitter:Emitter2D = new Emitter2D();
emitter.counter = new Blast( particleAmount );
emitter.addInitializer( new ColorInit( 0xFFFF3300, 0xFFFFFF00 ) );
emitter.addInitializer( new Lifetime( lifeSpan ) );
emitter.addInitializer( new Position( new DiscZone( new Point( 0, 0 ), thickness ) ) );
emitter.addInitializer( new Velocity( new BitmapDataZone( bitmapData, correctLogoOffsetX, correctLogoOffsetY ) ) );
emitter.addAction( new Age( Quadratic.easeIn ) );
/*
* Play around the the following to get the ideal effect
*/
emitter.addAction( new Fade( 1.0, 0 ) );
emitter.addAction( new Move() );
emitter.addAction( new LinearDrag( 0.5 ) );
emitter.addAction( new Accelerate( 0, 70 ) );
emitter.addEventListener( EmitterEvent.EMITTER_EMPTY, restart, false, 0, true );
// defines the area to draw all the particles on, in this case the size of stage
var renderer:PixelRenderer = new PixelRenderer( new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight ) );
renderer.addFilter( new BlurFilter( 2, 2, 1 ) );
renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0.96,0 ] ) );
renderer.addEmitter( emitter );
addChild( renderer );
emitter.x = stage.stageWidth/2;
emitter.y = stage.stageHeight/2;
emitter.start( );
}
private function restart( ev:EmitterEvent ):void
{
Emitter2D( ev.target ).start();
}
}
}

Click here to see the final result!

And there you have it, a short and simple way of creating a spectacular fireworks show. Now go ahead and try, write your loved one’s name in the sky, or shamelessly promote yourself and use your company logo. Play with colors and shapes to create something just right for you!

Sky’s the Limit: AgencyNet Shows the Possibilities with Flash CS4 (Part 2 of 3)

NOTE: This is one of three articles commissioned by Adobe and written by separate design agencies to demonstrate the variety of techniques available in Flash CS4 Professional. In these examples, three techniques are shown for creating realistic fireworks effects; all require intermediate to advanced ActionScript 3 skills. Enjoy! —Jeremy Schultz

Introduction by Kristan Jiles, Senior Product Marketing Manager, Adobe Systems Incorporated

Three design agencies that are given an identical initial directive, using the same tool, will return with very different project results. The creative process is essential in determining the end result; it’s how professionals use their tools to bring their work to life. We asked design agencies AgencyNet, AKQA and Vasava to develop a tutorial on how to create a fireworks display using Adobe Flash CS4 Professional to demonstrate how the same tool used to design the same project can yield such unique and differing results. At Adobe, we’re inspired by seeing how each creative uses their knowledge of the product to create amazing and fun projects that can be shared with others. Flash was developed to provide a variety of design and development options for any project and this is only one example. With animation, 3D transformation, rich drawing capabilities, and ActionScript development, we encourage designers and developers to continue experimenting with Flash to produce amazing work!

Tutorial by AgencyNet (Flash 10 required)

Step 1: Preheat oven to 350 degrees.

Firstly, let’s setup the Flash stage and main FLA:

  1. Create a new Flash File (ActionScript 3.0).
  2. Set the size of the stage to 1000 x 500 (although your favorite size will work just fine).
  3. Set the background color of the stage to black or your preferred night sky color.
  4. Set the FPS to 30.
  5. Save your file as Fireworks.fla in a clean folder.

Now create a new Symbol (Insert > New Symbol):

create

  1. Name the symbol Firework Particle.
  2. In the Linkage group, check Export for ActionScript.
  3. Enter the Class name FireworkParticle (should be filled-in by default!).
  4. Click OK.

On the symbol, create a star by drawing a 2×2 yellow circle, and two 0.5 lines forming a cross, like so:

star

Alternatively, you can insert your favorite star bitmap, preferably no larger than 5×5 pixels or so.

Step 2: Bake until golden brown.

Now that we’re all setup, let’s create three .AS files in the same directory as the FLA. (File > New > ActionScript File):

  1. Fireworks.as – This will be our new stage class.
  2. Firework.as – This class will represent one launch/burst of a single firework.
  3. FireworkParticle.as – This class will support the Firework Particle clip we created earlier.

Briefly jump back to your Fireworks.fla file, and (ensuring nothing is selected), set the Document Class to Fireworks.

setup

In Fireworks.as, paste the following code:

package
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.utils.Timer;
// Stage class, handles creation of fireworks and main timer
public class Fireworks extends MovieClip
{
public static const TIMER_BASE:Number = 900;
public static const TIMER_RANDOM:Number = 200;
public static const MAIN_TIMER_UPDATE_INTERVAL:Number = 20;
public static const MAX_FIREWORKS:Number = 7;
private var launch_timer:Timer;
private var main_timer:Timer;
// Stage class constructor
public function Fireworks()
{
startTimer();
main_timer = new Timer(MAIN_TIMER_UPDATE_INTERVAL);
main_timer.addEventListener(TimerEvent.TIMER, handleRuntime);
main_timer.start();
}
// Handler: TimerEvent.TIMER (main_timer)
private function handleRuntime(event:TimerEvent):void
{
for(var i = 0; i < numChildren; i++) { var firework = getChildAt(i) as Firework; firework.update(); } } // Handler: TimerEvent.TIMER (launch_timer) private function handleTimer(event:TimerEvent):void { launch_timer.removeEventListener(TimerEvent.TIMER, handleTimer); // Prevent from having too many at once if(numChildren < MAX_FIREWORKS) { var firework = new Firework(); firework.addEventListener(Event.COMPLETE, removeFirework); addChild(firework); } startTimer(); } // Launch new firework private function startTimer():void { var duration = TIMER_RANDOM * Math.random() + TIMER_BASE; launch_timer = new Timer(duration, 1); launch_timer.addEventListener(TimerEvent.TIMER, handleTimer); launch_timer.start(); } // Handler: Event.COMPLETE (removes firework after it is completed) private function removeFirework(event:Event):void { var firework = event.target as Firework; removeChild(firework); firework = null; } } }

In Firework.as, paste the following code:

package
{
import flash.display.Bitmap;
import flash.display.BitmapData
import flash.display.MovieClip;
import flash.events.Event;
import flash.geom.ColorTransform;
import flash.geom.Vector3D;
// Firework explosion and launch
public class Firework extends MovieClip
{
public static const GRAVITY:Vector3D = new Vector3D(0, 0.018);
public static const LAUNCH_SPEED_X:Number = 0;
public static const LAUNCH_SPEED_Y:Number = -7;
public static const LAUNCH_PARTICLE_ALPHA:Number = 0.03;
public static const PARTICLE_RANDOM:Number = 30;
public static const PARTICLE_BASE:Number = 10;
public static const BITMAP_SIZE:Number = 300;
public static const BITMAP_OFFSET:Number = 150;
public static const DISPERSION_MULTIPLIER:Number = 1;
private var exploded:Boolean = false;
private var launching_particle:FireworkParticle;
private var particle_count:Number;
private var blit_array:Array;
private var trail_bitmap:Bitmap;
private var completed_particles:Number = 0;
private var particle_transform:ColorTransform;
private var transform_colors:Array = new Array
(
new ColorTransform(1, 1, 1, 0.92), // White
new ColorTransform(1, 0.9, 0.9, 0.92), // Red
new ColorTransform(0.9, 1, 0.9, 0.92), // Green
new ColorTransform(0.7, 0.9999, 1, 0.92), // Blue
new ColorTransform(1, 1, 0.9, 0.92), // Yellow
new ColorTransform(1, 1, 1, 0.5) // Black
);
// Firework constructor
public function Firework()
{
// Pick a random particle count and a random color for the trails
particle_count = Math.round(Math.random() * PARTICLE_RANDOM + PARTICLE_BASE);
particle_transform = transform_colors[Math.floor(Math.random()*transform_colors.length)];
addEventListener(Event.ADDED_TO_STAGE, handleAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, handleRemovedFromStage)
}
// Update: called by main timer
public function update():void
{
if(exploded)
{
for(var i = 1; i < numChildren; i++) { var particle = getChildAt(i); particle.update(GRAVITY); if(particle.alpha <= 0 && particle.alive) { particle.alive = false; completed_particles++; if(completed_particles >= particle_count)
{
dispatchEvent(new Event(Event.COMPLETE));
return;
}
}
}
}
else
{
launching_particle.oscillate();
launching_particle.update(GRAVITY, LAUNCH_PARTICLE_ALPHA);
if(launching_particle.y < BITMAP_OFFSET) { removeChild(launching_particle); explode(); } } // Blitting var newBitmapData:BitmapData = new BitmapData(width, height, true, 0x000000); newBitmapData.draw(this, null, particle_transform, null, null, true); blit(newBitmapData); } // Handler: Event.ADDED_TO_STAGE private function handleAddedToStage(event:Event):void { // Initialize random target position on stage x = (stage.stageWidth) * Math.random() - BITMAP_OFFSET; y = (stage.stageHeight) * Math.random() - BITMAP_OFFSET; // Initialize bitmap and container trail_bitmap = new Bitmap(); addChild(trail_bitmap); blit_array = new Array(); launching_particle = new FireworkParticle(); launching_particle.y = stage.stageHeight - y; launching_particle.init(LAUNCH_SPEED_X, LAUNCH_SPEED_Y, false); addChild(launching_particle); } // Handler: Event.REMOVED_FROM_STAGE private function handleRemovedFromStage(event:Event):void { destroyBitmaps(); } // Explode firework private function explode():void { // Initialize particles for(var i = 0; i < particle_count; i++) { var explodeworkParticle:FireworkParticle = new FireworkParticle(); explodeworkParticle.init(Math.sin((Math.PI*2 / particle_count) * i + Math.random()*DISPERSION_MULTIPLIER), Math.cos((Math.PI*2 / particle_count) * i + Math.random()*DISPERSION_MULTIPLIER)); addChild(explodeworkParticle); } exploded = true; } // Update trail_bitmap with fresh BitmapData private function blit(bitmapData:BitmapData):void { trail_bitmap.bitmapData = bitmapData; if(blit_array.length < 1) { blit_array.push(bitmapData); } else { blit_array.push(bitmapData); // Destroy old bitmap data var oldBitmapData:BitmapData = blit_array.shift(); oldBitmapData.dispose() oldBitmapData = null; } } // Clean up any lingering bitmaps after being being removed from stage private function destroyBitmaps():void { var imagesLeft:int = blit_array.length; for(var i = 0; i < imagesLeft; i++) { var img:BitmapData = blit_array[i] as BitmapData; img.dispose(); img = null; } } } }

Finally, in FireworkParticle.as, paste the following code:

package
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.geom.Vector3D;
// Firework particle
public class FireworkParticle extends MovieClip
{
public static const NORMALIZE_POSSIBILITY:Number = 0.7;
public static const SPEED_MULTIPLIER:Number = 1.2;
public static const OSCILLATE_AMPLITUDE:Number = 3;
public static const OSCILLATE_FALLOFF:Number = 150;
public var direction:Vector3D;
public var alive:Boolean = true;
private var frame_counter:Number = 0;
// Constructor
public function FireworkParticle()
{
x = 150;
y = 150;
cacheAsBitmap = true;
}
// Initialize particle direction and normalize
public function init(direction_x:Number, direction_y:Number, possible_normalize:Boolean = true):void
{
direction = new Vector3D(direction_x, direction_y);
if(Math.random() < NORMALIZE_POSSIBILITY && possible_normalize) { direction.normalize(); } direction.scaleBy(SPEED_MULTIPLIER); } // Shake particle side to side public function oscillate():void { direction.x += Math.sin(frame_counter / OSCILLATE_AMPLITUDE) * (frame_counter / OSCILLATE_FALLOFF); } // Update position, alpha, and framecounter (called by parent) public function update(gravity:Vector3D, delta_alpha = 0.005):void { direction = direction.add(gravity); x += direction.x; y += direction.y; alpha -= delta_alpha; frame_counter++; } } }

And voila! Make sure to save all files, and publish the Fireworks.fla to see some fireworks!

Step 3: Add salt and pepper to taste!

Now that you have some fabulous fireworks, turn your attention to the static constants (THEY_LOOK_LIKE_THIS) towards the top of the Fireworks.as, Firework.as, and FireworkParticle.as. These are constants that modify the behavior of the fireworks—feel free to tweak them to get the desired effect!

To kick things up a notch, you can also add a quick starfield, so that the fireworks have a nicer backdrop than plain black!

Here's one we put together (save it as Starfield.as):

package
{
import flash.display.Bitmap;
import flash.display.BitmapData
import flash.display.MovieClip;
import flash.events.Event;
import flash.geom.ColorTransform;
import flash.geom.Matrix;
// Starfield backdrop
public class Starfield extends MovieClip
{
public static const STAR_AMOUNT:Number = 500;
public static const STAR_ALPHA_MAX:Number = 0.4;
// Constructor
public function Starfield()
{
cacheAsBitmap = true;
addEventListener(Event.ADDED_TO_STAGE, handleAddedToStage);
}
// Handler: Event.ADDED_TO_STAGE
private function handleAddedToStage(event:Event):void
{
var bitmap:Bitmap = new Bitmap(new BitmapData(stage.stageWidth, stage.stageHeight, false, 0x000000));
var star:FireworkParticle = new FireworkParticle();
var translation_matrix:Matrix = new Matrix();
var color_transform:ColorTransform = new ColorTransform();
for(var i = 0; i < STAR_AMOUNT; i++) { var scale = Math.random() * 1.5 - 0.5; translation_matrix.a = scale; translation_matrix.d = scale; translation_matrix.tx = Math.random() * stage.stageWidth; translation_matrix.ty = Math.random() * stage.stageHeight; color_transform.alphaMultiplier = Math.random() * STAR_ALPHA_MAX; bitmap.bitmapData.draw(star, translation_matrix, color_transform, null, null, true); } addChild(bitmap); } } }

To add it to stage, save the file in the same directory then, in the Fireworks constructor (public function Fireworks()), add the following code after the {

addChild(new Starfield());

Then, in the handleRuntime function, change the line that reads for(var i = 0; i < numChildren; i++) to: for(var i = 1; i < numChildren; i++)

This ensures we ignore the starfield when updating the fireworks.

Have fun, and enjoy the show!

See the final result!

Sky’s the Limit: Vasava Shows the Possibilities with Flash CS4 (Part 1 of 3)

NOTE: This is one of three articles commissioned by Adobe and written by separate design agencies to demonstrate the variety of techniques available in Flash CS4 Professional. In these examples, three techniques are shown for creating realistic fireworks effects; all require intermediate to advanced ActionScript 3 skills. Enjoy! —Jeremy Schultz

Introduction by Kristan Jiles, Senior Product Marketing Manager, Adobe Systems Incorporated

Three design agencies that are given an identical initial directive, using the same tool, will return with very different project results. The creative process is essential in determining the end result; it’s how professionals use their tools to bring their work to life. We asked design agencies AgencyNet, AKQA and Vasava to develop a tutorial on how to create a fireworks display using Adobe Flash CS4 Professional to demonstrate how the same tool used to design the same project can yield such unique and differing results. At Adobe, we’re inspired by seeing how each creative uses their knowledge of the product to create amazing and fun projects that can be shared with others. Flash was developed to provide a variety of design and development options for any project and this is only one example. With animation, 3D transformation, rich drawing capabilities, and ActionScript development, we encourage designers and developers to continue experimenting with Flash to produce amazing work!

Tutorial by Enric Godes, project manager, Vasava

To develop the fireworks we used the Tweener caurina Stable version 1.33.74, ActionScript 3 (Flash 9+) library. This library can be downloaded from http://code.google.com/p/tweener/downloads/list. And, of course, we used Adobe Flash CS4 Professional.

1. Change the flash movie to 800×600 and 65 FPS (see below).

vasava-image-1

2. Draw a 4 px circle and transform it on symbol by pushing F8.

3. Edit the MovieClip and animate it from left to right on a straight line: These are the sprinkles going away from the center of the firework. We used a shape interpolation; later you can try some different animation types and change the timing to see new results. Insert a stop on the last frame (see below).

vasava-image-3

4. Find the MovieClip on the library and use the right button to open the properties window on the class field and change it to “Particle.” (See below).

vasava-image-4

5. Make a new symbol and put it on the scene. On the properties window change it to “nightSky.” This is where we will put the fireworks.

6. And now the coding. First, import the classes we are going to use:

import caurina.transitions.Tweener;
import flash.events.*;

7. Next, define the movie vars:

var fwParticlesCount:uint=200; // particles in each explosion
var fwTimer:uint=2000; // time between explosions
var timer:Timer = new Timer(fwTimer); // this adds a timer, in each step of the timer it will call fire() function
timer.addEventListener(TimerEvent.TIMER, fire);
timer.start();

8. We want to use a lot of random numbers, so we created the following function to save some time:

function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.random() * (max - min + 1) + min;
return randomNum;
}

9. And now the main function which is putting the particles in a circle, animating them, and setting their opacity and position:

function fire(event:TimerEvent){
// the origin coordinate for the firework
var x0:uint=randRange(100,700);
var y0:uint=randRange(100,500);
// now i'm going to create and define the properties of each particle in the firework
for(var i:uint=0;i> onComplete:function(){nightSky.removeChild(this);delete this}});}
}

See the final result!

Enric Godes is a project manager at Vasava. Started in Barcelona in 1997, Vasava is a communication studio with 18 young designers who specialize in cross-media projects: print, web, motion, 3D animation, and video. To unleash creativity and meet the deadline-driven demands of clients, Vasava relies on the integrated, cross-discipline tools found in Adobe Creative Suite Master Collection software.

BOOK REVIEW: ActionScript 3.0 Classroom In A Book

as3-classroom

Remember “Training From The Source”? This was the name of Macromedia‘s official line of training books for Dreamweaver, Flash and other design applications. When ActionScript 2.0 was released I bought the book Flash MX 2004 ActionScript Training From The Source to learn that new version of the Flash programming language. I carried that large book through many airports and conferences, chipping away at its pages over the course of a few years.

By the time I was finished with that book, ActionScript had moved forward again to version 3.0, Macromedia was no more (having been acquired by Adobe) and “Training From The Source” was folded into Adobe’s own “Classroom In A Book” series. I thought it fitting to review the series recently with a look at ActionScript 3.0 for Adobe Flash CS4 Professional Classroom In A Book.

Small, compact, solid

Compared to the Training From The Source book, which was a large book in both page count and size, Classroom In A Book is smaller in both respects. I actually appreciate the smaller size because it increases portability. The book design is sharp, with a matte finish cover that is easier to handle and a clear layout design that aids learning. I was surprised the author, Chris Florio, had a laid-back, informal writing style—one would expect a workbook like this to have a no-nonsense tone—but I could appreciate a bit of levity after working on the exercises for hours at a time.

A different approach to ActionScript training

Classroom In A Book has roughly half the pages of its Training From The Source predecessor, so either ActionScript 3.0 is less complex than version 2.0 or the book doesn’t cover everything. It’s actually a combination of three things:

  • ActionScript 3.0 really is less complex than ActionScript 2.0, though it’s more verbose; the distinction is comparable to HTML and the more strict XHTML. Syntax is streamlined and coding skills apply to everything in a more uniform way.
  • Classroom In A Book doesn’t cover everything. Some topics such as CSS aren’t covered at all, while others (like classes) aren’t covered in their entirety. That might be a good thing, since ActionScript has always been a large language with many classes and elements. It seems this book is designed to teach essential ActionScript skills and leave minutiae to other resources.
  • Classroom In A Book is project-oriented, while Training From The Source was skill-oriented. Both books have projects to work on (and ship with a CD-ROM full of good project materials) but Training From The Source focused on skills such as handling text fields, XML, conditional logic, debugging and so on. Classroom In A Book thinks more in terms of building preloaders, loading content, creating quizzes and working with XML and video. Both approaches are good and Classroom In A Book teaches a great deal if one completes the exercises, but it’s not necessarily a compendium of ActionScript knowledge like Training From The Source was. It complements other sources such as the ActionScript 3.0 reference files, accessible directly from Flash.

Conclusion

ActionScript 3.0 for Adobe Flash CS4 Professional Classroom In A Book is worth buying, and particularly helpful for new Flash users who don’t know ActionScript or experienced Flash users who have not yet upgraded their skills to include ActionScript 3.0. The language really has made a sea change from ActionScript 2.0 and learning it requires training. Classroom In A Book is a good place to start.

ActionScript 3.0 for Adobe Flash CS4 Professional Classroom In A Book
Published by Adobe Press
US$54.99
Rating: 9/10