Tải bản đầy đủ (.pdf) (927 trang)

OReilly flash hacks 100 industrial strength tips and tools jun 2004 ISBN 0596006454

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (8.04 MB, 927 trang )










TableofContents
Index
Reviews
ReaderReviews
Errata
Academic

FlashHacks
ByShamBhangal

Publisher :O'Reilly
PubDate :June2004
ISBN :0-596-00645-4
Pages :480


ThiscollectionoffersexpertFlashtipsand
tricksforoptimization,creatinginteresting
effects,ActionScriptprogramming,soundand
videoeffects,andmuchmore--andyoudon't
needtobeanexperttousethem(although
you'llcertainlylooklikeone).Rangingfrom


practicalhackstothefunandquirky,the
bookcoversFlashMX,FlashMX2004,and
FlashMXProfessional2004.Ifyouwantmore


thanyouraverageFlashuser,FlashHacksis
foryou.











TableofContents
Index
Reviews
ReaderReviews
Errata
Academic

FlashHacks
ByShamBhangal

Publisher :O'Reilly
PubDate :June2004

ISBN :0-596-00645-4
Pages :480



Copyright

Credits
AbouttheAuthor

Contributors

Acknowledgments


Foreword

Preface
WhyFlashHacks?




WhoThisBookIsFor




HowThisBookIsOrganized





UsingCodeExamples



HowtoUseThisBook
ConventionsUsedinThisBook
CommentsandQuestions
Chapter1.VisualEffects





Hacks#1-7




Section2.Per-PixelTextEffects




Section4.CreateSWFsfromAnimatedGIFs





Section6.ATreeGrowsinBrooklyn

Section1.FakePer-PixelTransitions
Section3.SimulateOldFilmGrain
Section5.AnimatePhotoshopPSDFileswithFlash
Section7.Blowin'intheWind:SimulateTreeMovement


Chapter2.ColorEffects
Hacks#8-13

Section8.VideoColorEffects




Section9.VideoFadetoBlackandFadetoWhite




Section11.CreateandOrganizeCustomSwatches

Section10.ACustomColorTransformClass
Section12.BorrowColorSchemesfromNature

Section13.SimulateSepiaEffects



Chapter3.DrawingandMasking
Hacks#14-25




Section14.CreateFilledCirclesQuicklyatRuntime




Section16.CreateSeamlessTiles




Section18.ImitateEscher




Section20.UseComplexShapesasMasks




Section22.FeatherBitmapEdges





Section24.SolvetheBitmap-ShiftBug

Section15.CreateSyntheticArt
Section17.FillAreaswithPatterns
Section19.FixAlphaPropertyInaccuracies
Section21.InterferencePatternsandRippleEffects
Section23.AddaVectorEdgetoaBitmap
Section25.APage-TurnEffect(ExploitSymmetryandMasking)


Chapter4.Animation
Hacks#26-34

Section26.SmoothScriptedMotion




Section27.Time-ControlledMovement




Section29.alt-Flash:MotionGraphicsAlternatives




Section31.HackingTheMatrix


Section28.Quick,Bandwidth-EfficientCharacterAnimation
Section30.DejaNewAnimations
Section32.Computer-GeneratedCharacterAnimation




Section33.ParticleEffects

Section34.ShapeTweeningComplexShapes


Chapter5.3DandPhysics
Hacks#35-41




Section35.Simulate3D




Section37.AnOptimized3DPlotter




Section39.SimulateaThrow


Section36.PanoramicImages
Section38.UseAccelerationtoSimulateGravityandFriction
Section40.DetectMultipleCollisions

Section41.TurnTowardaPoint


Chapter6.Text
Hacks#42-51




Fonts




Section43.AutocompleteTextFields




Section45.ImportComplexFormattinginFlash




Section47.UseAccessibilityTextasHelpText





Section49.TypewriterEffect

Section42.KeepTextLegible
Section44.StoreaListofAllInputWords
Section46.HTMLandCSSinFlash
Section48.TextEffectFramework
Section50.Time-BasedTextEffects

Section51.TimelineTextEffects


Chapter7.Sound
Hacks#52-60




Section52.CreateaFlashSpeechSynthesizer




Section54.TheUbiquitousSound-KickerHack





Section56.Real-TimeSoundEffects




Section58.OptimizeSound

Section53.ATalking,Lip-SynchedAvatar
Section55.TurnLow-BandwidthMonauralSoundsintoStereoSounds
Section57.QuicklyCreateUISounds
Section59.SoundTimeCodes(CuePoints)

Section60.ACustomSoundTransformClass


Chapter8.UserInterfaceElements
Hacks#61-64




Section61.Amit'sDials(InteractiveTesting)
Section62.RightandMiddleMouseButtons




Section63.ButtonMovieClips


Section64.Dude,Where'sMyScrollbar?


Chapter9.PerformanceandOptimization
Hacks#65-73




OptimizeFilesizeandDownloadTime




IncreaseCodePerformance




Section66.BandwidthTestingforComplexSites




Section68.OptimizeGraphicsforPerformance




Section70.AdjusttheAnimationComplexityDynamically





Section72.SubstituteBitmapsforVectors

OptimizeGraphics
Section65.BeatFlashFileBloat
Section67.HideLow-QualitySettings
Section69.BenchmarkRuntimePerformance
Section71.PerformanceBudget
Section73.OptimizeComponentDownloadingandUsage


Chapter10.ActionScript
Hacks#74-85

ChangesinFlashMX2004




Section74.ExternalScriptEditors




Section76.CodeHints





Section78.AnIdleTimer(TimeoutEvent)




Section80.LocktheactionsLayer




Section82.UndocumentedActionScript




Section84.ObscureOperators

Section75.StrictTypingandCasualScripters
Section77.CloneanObject
Section79.FastActionScriptSearches
Section81.Debugwithtrace()
Section83.ASnative()BackDoor
Section85.ImportASCFilesasXML


Chapter11.BrowserIntegration
Hacks#86-96


Section86.KeepYourSiteBrowserFriendly




Section87.AUniversalFlashPluginSniffer




Section89.PreferencesandPublishingDefaults



Section91.CSS-BasedBrowserCentering

Section88.TestMultipleFlashPlugins
Section90.CenterYourSWFWithoutScaling




Section92.DynamicallyResizeContent




Section93.CreateHTMLLinksinFlash





Section95.GivetheFlashSWFKeyboardFocus

Section94.IntegratetheBackButtonwithFlash
Section96.AddKeyShortcutstoYourSite


Chapter12.Security
Hacks#97-100

PrivacySettings




Cross-DomainPolicy




Section97.RecoverContentfromaSWF




Section99.MakeYourSWFPhoneHome





HandlingLocalExecutables
Section98.ProtectandObfuscateYourFlashFiles
Section100.ReviewCompiledActionScript
Colophon
Index


Copyright©2004O'ReillyMedia,Inc.
PrintedintheUnitedStatesofAmerica.
PublishedbyO'ReillyMedia,Inc.,1005GravensteinHighway
North,Sebastopol,CA95472.
O'Reillybooksmaybepurchasedforeducational,business,or
salespromotionaluse.Onlineeditionsarealsoavailablefor
mosttitles().Formoreinformation,
contactourcorporate/institutionalsalesdepartment:(800)
998-9938or
NutshellHandbook,theNutshellHandbooklogo,andthe
O'ReillylogoareregisteredtrademarksofO'ReillyMedia,Inc.
TheHacksseriesdesignations,FlashHacks,theimageofa
spotlight,"Hacks100Industrial-StrengthTipsandTools,"and
relatedtradedressaretrademarksofO'ReillyMedia,Inc.
Manyofthedesignationsusedbymanufacturersandsellersto
distinguishtheirproductsareclaimedastrademarks.Where
thosedesignationsappearinthisbook,andO'ReillyMedia,Inc.
wasawareofatrademarkclaim,thedesignationshavebeen
printedincapsorinitialcaps.
Whileeveryprecautionhasbeentakeninthepreparationofthis
book,thepublisherandauthorsassumenoresponsibilityfor
errorsoromissions,orfordamagesresultingfromtheuseof

theinformationcontainedherein.


Credits
AbouttheAuthor
Contributors
Acknowledgments


AbouttheAuthor
ShamBhangalbeganontheroutetowebdesignin1991,
designingandspecifyinginformationscreensforsafety-critical
computersystems,asusedinplaceslikenuclearpowerplant
controlrooms.Hesoondiscoveredmoreconventionalinterface
design,animation,andmultimediatools,suchas3DStudio
Max,Photoshop,andFlash.Hehasbeenwritingbooksonthem
sincetheturnofthecentury.


Contributors
Thefollowingpeoplecontributedtheirhacks,writing,and
inspirationtothebook:
Anthony"Ant"Eden(a.k.a.arseiam)hasworkedforseveral
high-profileclientsincludingMicrosoft,Disney,andAdobe.
Hespendshissparetimecreatingwildandquirkyeffects
withActionScript,whichcanbesampledat
.
ZehFernandohasbeenworkingwithMacromediaFlash
sinceVersion2.CurrentlyworkingatBrazilian-baseddesign
studioGrafikonstruct(),

hecreatesreal-worldFlash-basedwebsitesdailyandis
searchingforbetterwaystodoitinhisfreetime.
Edwin"XemonerdX"HeijmenisaprofessionalFlash
developerlivingintheNetherlandswhoalsomoderates
severalActionScriptforums.Heenjoyscombining
mathematicsandcode,someresultsofwhichcanbeseen
at.BesidesActionScript,he
alsoenjoyscodingPHP,ColdFusion,Python,andevery
obscurelanguagehecangethishandson.Otherpassions
includehiswonderfulgirlfriend,undergroundmetalcore,
opensourcesoftware,Russianliterature,andhisfriends.
AdamPhillipsistheaward-winninganimatorbehind
biteycastle.com,hitchHiker,andtheBrackenwoodseriesof
Flashmovies.HewasaFlashForwardCartooncategory
winnerinNYC2003andagainafinalistinSF2004.Witha
desiretotellstoriesandmorethan10yearsoftraditional
2DanimationexperiencewiththeWaltDisneyCompany,
Adamcontinuestoproducehisownshortmovies,13of


whichcanbefoundat.
GrantSkinner()isan
internationallyrecognizedFlashdeveloperwithexperience
fusingcode,interfacedesign,usability,marketing,and
businesslogic.Heworkswithtopagenciesandprogressive
corporateclientsonFlashapplicationconceptualization,
architecture,andimplementation.Granthaswonmultiple
topFlashawards,hashadworkfeaturedintheSIGGRAPH
WebExpoof"Thefinestweb-graphicsworkof2003,"and
participatesregularlyinnumerousconferencesand

publications.
Stickmanhasaskedthathisrealnamebekeptsecretto
protecttheinnocent,butwecandivulgethatheworksin
webdesignforalargecontentsiteintheUKandisalsoa
freelancewriter.Oh,heisalsotallandthin.Youcancatch
upwithhisonlinepersonaat.


Acknowledgments
Thisbookhasbeenalongtimeinthemaking,andthanksgo
outtoallwhostayedonfortheride.Iguessit'sbeenastrange
tripforallinvolved!
Thanks,ofcourse,gotoMacromediaforcreatingFlashandto
thecontributorsforcontributinghacks.
ThankstoColinMoock()forhisgreat
books,technicalassistance,andinsightfulForeword.
Thankstothereviewteamforqueryingandcorrecting:Marc
Garrett,DavidHumphreys,ChaficKazoun,MarcMajcher,Sam
Neff,DarronSchall,JesseWarden,andEdoardoZubler.
ThanksalsotothefolksatO'Reilly,includingTimO'Reillyfor
theinitialcommentsandRaelDornfestforputtingthe"hack"
intoFlashHacks.ThanksalsotoBrianSawyerandClaire
Cloutierforproductionassistance,toRobRomanofor
convertingthenumerousscreenshots,andtoNormaEmoryfor
herdetailedcopyediting.SpecialthankstoBruceEpsteinfor
hisdeath-defyingnervesofsteelinthefaceofinsurmountable
deadlines,superhumaneditingstrength,andtimeforachat.
Thanksalsotomyagent,CaroleMcClendon,atWaterside
Productions.
ThankstothedesignerswithintheFlashcommunitywhohave

providedhelpfuladviceonthird-partytools,includingIgor
Kogan,DaveHayden,DamianMorten(Flasm),andAlexBlum
(FlashPluginSwitcher).ThankstoAlessandroCapozzo
()forallowingmetoreproduce
someofhisimagescreatedinProcessing.Thanksalsotothe
largenumberofdevelopers,designers,anddreamerswhose
workhasdirectlyorindirectlyinspiredportionsofthisbook;
theyincludeJoshDavis(),BrandenHall


(),ErikNatzke(),
JamesPaterson(),AmitPitaru
(),andHardino
().
Finally,thankstoBrianMolkoandcompany()forthefirstfourlinesof"PureMorning."Stufflike
thatkeepsmesmilingalldayasI'mwriting.Puregenius.


Foreword
Aboutsevenyearsago,IstartedworkingwithMacromedia
FlashVersion2.0tobeprecise.TheclientformyfirstFlash
projectwasLevi'sCanada,theworld-famousapparelcompany.
Levi'swaslookingfortheproverbial"reallycoolwebsite."I
guesscorporations,likeanyotherlivingentity,havean
aversiontodeath,andLevi'swaskeentorenewitsleaseonlife
byattractinganewgenerationofcustomers(read:teenagers).
Butkids,saidLevi's,don'tlikeclothingwebsites;toakid,a
clothingwebsiteisaboringshoppingcatalogwithaBuy
button.Thesolution?MakethenewLevi'ssiteaninteractive
comicstrip,wherethestoriesofthecharactersleadtoLevi's

products.Fillthecomicwithaction,romance,drama,and
intrigue...kidslovethatstuff.
Attheinitialprojectmeetings,thecreativedirectorpresented
theanimatedwebsiteconceptwhilewe,theHTMLjockeysand
webdesigners,shudderedatthethoughtoftryingtoimplement
it.Asenvisioned,thesiteevenincludedholdontoyourhatactual
soundsforthecharacters'voices!(Rememberthiswas1997;
audioandanimationonwebsiteswasalmostunheardof.)In
ourfirsttechnicalplanforthesite,weproposedtheuseof
animatedGIFimages,WAVsoundfiles,andJavaScriptimage
rollovers.Weknewthesitewouldn'tbeasspectacularasthe
creativedirectorhaddescribed,butwewereaccustomedto
playingthedeveloperscapegoat.Wewouldbetheonesto
breakthenewstotheclient:webbrowserscan'treallydo
animatedcartoons;thecreativedirector'sdescriptionofthesite
wasconceptual,intendedmerelyasinspiration,nottobetaken
literally.
ButthecreativedirectorhadseenanimationsontheWeb;he
wassureofit.HeaskedushowDisney'swebsitedidits
cartoons.WetoldhimwithMacromediaFlash.Forhim,the


