A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11249 Flash Movies | 9 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: kyo
» Title: building estructure
» Description: explosion of building estructure made by swift3D
» More by kyo


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 6393 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: Webdancer's Web Site
» Comments: Webdancer's, an artistic adventure in 3d graphicsbr>


Random Links | Add your own Flash Related Links
Flash Tutorials 1197 Tutorials 7 New Tutorials Added!
What's New | Top100

» Let Photos Show Your Happy Family this Christmas and Upload YouTube
» PowerPoint show to DVD slide show--- PPS to DVD
» How to burn FLV to DVD for Mac
» How to Create Christmas Flash Greeting Ecard with photos and music
» Getting Started In Flash
» How to convert FLV video to MP3 audio for Mac OS
» Join flv videos together with just a few clicks
» How to convert flv file to avi for mac os x
» How to Create Christmas Flash Greeting eCard without programming skills
» Unknown Tag: Title10
Random Tutorial | Add Site

bbm.netBBM.net is designed to save you time and deliver the highest quality royalty-free music for your multimedia projects. Features include: over 450 Music Loop Packages from some of the best composers in the business, our music search engine to speed your selection process, alternate music versions & bonus sounds to use for rollovers or transitions, free technical support and free consulting.

Click here for details »

Senior Web Designer
Aquent
US-GA-Atlanta

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Backend

Categories Keyword search using MySQL / PostgreSQL / MSSQL / InterBase / ODBC, PHP and Flash 4
Author: James Greenhalgh | Website: http://www.odslinux.com |

 
Page 7
«prev 1 2 3 4 5 6 7 8 9 next»

Onto the Flash

Well now that all the scary PHP and db stuff are done, the Flash is a breeze. I'm not going to go too in depth into the Flash, as the functionality is very basic. I will give a brief frame step by step though.

Frame 1:
The Ask Leaphy button gathers the question ('q') and how many results to return ('r') and sends those variables to the PHP.

Ask Leaphy Button Actionscript
On (Release, Key: )
   If (q ne "")
      Comment: Checks if the Maximum Results is a number, if not it returns 10.
      If (int(r) = 0)
         Set Variable: "r" = "10"
      End If
      Comment: Loads the variables into the PHP.
      Load Variables ("http://www.yourwebsite.com/dgssearch/search.php", "", vars=POST)
      Go to and Play ("Asking")
   End If
End On


Note: Don't forget to change the address from http://www.yourwebsite.com/dgssearch/search.php in the .fla


Frame 2:
The editable text fields become non editable and I changed the colour for effect. The loop begins waiting for the response from the PHP script. If the PHP has finished executing and a match was recorded, it goes to the 'Possible Answers' frame. If there is no match, then it proceeds to the 'Sorry' frame.

Frame 2 Actionscript
Comment: Check if the query returned any matches. If
((linksloaded eq "yes") and (link1>  0))
   Set Variable: "i" = "1"
   Set Variable: "links" = ""
   Loop While (eval("link"&i) ne "")
      Set Variable: "links" = links & eval("word"&i)  & Newline
      Set Variable: "i" = i+1
   End Loop
   Go to and Stop ("Possible Answers")
Else If ((linksloaded eq "yes") and (link1 = 0))
   Go to and Stop ("Sorry")
End If


Frames 3-7:
This is the first loop to keep our playhead moving while the search.php is executing.

Frame 8:
This is the 'Sorry' frame. It is where the playhead goes to if no matches are made with the DB, it includes an Ask Again button that wipes all the variables and returns you to the first frame.

Frame 9:
This is the 'Possible Answers' frame. After the PHP has returned the variables, a text field is populated with the possible answers. This frame also includes 10 instances of the invisible button. These invisible buttons call the goToLink script, passing the buttonNumber variable that is different for each button.

Invisible Button Actionscript (buttonNumber changes for each button)
On (Release)
   Set Variable: "buttonNumber" = 1
   Call ("goToLink")
End On
goToLink Actionscript
Set Variable: "id" = eval("link"&(links.scroll-1+buttonNumber))
If (id ne "")
   Begin Tell Target ("/Cache")
      Set Variable: "id" = /:id
      Load Variables ("http://www.yourserver.com/dgssearch/answer.php", "", vars=POST)
      Go to and Play (2)
   End Tell Target
   Go to and Play ("Answer")
End If


The only really tricky part of this Actionscript is perhaps the first line. To get the id, Flash evaluates what the link## variable is equal to, where ## is the buttonNumber variable sent from the invisible button + the scroll.

Note: I use this technique often when working with sending and recieving variables from backends. By using an Invisible Movie Clip Instance named 'Cache' to store my data and post my variables to, I can control all the variables being sent back and forth to the PHP/Perl a lot easier.


Frame 10:
This playhead begins to loop as the PHP seeks out the answer to the question. Once the answer is loaded it moves to the 'Answer Loaded' frame.

Frame 10 Actionscript
Comment: PHP loads the answer from the db
If (Cache:answerloaded)
   Set Variable: "theTruth" = Cache:theTruth
   Begin Tell Target ("/Cache")
      Go to and Stop (1)
   End Tell Target
   Go to and Stop ("Answer Loaded")
End If


Frames 11-15:
This is the second loop to keep our playhead moving while the answer.php is executing.

Frame 16:
This is the 'Answer Loaded' frame. Simply a display for the answer that gets returned from the database query. It also includes buttons to either go back to the possible questions or GO Back and use a different keyword entirely.

Frame 17:
gotoLink Actionscript (as described earlier) Again, don't forget to change the server address in the Actionscript.

«prev 1 2 3 4 5 6 7 8 9 next»

» Level Advanced

Added: : 2001-02-19
Rating: 8.07 Votes: 47
Hits: 3912
» Author
I work for a Canadian software company as a logisitics director. We provide custom configured Linux distributions. In my spare time I sleep.
» Download
Download the files used in this tutorial.
Download (103 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Whitepapers and eBooks

Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Microsoft PDF: Top 10 Reasons to Move to Server Virtualization with Hyper-V
Microsoft PDF: Six Reasons Why Microsoft's Hyper-V Will Overtake Vmware
Microsoft Step-by-Step Guide: Hyper-V and Failover Clustering
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Microsoft PDF: Top 11 Reasons to Upgrade to Windows Server 2008
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
  PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
Go Parallel Article: Q&A with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
HP eBook: Guide to Storage Networking
MORE WHITEPAPERS, EBOOKS, AND ARTICLES