Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.


Results 1 to 3 of 3

Thread: blog tutorial, only displaying one entry

  1. #1

    blog tutorial, only displaying one entry

    I'm doing this
    http://www.webmonkey.com/webmonkey/0...tw=programming tutorial for a blog in flash and I'm stuck on part of it...the end. I already wrote about this tutorial in a previous thread but I have that part figured out. This is more about the actionscript part of it...or maybe it's the php. I'm not sure. I'm not sure what I'm doing wrong but I'm done with the tutorial and I only have one entry in my blog showing up online. I have 3 in my database. I'm wondering why I'm not seeing the archives for the others. My php is:

    mysql_pconnect ("localhost", "username", "password");

    mysql_select_db ("blog");
    $qResult = mysql_query ("SELECT * FROM blog_entries ORDER BY id DESC");

    $nRows = mysql_num_rows($qResult);
    $rString ="&n=".$nRows;

    for ($i=0; $i< $nRows; $i++){
    $row = mysql_fetch_array($qResult);
    $rString .="&id".$i."=".$row['id']."&"."&title".$i."=".$row['title']."&"."&date".$i."=".$row['date']."&"."&entry".$i."=".$row['entry']."&";
    echo $rString."&";


    My actionscript is:

    //function to load external data using the loadVars() object
    //l=name of loadVars object
    //n=name of text field
    //t=trigger to decide whether to show all entries or just one.
    //e= entry number to display (number)
    //f=file to load from (string)
    function lv(l, n, t, e, f) {
    sb.setSize(null, 200);
    sb2.setSize(null, 50);
    //create a new loadVars object if one doesn't already exist if it does, use it
    if (l == undefined) {
    l = new LoadVars();
    l.onLoad = function() {
    var i;
    //clear out any text that might already be there
    n.htmlText = "";
    //to show a single entry at a time we use the following code
    if (t == undefined) {
    n.htmlText += "<b>"+this["title"+e]+" - "+this["date"+e]+"</b><br><br>";
    n.htmlText += this["entry"+e];
    } else {
    //cycle through and show all entries
    for (i=0; i<this.n; i++) {
    n.txt.htmlText += "<u><a href='asfunction:_root.loadArc,"+this["id"+i]+"'>"+this["title"+i]+" - "+this["date"+i]+"</a></u><br>";

    function loadArc(passed) {
    arcNum = passed-1;
    lv(blog_lv, entries_txt, undefined, arcNum, "blog.php");
    //for the large entry textfield
    lv(blog_lv, entries_txt, undefined, 0, "blog.php");
    //for the archives text field
    lv(archive_lv, archive_txt, "cycle", null, "blog.php");

    I found another post on kirupa about this tutorial but I didn't understand how they fixed the problem. I'd appreciate your help.

    Thank you.


  2. #2
    I think it might have something to do with this:

    I saw this in the tutorial but I don't know how to break it apart. I'd really appreciate any help.

    n.txt.htmlText += "<u><a href='asfunction:_root.loadArc,"+this["id"+i]+"'>"
    +this["title"+i]+" - "+this["date"+i]+"</a></u><br>";

    "Our href tag might look a little strange to veteran HTML coders. Flash has a little-known feature that allows you to call a function from within an HTML tag. The syntax is asfunction:location/nameOfFunction,variable. The limiting thing is that you can pass only one variable using this method.

    The quickest way around that problem is to pass a variable as long string and then break it apart in your function, but that won't be an issue for us since we have only one variable to pass."


  3. #3
    Did you get this figured out. I'm having the same problem.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012