Foundation PHP For Flash; Steve Webster (FriendsofED, 2001).pdf

(10651 KB) Pobierz
415708015 UNPDF
415708015.001.png
Fondaion PHP fo Flah
Ripped by
Credits
Author
Content Architect
Steve Webster
Alan McCann
Appendices
Editors
Kev Sutherland
Alan McCann
Stef Lewandowski
Ji m Hannah
Antonio Gould
Richard ODonnell
Lead Reviewer Author Agent
Matthew Gadd
Gaynor Riopedre
Technical Reviewers
Project Administrator
Gareth Heyes
Fionnuala Meacher
Stef Lewandowski
Steve Parker Graphic Editors
Jake Smith
Katy Freer
Kev Sutherland
Deb Murray
Peter Walker
Proof Readers
I ndex
Simon Collins
Lou Barr
Simon Collins
Cover Design
Joanna Farmer
Katy Freer
Jenni Harvey
Fionnuala Meacher
Richard ODonnell
Gaynor Riopedre
415708015.002.png 415708015.003.png 415708015.004.png
About the Author
Steve Webster is a Freelance Web Developer and
has several years experience with Macromedia
Flash and scripting back-end development. A
keen programmer since the age of 8 [and the good
old days of the Sinclair Spectrum 48k], he has
studied for an HND in Software Engineering. He is
also a moderator in, among others, the Scripting
Backend forum at the excellent FlashKit site
[ www.flash kit.com ], where he spends the majority
of his time providing support and helping others
with their projects.
Acknowledgements:
First and foremost I have to thank my long-term girlfriend Nicki. As always, your
overwhelming support and encouragement kept me going through all those long nights
and I couldn't have done it without you. I can't find the words to thank you enough letting
me be what I had to be in order to get this book finished, and for putting up with me not
being "all there" over the past few months.
What can I say, except: you are my rock and without you this dream would never have been
realised. Maybe now we can get back to some sense of normality and enjoy the rest of our
lives together. .. until the next time.
Eternal gratitude goes out to Alan and Gaynor for helping me through every stage of the
book with saint-like patience, and for keeping the hounds at bay. I have learned, and hope
to continue learning, a great deal from you, both about the technical aspect of writing and
the human capacity for compassion and accommodation. You are true friends and I can
only hope that we can continue working together (...I've still got that t-shirt by the way!)
I would also like to thank the rest of the friends of Ed team who helped make this book a
reality. In particular I'd like to thank Matt and the rest of the technical review team who did
such an outstanding job finding all of my deliberate mistakes -you're an author's dream!
To my family: thanks for supporting my passion for technology as I was growing up. Despite
the occasional grumble that I was "spending too long in front of that infernal machine"you
were always quick to praise and encourage my efforts, suffering many a "come and look at
what I've done now" session.
About the Authors
All I can say is that I told you all that sitting in front of my computer woulpay off
eventually ... and Ive finally made it. Hmmm ... almost an "I told you so" ;o)
Special thanks to my sister Sharon and her family for renting the sofa to me while I was
between homes! Its probably the most uncomfortable sofa Ive ever spent the night on but
it beats cold hard streets!
Finally, thanks must go to Boris the Monkey. I must explain that Boris is the name 1 have
given to a stuffed bear that my other half gave to me, and he kept me company during the
late and sleepless nights that occupied the final throes of writing this book. He took all of
my fits and tantrums in his cheerfully deadpan manner and never criticised me when I made
a mistake. Boris -you rule!
... what do you mean its time for me to go back in my cage? I havent finished!
Heeeeeeeeelllllllpppppppppp
No stuffed bears were harmed during the production of this book ... honest!
Fondaion PHP fo Flah
Introduction
1
Styles Youll Come Across in the Book
2
What Youll Need For This Book
2
Support - Everybody Needs It
3
PHP and Server-side Scripting
5
The Client and the Server
6
1
Dynamic Data for Flash
13
Loading External Data
15
Advice on using loadVariables
18
The Movie Clip Event Handler
19
Sending Information from Flash
24
Building a Download Registration Form
25
The Server-Side Scripts
31
The Main Registration Script
33
2
Getting Started with PHP
39
A Word About Naming Conventions
40
Comments
42
Variables
43
Naming your Variables
44
Data Types
47
Operators
49
Using Statements
53
Selection
53
I teration
60
Arrays
65
Creating Arrays
65
Looping Through a Sequential Array
67
Looping Through a Non-Sequential Array
69
Multi-Dimensional Arrays
72
Sorting Arrays
74
Building a Flash Login Application
76
3
Making PHP Work for You
89
I ntroducing Functions
91
Variable Scope
94
Variable Lifetime
95
Passing Data to Functions
96
2
 
Zgłoś jeśli naruszono regulamin