SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot ThaLIkz's Avatar
    Join Date
    Jan 2002
    Location
    Drenthe, The Netherlands
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Shoutbox flash/php&mysql

    Hi,
    I've made a shoutbox using flash/php&mysql with the help of this ( http://www.sephiroth.it/tutorials/f.../page001.php#11 ) tutorial. I've modified(?) it to my site and everything is workign fine exepct i'm getting some numbers and i don't know where are they coming from, see for yourself ( http://www.members.lycos.nl/amstelonline/test.html , the message delay is 5 sec)
    here's the actionscript code ( think that the error is somewhere there but i'm really new with flash so i don't know for sure)

    PHP Code:
    System.useCodepage true;
    format = new TextFormat();
    testo.html true;
    function 
    formatText(textBox,ita,siz,Bold,colour){
    format.italic ita;
    format.size "65";
    format.bold Bold;
    format.font "Verdana";
    format.align "center";
    format.color "#000000";
    textBox.setTextFormat(format);
    }
    testo.text "Loading news...";
    formatText(testo,false,65,true);
    temp = new LoadVars();
    temp.load("[url=http://members.lycos.nl/amstelonline/getdata.php]http://members.lycos.nl/amstelonline/getdata.php[/url]" );
    temp.onLoad = function(){
    myArray = new Array();
    for(var 
    a in this){
    if(
    != "onLoad" ){
    myArray.push(this[a]);
    }
    }
    testo.htmlText myArray[1];
    formatText(testo,false,65,true);
    var 
    oldt getTimer();
    var 
    ok true;
    var 
    myArray.length;
    var 
    2;
    _root.onEnterFrame = function(){
    getTimer();
    if(
    t-oldt>5000){
    testo.htmlText myArray[i+1];
    formatText(testo,false,65,true);
    if(
    i<(l-2)){
        
    += 2;
    }else{
        
    0;
    }
    oldt getTimer();
    }
    };
    }; 
    Hope y'all could help me
    Last edited by ThaLIkz; Mar 6, 2003 at 10:55.

  2. #2
    SitePoint Zealot ThaLIkz's Avatar
    Join Date
    Jan 2002
    Location
    Drenthe, The Netherlands
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    doesen't anyone knows?

  3. #3
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ThaLIkz
    doesen't anyone knows?
    Yes someone knows, first off it appears you are using Flash MX, but you are using Flash 5 script in the form of getTimer to cycle your array. I did it slightly different and I don't get the numbers you do. I use Flash MX's setInterval to run a function every 5 seconds that shows and item from the array. If the counter variable reaches the length of the array - 1 it resets to 0 or else it increments by one.

    Code:
     System.useCodepage = true;
    myArray = [];
    myURL = "http://members.lycos.nl/amstelonline/getdata.php";
    format = new TextFormat();
    testo.html = true;
    function formatText(textBox,ita,siz,Bold,colour){
     format.italic = ita;
     format.size = siz;
     format.bold = Bold;
     format.font = "Verdana";
     format.align = "center";
     format.color = colour;
     textBox.setTextFormat(format);
    }
    testo.text = "Loading news...";
    formatText(testo,false,12,true, 0x000000);
    temp = new LoadVars();
    temp.load(myURL);
    temp.onLoad = function(){
     for(var a in this){
      if(a != "onLoad" ){
       myArray.push(this[a]);
      }
     }
     showItem();
    };
    cnt = 0;
    function showItem() {
     trace ("Showing item");
     testo.htmlText = myArray[cnt];
     formatText(testo,false,12,true, 0x000000);
     if(cnt == (myArray.length-1)) {
      cnt = 0; 
     }
     else {
      cnt++; 
     }
    }
    myInterval = setInterval(showItem, 5000);

  4. #4
    SitePoint Zealot ThaLIkz's Avatar
    Join Date
    Jan 2002
    Location
    Drenthe, The Netherlands
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks i've used your code but im still getting those numbers and now i'm also getting some other thing (like "> ).

    Maybe it's something with my php, im gonna post it so you could take a look

    <?php

    $database = "******
    ";
    $connect = mysql_connect(
    "localhost","******","******") or die ("Server off-line");
    mysql_select_db($database);

    $query =
    "SELECT * FROM news ORDER BY datum ASC";

    $result = mysql_query($query) or die (
    "Error query");

    $num_rows = mysql_num_rows($result);

    for($i=
    0;$i<$num_rows;$i++){

    $row = mysql_fetch_array($result);

    $news =
    "news$i";
    $news = $row['bericht'];

    print(
    "&news$i=$news");

    }

    mysql_close($connect);

    ?>



    Or maybe u just could send me the *.swf file cause u didn't get the number and used the same * .php file.
    P.S. I've put the all the files in a folder /ticker (ticker/getdata.php, ticker/news.swf etc)

  5. #5
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its most definitely that lycos code that gets put in that is causing the problem. I assume its there because this is a free hosting account. I am not sure how to get around this. Maybe writing the data to a text file when it changes and calling the text file from flash.

  6. #6
    SitePoint Zealot ThaLIkz's Avatar
    Join Date
    Jan 2002
    Location
    Drenthe, The Netherlands
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thnks, that's what i was thinking too.

    I'm gonna try something else then


Bookmarks

Posting Permissions

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