Sr. Web Developer
mediabistro.com
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume

Graphing With Flash (SWF)
Introduction to SWF and Flash
SWF is the file format used by Macromedia Flash to deliver graphics, animation and sound to users on the Internet. Flash enables you to provide a very rich and dynamic interface to the user. Almost 90% of web users can view SWF content without having to install a browser based plug-in, and over 200 million people have downloaded the Flash player. Macromedia opened the specifications for SWF in April 1998 and SWF support was added to PHP in PHP 4(rc2).
PHPs built-in ability to dynamically create images is one feature that impresses me. It makes reports and interfaces look much more professional and visually pleasing. Initially, I used the various GD code floating around the net to create the graphs I needed to better represent data for various projects I had done. I got really sick of the aliasing and choppyness of the generated images, so decided to try and see if it could be done with vector graphics instead. I think you will agree that the result looks much better. If a picture is worth a thousand words, wonder what a Flash movie is worth?
In this example, I try to keep things simple and just present the basics. My goal was basically just create a drop in for GD generated GIFs and PNGs. You can choose to add enhancements, such as any of the visual effects Flash is famous for. For example, you could make the graph fade in, fly around into place when the page is loaded or pull pieces of the pie out dynamically. Your imagination is the only limitation to what can be done with the PHP SWF functions.
How you get the data you choose to graph is an exercise best left up to the reader. Since this article is about dynamic creation of flash files, I will be using an imaginary table as a data set to create a graphical representation for this example. You will need to intelligently look at your data and decide what the best way to present this data will be. In most of the cases, I have found a pie graph to fit the bill, so this is the example I will use. A line, bar or area graph could easily be created in a similar manner.
Assume we are trying to see what proportion of cities we shipped our packages of jumbo nightcrawlers to. We decide to store this data in a table called "city" in our database called "world". Let's get to work setting up a database table and enter data for the example.
[ Next Page ]


