ebook img

Flash MX Studio PDF

698 Pages·2002·32.827 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Flash MX Studio

Flash MX Studio Dennis Baldwin Jamie Macdonald Keith Peters Jon Steer David Tudury Jerome Turner Steve Webster Alex White Todd Yard / Flash MX Studio © 2002 Springer Science+Business Media New York Originally published by Friends of ED in 2002 All rights reserved. No part of this book may be reproduced, stored in a retrieval system or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical articles or reviews. The authors and publisher have made every effort in the preparation of this book to ensure the accuracy of the information. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, friends of ED nor its dealers or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book. Reprinted October 2002 Trademark Acknowledgements Additional material to this book can be downloaded from http://extras.springer.com ISBN 978-1-59059-188-8 ISBN 978-1-4302-5166-8 (eBook) DOI 10.1007/978-1-4302-5166-8 / Flash MX Studio Credits Authors Author Agent Dennis Baldwin Chris Matterface Jamie Macdonald Keith Peters Project Manager Jon Steer Simon Brand David Tudury Jerome Turner Technical Reviewers Steve Webster Sally Cruikshank Alex White Steve Kirby Todd Yard Steve McCormick Mike Pearce Additional Material Jon Steer Kristian Besley Steve Webster Steven Williams Commissioning Editor Jim Hannah Indexer Fiona Murray Graphic Editor Ty Bhogal Proofing Cathy Succamore Editors Adam Dutton Managing Editor Caroline Robeson Ben Huczek James Robinson Gavin Wray / Flash MX Studio Alex White: Coming from a Fine Art background, Alex once did 'arty' things with Director and obscure Mac 3D modelling programs, before selling out and moving to the big city making fancy Flash web sites for companies who could afford it. He has recently combined creative forces with fellow 'Messenger Buddy' Jez Turner for their 'ground-breaking' Flatpack Media venture. Thanks go out to Jez at the 'Poole office', Claire for the countless hearty meals, and mum for her moral support. David Tudury: David discovered Flash while interning in San Francisco three years ago. Since then he's worked in advertising, plug-in development, and online-gaming. The volatile economy quickly added some breadth to his experience. He's used Flash for simple animations, web sites, video games, and as a presentation layer for N-tier web applications. Mostly though, he just likes playing with it (www.outmoded.com is his playground). "I need to thank Aaron Piland of www.apakstudio.com for the terrific portrait, Michael Montagna for helping with possible XML examples, Adam Dutton who edited (fixed) this chapter, Keith Peters who got me this opportunity, the other good folks at www.were-here.com, and Regina, my fiance, for understanding that computer people aren't supposed to sleep at night." Dennis Baldwin: Dennis' main focus is to stay on top of technology and find exciting new ways to push the envelope of web development. He currently maintains a couple of online resources for Flash and ColdFusion developers at www.flashcfm.com and www.devmx.com. He is also the lead developer for Eternal Media (www.eternal-media.com), a web and multimedia firm that offers technology solutions for ministries and non-profit organizations. When he's not in front of the computer screen, Dennis mainly spends time with his wife Jamie or can be found skating around the streets of Dallas with his friends. Jamie Macdonald; Jamie Macdonald works at Relevare in London. When he finds time he updates his own site www.nooflat.nu. Author Biographies Jerome Turner: comes from Leighton Buzzard where his first cinematic experience was watching Tom and jerry beat the hell out of each other on his parent's woodchip wallpaper. He then studied Art at Bedford College where he learnt that photography was cool because you could visit the Fine Art department whilst your films were drying. Following this he travelled to Exeter, wouldn't touch the cider, but did wander off with a degree in Media ArtsNisual Arts, which involved a lot of photocopying and pointing cameras at people who didn't really enjoy being filmed. Since then he's moved to Poole with his long-suffering partner Claire and worked on a number of film and video productions as a production assistant, camera operator, script writer, boom operator, 1st AD, runner, producer, and director. Sometimes when he's very bored he goes to the boating lake to film Canadian geese. Jon Steer: jon has been working as a web developer for nearly five years after graduating from Durham University with a degree in Economics. He is Technical Director of Durham Associates Ltd (www.da-group.co.uk), a marketing communications company in the north-east of England and admits to being far happier working with code than with pretty pictures! His main focus is server side technologies, especially PHP and mySQL, and is always looking for different ways to put these to work. jon lives near Durham with his wife and two daughters to whom special thanks go for their enormous support and encouragement. Keith Peters: lives in Lynn, Massachusetts with his wife Kazumi. He's been using Flash on and off for nearly three years now, but far more heavily in the last year. His personal site, www.bit-101.com, launched in August 2001 and he strives to keep up with the experiment-a-day schedule. It features fairly simple graphics, usually relying on math and scripting to build complex forms and movements. Steve Webster: propeller beanie hat firmly in place, spends most of his time tinkering with scripting, backend, and Flash technologies, or writing about tinkering with scripting, backend, and Flash technologies. Being clearly masochistic in nature, he's been programming since he was knee-high to a grasshopper and can currently be found plotting his route to world domination. Mwahahaha ... As always, I owe a great debt to my girlfriend Nicki for her saint-like patience while I was once again "that bloke locked away upstairs". Thanks also to the fantastic team at friends of Ed -you rock! Flash MX Studio Todd Yard: After studying and working for seven years as an actor, Todd was introduced to Flash in 2000 and was quickly taken by how it allowed for both stunning creativity and programmatic logic application -a truly left-brain, right brain approach to production - and has not looked back. He now works as Creative Director for Daedalus Media in New York City, which specializes in the creation of Flash-based corporate presentations, primarily for clients in the investment banking industry. His more frivolous work and experimentation can be found at his personal web site www.27Bobs.com. Table of Contents Introduction 1 Macromedia Flash MX: The Lay of the Land .......................................................... 1 Flash MX Studio: not for the faint-hearted ...................................................... 1 What's on the CD? ..................................................................................................2 Layout conventions .................................................................................................. 2 Start building this movie ......................................................................................... .3 Support ........................................................................................................................ 4 section 1: Site Presentation chapter 1: Motion 7 Easing out ..........................................................................................................................8 Making a movie clip move with easing .............................................................. 8 Initiating motion with a mouse click ................................................................ 11 Adding a trail to an object's motion .................................................................. 12 Making the trail fade ...................................................................................... 13 Frame-based motion .................................................................................................... 16 Constant velocity .................................................................................................... 17 Swinging motion ...................................................................................................... 18 Scale in motion ........................................................................................................2 4 Managing the motion ..................................................................................................2 6 Using empty movie clips ......................................................................................2 8 Picture navigator ...................................................................................................... 33 Summary ..........................................................................................................................3 9 chapter 2: Formatting Text 41 Creating our own text effects .................................................................................... 41 Creating a typewriter effect ............................................................................... .42 Setlnterval ..................................................................................................................4 5 Creating a text field dynamically ..............................................................................4 7 Typing in .................................................................................................................... 49 A note on prototypes .................................................................................................. 56 Working with textFormat ............................................................................................ 51 Using setTextFormat. ............................................................................................... 57 Application of technique ............................................................................................6 1 Converting Strings .................................................................................................. 64 Advanced text effects .................................................................................................. 67 Calculating the width of a string ........................................................................ 68 Obtaining character positions ...................................................................... 69 Obtaining further data ..........................................................................................6 9 Using the character positions ...................................................................... 72 Using character data for a text fade .................................................................. 73 Further possibilities ...................................................................................................... 76 Creating a random fade ........................................................................................ 76 Enhancing the picture navigation interface .......................................................... 78 Dynamically positioning images and adding text effects ............................ 79 Summary ..........................................................................................................................8 7 Flash MX Studio / chapter 3: Drawing API 89 Drawing a straight line ................................................................................................8 9 Drawing a curved line ..................................................................................................9 1 Adding fills ......................................................................................................................9 5 Adding gradient fills ....................................................................................................9 6 A draw square function ..............................................................................................9 8 A draw circle function .............................................................................................. 10 1 Drawing a curve through a specified point ........................................................ 10 3 Making a sample application .................................................................................. 10 8 Drawing .................................................................................................................. 10 8 Shared objects ...................................................................................................... 11 0 Using a shared object .......................................................................................... 111 Saving our picture data ...................................................................................... 112 The fully functioning drawing application .................................................... 114 Summary ........................................................................................................................ 121 chapter 4: Components 123 The guts of a component ........................................................................................ 124 Tooltip basics .......................................................................................................... 125 Live preview .................................................................................................................. 133 Setting up a live preview .................................................................................... 134 What we want our tooltip to do ............................................................................ 136 Making a tooltip appear on rollover .............................................................. 138 Dynamically changing the text inside the tooltip ........................................ 142 Adding an enabled property .............................................................................. 144 Attaching the tooltip dynamically to a movie clip ...................................... 146 Preserving the original button actions ............................................................ 148 Adding the final requirements for the tooltip .............................................. 152 Extra button interactivity: retrieving alpha and brightness settings with Color.setBrightness .............................................................................. 155 Building our own button component ............................................................ 157 Summary ........................................................................................................................ 161 chapter 5: Taking Things Further 163 The Stage object ........................................................................................................ 163 Resizing the stage with the Stage object ........................................................ 164 More efficient resizing ........................................................................................ 170 Applying motion when the stage is resized .................................................. 173 XML ................................................................................................................................1 85 An XML loader ...................................................................................................... 191 Building the XML loader. ..................................................................................... 194 Preloading the pictures ........................................................................................2 05 Displaying the photographs ................................................................................ 213 Summary ........................................................................................................................2 19 Table of Contents section 2: ActionScript Interfaces chapter 6: Introduction to Events and Handlers 221 Some basic definitions ..............................................................................................2 21 Deleting event handlers ............................................................................................2 25 Changing event handlers ..........................................................................................2 26 Passing parameters to event handlers .......................................................... 227 Event driven programming ......................................................................................2 28 Other events .......................................................................................................... 228 Button event handler ..........................................................................................2 30 Keyboard event handlers ..........................................................................................2 33 Event listeners ......................................................................................................2 33 Creating a Simple Game ......................................................................................2 35 Watches ............................................................................................................2 47 Summary ........................................................................................................................2 S1 chapter 7: Advanced Collision Detection 253 hitTest ............................................................................................................................2 53 Bounding boxes ....................................................................................................2 54 Using shapeFlag ....................................................................................................2 55 Using the different types of hitTest ................................................................ 257 Mathematical collision detection .......................................................................... 259 Bouncing ball ..........................................................................................................2 59 World cup pong ....................................................................................................2 64 Distance-based movie clip to movie clip collision detection .......... 272 Look at the size of that thing .................................................................... 274 Multiple object collision ............................................................................ 277 Handling multiple objects in an array ............................................................ 278 Summary ........................................................................................................................2 83 chapter 8: Flash Math and Physics 287 Introducing trigonometry ........................................................................................2 87 Circular motion ...................................................................................................... 290 You looking at me? ..............................................................................................2 93 Motion basics ..............................................................................................................2 95 Uniform speed ........................................................................................................2 97 Acceleration .......................................................................................................... 299 Do you want to go faster? .................................................................................. 299 Gravity ...................................................................................................................... 301 Project #1: Asteroids ........................................................................................... .302 Springs .............................................................................................................. 320 Coordinate rotation ...................................................................................... 325 Ships in flight .......................................................................................................... 327 Project #2: Bounce ................................................................................................ 329 Summary ........................................................................................................................3 39

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.