nameofthesoftwareandtechnicaldetailswereirrelevant.The
Levi'ssitehadtobeanimatedatanycost.SowedidtheLevi's
siteinFlash(seeitat
/>ShortlyafterwecompletedtheLevi'ssite,thewebdesign
industrywentcrazyoverGabocorpandEYE4U,twoselfpromotionalwebagencysiteswithanimatedFlashinterfaces.
Bytoday'sstandards,thesetwositeslookcomicallysimpleand
naïve.(SeeforyourselfasofApril2004theoriginalEYE4Usite
isstillliveat.)GabocorpandEYE4U

consistedofnearlynoprogramming,arguablygaudydesign,
somemovingshapes,andsomeballsflyingaroundthescreen.
Sowhatmadethempopular?
LiketheLevi'ssite,theyprovedthatyoucouldhackthe
system.
Asabrowseradd-on,Flashisoneofthelargestscalehacksof
thepastdecade.Sinceitsinception,Flashhasbreathedlifeinto
thesomewhatsterilewebbrowser.Flashletsthecreative
communityexplorewhattheWebcanbe:acartoonnetwork,a
gameplatform,anOS-styleenvironmentforconnected
applications,anelectronicartgallery,avideochat,a
collaborativemultiuserenvironment,aremotemeetingroom,
anMP3musicplayerorprettymuchanythingyoucandreamup.
Fittingthatideal,Macromediaused"WhattheWebcanbe"as
itsmarketingsloganafewyearsback.
Accordingly,it'snosurprisethatFlashispervasivelyflexible,a
veritablehacker'splayground.Infact,Flash's"hackability"is
arguablythekeytoitssuccess.Here,I'musingtheword"hack"
tomean"acreativeexploration,usinganymeanspossible
(evenugly),thatleadstosomedesirable(evenexhilarating)
result."Flashgrewfromahumbleanimationtoytothe
expansive"RichInternetApplication"toolitistoday,largelyin
responsetothehacksintroducedbythedevelopment
community.


IrememberpeopleusingFlash3tocreategameslikeWhack-aMole,Leo'sGreatDay
(),andevencrude
prototypesofPacmanandchess.Mindyou,allwithoutasingle
lineofcode.Flash3hadnoscriptinglanguage!Inresponseto

thishackeddemandforgreaterinteractivity,Macromedia
introducedaverysimplisticversionofActionScriptinFlash4.
Littledidtheyknowitwouldfuelamotiongraphicsmovement
thatwouldinfluencedesigninprint,television,andmoviesfor
years.MonthsafterFlash4shipped,siteslikeMono-craft
(),PrayStation
(),LevitatedDesign&Code
(),andPresstube
()becamefamousfortheircreative
explorationsinreal-timeaudio/visualexpression(inother
words,fortheirhacks!).
PeopleuseFlashtoexplorethingsthatarehardorimpossible
todoinothermedia.It'shardtodomotiongraphicsinHTML,
butyoucandreamaboutamotiongraphicswebwithFlash.It's
hardtodoexpressive,customizeduserinterfacesintraditional
desktopapplications,butyoucanseebrandedFlash
applicationstodayonthousandsofwebsites.AsIwritethis
foreword,I'mfinishingupawebsiteinwhichyoucanobserve
otherconnectedusersinteractingwiththesite'sinterface(see
MeanwhileMarcos
WeskampisworkingonVersion2ofhisremotecontrolcar
application( />inwhichanyoneintheworldcandriveaphysicalremote
controlcarviaaFlash-basedwebinterface.It'shardtoimagine
buildingthesethingswithanytoolbutFlash.
SoFlashisahacker'sparadise.Itletsyouplay.Itgivesyouthe
freedomtoexploreyourideas.Anditforcesyoutopullsome
zanytrickstogetwhatyouwant.Foralongtime,thetricksand
hacksofFlashhavecirculatedthroughouttheonline
developmentcommunity.Manyofthem,newandold,arenow



committedtoprintinthisbook,inaqualityandstyledeserving
oftheO'Reillyname.
Iconsiderthisbookbothaserviceandachallenge.
Theservice:usewhatyoufindinthesepagestoyour
advantageonwhateveryou'rebuilding.There'stonsofgreat
infohere,boundtobeofhelponnearlyanyproject.You'll
benefitfromShamBhangal'sconsiderableexperienceinthe
fieldandaclarityofexpressionItrulybelieveonlyBruce
Epstein(thisbook'seditor)canguarantee.
Thechallenge:rememberthatexplorationandinventionare
yourgreatesttools.BeforetherewerebooksonFlashand
beforetherewereestablishedtricksandmethodologies,there
wasavisionofwhatcouldbeandtheclever,bullish,tinkering
desiretomakeitso.
ColinMoockApril2004


Preface
MacromediaFlash'sancestorstartedoutasacorecomponent
ofthepencomputer,akeyboardlessmachinethatusedapen
stylusforinput,makingitmuchmoreportablethantraditional
keyboard-baseddesignsandidealforhandhelddevices.The
systemfeaturedavector-baseddrawingengine,whichwas
moresuitedtoinputviaapenthanmoretraditionalbitmapbasedsystems.
Theideadidn'ttakeoff,butanewavenuewasbeginningto
presentitselftheWeb.Thepen-basedvectordrawingprogram
becameFutureSplash,whichwasreleasedaround1995asa
web-centricvectoranimationtool.FutureSplashwassoon
boughtbyMacromedia,andthefirstversionoftherenamed

application,Flash,wasreleasedin1996.
Latein2003,MacromediareleasedFlashMX2004(andFlash
MXProfessional2004)andthecorrespondingFlashPlayer7
browserpluginandActiveXcontrol.Inrecentyears,Flashhas
gainedanumberofimportantfeatures,includingmultimedia
handlingcapabilities(sound,images,video)andafull-fledged
scriptinglanguage(ActionScript)tocreatenonlinearanimation
orclient-sideprocessing,aswellasinterfacingwithremotedata
orserver-sidescripts.
Flashisnowthestandardwebmultimediadeliveryplatform.
TheFlashPlayer(thebrowserpluginthatplaysbackFlashSWF
files)isubiquitous,andFlashcanalsocreatedesktop
applications.Webdesigncontinuestomoveawayfrom
traditionalHTMLandtowardtheinteractivityandmultimedia
featuresofferedbyFlash.AndMacromediacontinuestoexpand
theFlashplatformwithproductslikeMacromediaCentral(a
personalbrowserforoccasionallyconnectedFlash-based
content),FlashCommunicationServerMX(areal-timevideo
andaudioserver),andFlashRemoting(enhancedremote


connectivitytowebservicesandserver-sideapplications).


WhyFlashHacks?
Theterm"hacking"hasabadreputationinthepopularmedia.
Theyuseittorefertobreakingintosystemsorwreakinghavoc
usingcomputersasweapons.Amongpeoplewhowritecode,
though,theterm"hack"referstoaquickanddirtysolutiontoa
problemoracleverwaytogetsomethingdone.Andtheterm

"hacker"istakenverymuchasacompliment,referringto
someoneasbeingcreativeandhavingthetechnicalchopsto
getthingsdone.TheHacksseriesisanattemptthereclaimthe
word,documentthegoodwayspeoplearehacking,andpass
thehackerethicofcreativeparticipationontotheuninitiated.
Seeinghowothersapproachsystemsandproblemsisoftenthe
quickestwaytolearnaboutanewtechnology.
FlashHacksisaboutcomingupwithnewideasforyourFlash
webdesigns,ActionScript,andFlashcontent.
Flashauthoringisallaboutcreativity,inbothdesignand
coding,andpushingtheenvelopeofwhatispossible.Although
multimediascriptinghasbecomemorestructuredand
formalized,thereisstillplentyofroom(andneed)forhacks
andworkaroundswhenthestandardroutesfail.
WhenIfirstopeneduptheFlashapplicationandstarted
readingtheofficialdocumentation,ittookmeawhileto
understandhowFlashisreallysupposedtobeused,andfrom
feedbackIhavereceivedsince,thisisacommonproblem.
Flashisthusanareainwhichexperimenting,hackingaround
limitations,andknowingalotofdesigntricksispartofthe
workflowbecausetheaimisoftentocreatesomethingoriginal
andengaging.ReadingtheMacromediaFlashdocumentation
willtakeyouonlysofarbeforeyouneedtostartlookingfor
cleverhacksandinsidetricksthatovercomemanyofFlash's
limitations.


Therefore,thisbookisnotjustaboutshowingyousome
interestinghacks,itisaboutshowingyousomeofthe
nonobvioustechniquesandideasthatwillmakeyourFlash

designsmoreoriginalandyourapplicationsmoreeffective.
Ofcourse,thisalsomeansthatyouwon'tbeusingmanyofthe
hackspresentedhereas-is,butinsteadwillusethemas
startingpointsforfurtherexplorationanddevelopment.
ExperimentationistobepromoteditiswhatFlashandtheFlash
communityareallabout.Thisbookborrowsmuchfromtherich
traditionoftheFlashcommunitybutalsopresentsmany
originalideastoteach,entertain,andinspireyou.


WhoThisBookIsFor
Okay,let'sfaceit.O'Reillyisbetterknownforitstechnical
referencesthanforedgierbooksliketheHacksseries.O'Reilly
haspublishedsomeofthemostadvancedbooksonActionScript
developmentavailable,includingthewell-respectedActionScript
forFlashMX:TheDefinitiveGuideandthehard-coreobjectorientedprogrammingguideEssentialActionScript2.0,bothby
ColinMoock.O'Reilly'sActionScriptCookbook,byJoeyLott,
presentsmorethan300practicalrecipesforawiderangeof
ActionScriptproblems,andFlashRemoting:TheDefinitive
Guide,byTomMuck,covershigh-endapplicationdevelopment
andremoteconnectivity.
Ithinkitissafetosaythatthisbookissubstantiallydifferent
fromthosebooks,whichisappropriatesincethebooksserve
differentpurposes,eveniftheiraudiencesoverlap.Whereas
thoseareserious,traditionalprogrammingbooksspeakingto
well-structuredcodeandbestpractices,thistomeisfullof
explorationandwhimsy.Whereasthosebooksspeakof
productivitytoexperiencedprogrammers,thisbookspeaksof
adventuretotheyoungatheart.Ifyou'renewtoFlash,this
bookisastantalizingasthearomaofawarmapplepie.Ifyou

areexperiencedwithFlash,andperhapsabitboredwithit,it
mightremindyouwhyyoufellinlovewithFlashinthefirst
place.Thatsaid,hard-coredeveloperswillfindlotsofserious
codingadvice,optimizationtechniques,andtipsandtricksfor
applicationdevelopment.
Frankly,ifyou'veneverusedFlash,someofthehackswill
confuseyou,butmanywillnot,asthereissomethingherefor
everyone.Inearlychapters,Imakeanefforttoexplain
occasionaloperationalbasics,suchascreatinganewempty
layer(Insert Timeline Layer)andattachingcodetoaframe
(selecttheframeintheTimelinepanelandopentheActions
panelusingF9orWindow DevelopmentPanels Actions).We'll


beplacingmostofourscriptsonadedicatedactionslayer
[Hack#80]butsomescriptsmustgoinexternal.asfiles[Hack
#10].
Becausethisbookispredominantlygearedtowardreaderswith
somefamiliaritywithFlash,ifyou'veneverusedFlash,you
shouldprobablypickuponeofthemanyfinetutorialbooks
availablefrom(gasp!)otherpublishers.(O'Reillyiscomingout
withaFlashtutorialbookFlashOutoftheBoxbyRobert
Hoekmaninthesecondhalfof2004.)Ifyoudon'thaveacopy
oftheFlashauthoringtool,youcandownloadatrialversion
fromMacromedia
( />product=flash)andgothroughsomeoftheincludedtutorialsto
learnthebasics,too.
Thatsaid,manyofthehacksinthisbookcanbeappreciated
evenifyou'veneverpickedupFlash.Icertainlyhopethisbook
inspirestheuninitiatedtotryFlashandthosewhoknowFlash

toappreciateitanew.
Ifyou'reatraditionalprogrammernewtoFlashoraserious
applicationdeveloper,beforewarned.Thisbookisn'taboutbest
practicesorobject-orientedprogrammingorRichInternet
Application(RIA)development.Andifyou'reprejudicedagainst
Flash,thelargenumberofhackscoveringanimation,drawing,
andmotiongraphicsmayturnyouofftoFlashforever.That
wouldbeashame.Whatispresentedhereisbutasmallslice
oftheFlashuniverse,myownpersonalcornerinfact(witha
littlehelpfromfriendsandcontributors).Skiparoundandyou'll
findnotjusteyecandyandearcandybutlotsofActionScript
examples,too.You'lllearnsomething,evenifitwasn'twhat
yousetouttolearn.
TheFlashuniverseisbothvastanddiverseandthisbook
doesn'ttrytobeallthingstoallpeople.Butalmostevery
developer,whetheranexperiencedFlasher,abeginningscripter,
orahard-corecoder,willfindmorethanafewinteresting


techniquesandtips.Ifyouwereeverachild,ifyouwereever
inlove,ifyoulikedrive-inmoviesorhowlingatthemoon,this
bookwillremindyoualittlebitofallthosethings.Andthat,to
me,seemslikeaverygoodthing.
SoreadalltheotherFlashandActionScriptbooksyoucanget
yourhandson,butleaveaplaceontheshelforyourdeskfor
thisone,too.


×