Comments:
RE: YOU CANNOT CRACK FLASH SWF FILES!Yusup08/01/07 23:32
how convert swf to flaraven07/10/07 07:24
RE: Flash maps with PHP?Daniel P. Fountain10/31/05 21:51
RE: convert SWF a SWIpiya07/16/05 01:47
It is not possible to convert .swf to .swiHala07/02/05 11:38
convertamier06/25/05 23:39
FLASHaniljith gopi k acharya06/09/05 04:59
RE: swf to mp3 converter question- SOLUTIONryanmx04/19/05 11:52
convert SWF a SWIjun03/29/05 04:15
RE: PHP code no right clickKaiser02/14/05 17:40
RE: swf to mp3 converter question- SOLUTIONDocta09/07/04 02:50
RE: you CAN convert FLA TO SWF with 1.001aumm07/07/04 09:20
Re:nebody have carck for IMPERATOR °FLA Demo daddy05/05/04 04:46
Re:nebody have carck for IMPERATOR °FLA Demo IMPERATOR SPY04/02/04 17:49
Re:nebody have carck for IMPERATOR °FLA Demo Rohab03/24/04 08:25
This program converts .swf to .fla in a flashIWillHostU.com12/18/03 00:56
RE: you CAN convert FLA TO SWF with 1.001aJaime11/19/03 18:57
RE: you CAN convert FLA TO SWF with 1.001aJaime11/19/03 18:52
This can convert swf to fla almostMike04/22/03 04:53
Solution to <How Can I Convert SWF into Fla>Woddi Di03/26/03 13:36
RE: Link to examplepramod02/02/03 20:12
RE: you CAN convert FLA TO SWF with 1.001aRoots*MANUVA01/07/03 09:34
RE: Flash cant access/load local filesMike Chambers12/09/02 11:34
A better wayKyle11/21/02 16:21
RE: YOU CANNOT CRACK FLASH SWF FILES!...goinzo11/14/02 03:08
RE: imorting an imageamarnath11/13/02 01:51
mov helpadnan10/31/02 16:04
swf to mp3 converter questionGary10/15/02 18:23
Migrating to MingJosep10/14/02 12:31
Link to exampleJosep10/10/02 12:42
Flash cant access/load local filessreddy10/08/02 12:05
RE: PHP code no right clickhucker10/07/02 15:57
RE: I convert SWF a FLA Mehdi09/27/02 14:25
imorting an imageshahane09/25/02 01:15
hi im english...does any1 know actionscrpt 4 clarky09/24/02 08:55
opinion!Rose09/17/02 01:06
How can we convert swf into mp3reddy09/13/02 08:16
RE: I convert SWF a FLA raven09/12/02 08:00
RE: link for libswfJimBeam09/06/02 18:29
Help me- win98+Flash+PHPjoya09/06/02 05:51
How can I see php in Flashjoya09/06/02 05:33
Including ImageskUNg-f0008/29/02 16:39
A url (php) in flashjos08/29/02 16:04
RE: I need helpsam08/28/02 05:50
can we convet .swf into .fla Hisham Kamal08/25/02 01:11
to decompile a SWF file -->DataBase08/22/02 20:29
SalamAlireza08/21/02 07:15
RE: how can I convert swf file into flaMike 08/17/02 03:24
swf fiLEALEX08/14/02 14:20
I convert SWF a FLA jayupi08/11/02 16:05
PHP ChartsVineeta08/10/02 03:04
display problemalex_dm08/08/02 05:13
RE: how can convert swf file into flaChris08/06/02 10:56
RE: how can convert swf file into flaKathy08/04/02 21:15
RE: how can convert swf file into flaAmmu08/04/02 08:41
RE: YOU CANNOT CRACK FLASH SWF FILES!...Bob Québec08/02/02 09:13
RE: how can convert swf file into flaCh^Aizak07/31/02 01:53
convert swf to flaHamid07/30/02 06:41
RE: how can convert swf file into flaBipul07/25/02 03:37
How do I connect SWF & MySQL using PHPHemant Kumar Tongaria07/24/02 09:02
how can I convert swf file into flaManveer07/23/02 18:02
RE: YOU CANNOT CRACK FLASH SWF FILES!Oldfahrt07/20/02 14:35
RE: how can convert swf file into flamelvyn07/19/02 07:21
how can convert swf file into flamehboob07/12/02 12:43
RE: how can convert swf file into flanoman07/05/02 08:17
Convert *.HTML to *.SWF !!Bogdan06/30/02 17:18
SOCKET STREAM -> PHP -> FLASHDavid HORVATH06/21/02 07:59
PHP code No right clickLisa06/18/02 16:05
PHP code no right clickLisa06/18/02 16:03
SWF to MP3Suresh06/18/02 10:29
how will I Flash my toilet?jhoanna klugtod06/18/02 02:49
RE: how can convert swf file into flapoms06/15/02 13:52
RE: SWF-->FLA answer: swf-->mp3, too!belal06/14/02 19:47
FLA to SWF withou using flashRichard06/12/02 12:22
setting up html code for flash playerfranco medina05/29/02 11:09
RE: how can convert swf file into flavinay05/29/02 08:06
RE: Flash maps with PHP?zen05/21/02 15:20
YOU CANNOT CRACK FLASH SWF FILES!zen05/21/02 15:05
Streaming webcam with flash?Dexter M05/21/02 03:11
RE: how can convert swf file into flashahrukh05/17/02 15:59
SWF to MP3George Cannon05/07/02 15:11
Convert mp3 to swfDaniel Wynn04/25/02 20:29
RE: how can I convert mp3 file into fla or swMuhammad Adil04/25/02 07:03
RE: how can convert swf file into flapraveen04/23/02 02:27
RE: how can convert swf file into flaFernando Duarte04/16/02 13:19
RE: how can convert swf file into flaJohn Mac Kevin04/14/02 23:37
RE: sites in flash???04/13/02 08:38
flash+databasebia04/12/02 14:23
can you're help mezaini haris04/11/02 01:18
sites in flashMalik04/10/02 08:17
how can convert swf file into flaMalik04/10/02 08:15
Urgent! Ming wont runEarp03/19/02 07:07
RE: php +background flashEarp03/19/02 07:04
php + flashsuhail02/23/02 11:15
link for libswfMarty Martini02/22/02 14:58
RE: convert swf to mp3Vijay02/19/02 23:43
formsjon02/19/02 20:25
RE: swf to mp3John NASH02/19/02 19:17
how can i creat a chat room in flash5ilyas02/17/02 15:11
RE: Link to exampleRobin02/15/02 22:07
re: AutoStart FlashRobin02/15/02 21:32
SWF-->FLA answer: swf-->mp3, too!Alan02/13/02 10:25
RE: PHP, Flash, and MySQLthomas02/08/02 08:56
php write to textcurtis02/02/02 13:08
Passing Flash Variable to PHP joe01/29/02 22:23
convert swf to flawern01/26/02 03:58
Power point slide show to SWF fileSalima01/24/02 11:21
RE: Flash+phptravis rimel01/17/02 10:15
how to access data from ....joe01/15/02 01:55
RE: swf to mp3brian01/09/02 18:14
RE: SEG-faultMarkus01/09/02 16:13
RE: PHP + Flash (arrays)Greg Trinidad01/04/02 03:38
RE: convert swf to mp3 ( answer )Xenolab Technologies12/27/01 00:08
RE: convert swf to mp3Prashanth Enukonda12/26/01 03:08
swf to mp3yugandar12/25/01 12:53
RE: PHP + Flash (arrays)Simon12/12/01 13:49
RE: variables sent right into action scriptVolver12/04/01 18:16
RE: MACs and swf filesDave12/03/01 15:33
RE: variables sent right into action scripttotalmonkey11/30/01 12:11
variables sent right into action scriptArt Bowles11/29/01 12:19
mailform - variables to php to emailMike Raths11/29/01 07:51
RE: convert swf to mp3Anil Kumar11/24/01 00:43
AutoStart FlashCyberDev11/20/01 08:24
svg2swfSamson11/17/01 06:31
RE: Flash maps with PHP?Ben-Nes Michael11/15/01 10:26
PHP + Flash (arrays)SoulThief11/15/01 02:20
Flash maps with PHP?Nyunn11/08/01 12:36
php +background flashamarnath10/18/01 02:16
Flash+phpamarnath10/18/01 02:13
RE: Flash + PHP variablefraser10/10/01 22:17
RE: I need helpTony10/10/01 08:32
Flash + PHP variablecalin c10/10/01 07:03
RE: Flash + PHP VariablesCabdu Emir Rahmed Talem10/07/01 23:06
view php message board info in flashMatthew Throesch10/06/01 22:46
APACHE + PHP + SWF errorsEdson Toshiya10/04/01 11:55
RE: PHP y FLASHallbush09/20/01 10:35
look for swf libMakko09/18/01 03:31
convert swf to mp3satya09/17/01 18:15
flash ->xml ->php problemSavaJr09/16/01 09:08
PHP y FLASHSergio09/12/01 14:20
RE: Pregunta¿? acá estásepspv08/30/01 21:25
RE: Pregunta¿?Leonardo08/30/01 17:19
Pregunta¿?sandra08/26/01 19:54
Pregunta¿?sandra08/26/01 19:50
reading the width and height of a flash filetarun08/22/01 09:13
FLASH & WEBTVDeaTH DoLL07/25/01 15:04
MACs and swf filescameo07/16/01 19:46
RE: Accessing an already made SWF fileEYES06/29/01 10:49
caching m. sushi06/10/01 03:14
Trouble with fontsMagnus05/30/01 22:20
Flash connectivity to MYSQL using PHPDenrich Sananda05/27/01 21:39
RE: Flash + PHP formsDenrich Sananda05/27/01 21:38
change variable-name in existing flash-fileDorthe Luebbert05/21/01 21:45
RE: Win98, PHP, and Flashiqof18805/16/01 00:16
RE: Detect FlashBobbisson05/15/01 23:29
Detect FlashEvan05/10/01 10:33
RE: Accessing an already made SWF fileJerry05/10/01 04:02
SWF and URLsYoann Riou05/09/01 22:40
RE: SEG-faultBryan Mattern05/03/01 05:17
RE: Free Flash Generator (works with PHP)Dan Esparza04/25/01 01:11
Accessing an already made SWF fileAdam04/22/01 22:48
Ming vs SDKSharon04/20/01 00:06
SEG-faultMarkus04/16/01 08:58
List of OpenSource Alternatives to LibSWFJesseEzell03/17/01 03:16
Read the articleClaude03/08/01 16:22
RE: color issue...Nicki03/08/01 12:20
color issue...Nicki03/07/01 17:27
color issue...Nicki03/07/01 17:06
RE: Win98, PHP, and Flashwarzog03/05/01 04:17
RE: Flash + PHP VariablesZarek Melton03/01/01 19:31
Win98, PHP, and FlashJames Gunn03/01/01 12:27
Writing to a Textfile using Flash and PHP4Matt02/27/01 11:35
XML -> PHP -> SWFilya02/26/01 00:06
I need helpAndrew02/25/01 15:40
Flash + PHP VariablesZarek Melton02/16/01 11:41
Flash + PHP Gaham Carson02/14/01 14:14
RE: PHP, Flash, and MySQLMonte Shaffer02/03/01 11:19
TexturesJohan Daine01/25/01 03:32
Just remember...Jim Bob01/24/01 12:26
Who or Who Knows the solutionwidios01/23/01 05:19
RE: "libswf" swift&generatorflim01/20/01 08:51
RE: "libswf" Not Available For Windowserik01/17/01 16:55
swf & swtAntonis Zachos01/17/01 06:51
RE: PHP, Flash, and MySQLTerence01/16/01 09:43
RE: "libswf" Not Available For WindowsKristof Polleunis01/14/01 18:48
RE: Flash + PHP formsTahir Ayub01/14/01 13:57
RE: Good article Let I BEJames Housley01/12/01 22:07
RE: Flash + PHP formsBrian Busche01/12/01 16:30
PHP, Flash, and MySQLBrian Busche01/12/01 16:16
RE: Good article Let I BEwidios01/12/01 08:28
RE: "libswf" Not Available For Windowschris01/12/01 04:39
RE: Flash + PHP formsLuca Pescatore01/11/01 16:43
"libswf" Not Available For WindowsOnkar Jagpal01/11/01 11:26
Ming...Mas*Mind01/11/01 10:52
Another Flash exampleenygma01/11/01 09:55
RE: Flash + PHP formsBryan Mattern01/11/01 09:29
RE: Link to exampleBryan Mattern01/11/01 09:27
Good articletoby01/11/01 04:31
Flash + PHP formsKrishna Srinivasan01/11/01 01:29
Link to examplearis01/11/01 00:40
 

If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.