A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Typewriter effect - linked to mysql db

  1. #1
    Junior Member
    Join Date
    Sep 2005

    Typewriter effect - linked to mysql db

    Hi there

    We have recently had a request for a webpage where a single news headline is typed out across the screen letter by letter - when typed out it disappears, and in its place the next headline types out. There'd be about 6 headlines. When any of the headlines are clicked it would go through to that headlines corresponding news story.

    I figured if i had a mysql table with id, headlines, story, timestamp - with the data stored in here i could somehow get Flash to communicate with it to display these headlines, and make them dynamically link to the story.

    Can this be done?

    Does anyone have a script i can have - or is there a tutorial addressing this anywhere? I've seen the typewriter flash tutorial/script but this just calls static lines of text - not from a db.

  2. #2
    Senior Kid
    Join Date
    Jan 2002
    I am right behind ya
    Shouldnt be too difficult

    get your typewriter effect here(kind of old, but works)

    google 'flash mysql', you need some server side to script to pull data from the database
    -The Dancin kidd

  3. #3
    Junior Member
    Join Date
    Sep 2005

    getting info out of mysql

    if i had a database with a name of "news" with a table "stories" and the fields you said i would use the folowing php script to create and xml file wich you can call from flash to populate your fields by loading the php file into the movie. this scips generates xml out put so instead of loading an xml file you load this php file I'll work on a sample fla file and posted so you can see.


    //connect to mysql
    $connection = mysql_connect("localhost","user","password")
    or die ("Couldn't connect to server");

    //selecting database
    $db = mysql_select_db("news", $connection)
    or die ("Couldn't select database");

    //get the data the table stories
    $query = "SELECT * FROM stories";
    $result = mysql_query($query)
    or die("Query Failed: ".mysql_error());

    //create arrays for the fields something like
    $id_array = array(); ///to store the id data
    $headlines_array = array(); ///for the headlines data
    $story_array = array(); ///for the story data
    $time_array = array(); ///for the time stamp data

    ///making the xml file

    echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
    echo "<news>\n";

    ///sending the data to the array

    while ($row = mysql_fetch_array($result)) {
    $id_array[] =$row[id];
    $story_array[] = $row[story];
    $time_array[] = $row[timestamp];

    //this for loop will put all the info on a xml tag that you can later grab from with in flash
    for ($i=0;$i<count($id_array);$i++){
    echo "<stories id=\"$id_array[$i]\" headline=\"$headlines_array[$i]\" story=\"$story_array[$i]\" time=\"$time_array\" />";
    echo "</news>\n";


    hope this helps
    Last edited by acostagera; 09-24-2005 at 08:20 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center