A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: .asp not working with a movie inside a movie.

  1. #1
    I have a guestbook which calls on an .asp file that works when it is loaded by its self. However, when I try to load the movie into my main movie with this AS
    on (release) {
    loadMovie ("./gb/guestbook.swf", "mainmovie");
    }
    it does not work. "mainmovie" it the target empty movie that I am loading the movie into. The path is correct, because the movie starts to load and then hangs. Here are the AS's. These are in the movie that I am loading into the movie.
    --------------------------------
    Frame 1
    --------------------------------
    fscommand ("allowscale", "false");
    ifFrameLoaded (1) {
    }
    loadVariablesNum ("guest_flash_read.asp", 0, "POST");
    -----------------------------------------------------
    Frame 5
    --------------------------------
    if (varTotal == null) {
    gotoAndPlay (2);
    } else {
    gotoAndPlay ("loaded");
    }
    --------------------------------
    Frame 10 (Also labled "loaded"
    --------------------------------
    i = 1;
    function fillOutBook (i) {
    _root.mc_book.varDate = "on: "+_root["varDate"+i];
    _root.mc_book.varName = "posted by: "+_root["varName"+i];
    _root.mc_book.varEmail = "mailto:"+_root["varEmail"+i];
    _root.mc_book.varFeedback = "<b>"+_root["varFeedback"+i]+"</b>";
    _root.mc_book.varViewing = i+" of "+_root.varTotal;
    }
    fillOutBook(1);
    stop ();
    -------------------------------------
    And here is the .asp file for reading the entries from the data base. This path is also correct.
    -------------------------------------
    <%@LANGUAGE="VBSCRIPT"%>
    <%
    set rsGuestbook = Server.CreateObject("ADODB.Recordset")

    rsGuestbook.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Server.Mappath("../db/guestbook.mdb")
    rsGuestbook.Source = "SELECT * FROM guestbook ORDER BY GuestID DESC"
    rsGuestbook.CursorType = 0
    rsGuestbook.CursorLocation = 2
    rsGuestbook.LockType = 3
    rsGuestbook.Open
    rsGuestbook_numRows = 0
    %>

    <%
    rsGuestbook_total=0
    While (NOT rsGuestbook.EOF)
    Response.Write "varName"&(rsGuestbook_total + 1)&"="&Server.URLEncode(rsGuestbook("GuestName")) _
    &"&varEmail"&(rsGuestbook_total + 1)&"="&Server.URLEncode(rsGuestbook("GuestEmail")) _
    &"&varFeedback"&(rsGuestbook_total + 1)&"="&Server.URLEncode(rsGuestbook("GuestFeedback "))_
    &"&varDate"&(rsGuestbook_total + 1)&"="&Server.URLEncode(rsGuestbook("GuestDate"))& "&"
    rsGuestbook_total = rsGuestbook_total + 1
    rsGuestbook.MoveNext
    Wend
    Response.Write "varTotal="&rsGuestbook_Total
    rsGuestbook.Close
    Set rsGuestbook=Nothing
    %>
    -------------------------------------------------
    I believe that the problem is with the action scripting but I can not figure out what it is. Like I said, this works when you load the movie by itself, but when it is loaded inside of another movie, it will not run. Anybody know the answer to this?

    Thanks,

  2. #2
    Junior Member
    Join Date
    Mar 2001
    Posts
    21
    On loadMovie it looks like you need another "." to go up to the right level:

    on (release) {
    loadMovie ("./gb/guestbook.swf", "mainmovie");
    }

    Also, are you sure your asp page is getting called? To test it, I usually set up a testing table in my database and just write something from asp into the table near the bottom of the asp page. If it doesn't get written in the table then I can debug the asp or the function that calls the asp. I suspect that if the swf works when you call it by itself, you've got an incorrect path for the loadVariablesNum since you've got them in different directories if you didn't change the code. In any case, writing to a test table is invaluable in determining if the page is getting called.

    If it is getting called...then put a simple dynamic text box on the main timeline and play the timeline after the variables have loaded to make sure that something is getting passed back to Flash. This will help narrow down the problem.

    Good luck.
    ~rockyroad


  3. #3
    No, the path is correct. The main movie is in the root and the guestbook.swf file is in a subdirectory under the root. So, it lookes like this when I look at it on my local machine "d:/www/gb/guestbook.swf" and yes, I have IIS running, and I am viewing it through IE as a server path "./" means that I am going forward one directory into "gb". If I went "../gb" that would mean that I wanted to go back to "d:/" and then forward to "gb". Or am I wrong about this. I want to say that it has something to do with the _root. fuction in frame 10, but that can not be the case because the movie never loads past Frame five because it displays text which says, "Loading movie please wait." Is there a better way to write
    -------------------------------------
    fscommand ("allowscale", "false");
    ifFrameLoaded (1) {
    }
    loadVariablesNum ("guest_flash_read.asp", 0, "POST");
    ------------------------------------------------------
    Any more ideas of what may be wrong? This is driving me NUTS!

  4. #4
    Junior Member
    Join Date
    Mar 2001
    Posts
    21
    Have you tried writing the variables out to the screen in the main movie timeline? I see a couple of things that might be causing problems:

    1. In your asp code, you are in a loop, but you don't put & signs before all of your variables. The first time through you're right that varName wouldn't need an & sign, but what if you've got more than 1? Also, I think you'd need one for your variable varTotal.

    Response.Write "varName"&(rsGuestbook_total + 1)&"="&Server.URLEncode(rsGuestbook("GuestName")) _
    &"&varEmail"&(rsGuestbook_total + 1)&"="&Server.URLEncode(rsGuestbook("GuestEmail")) _
    &"&varFeedback"&(rsGuestbook_total + 1)&"="&Server.URLEncode(rsGuestbook("GuestFeedback "))_
    &"&varDate"&(rsGuestbook_total + 1)&"="&Server.URLEncode(rsGuestbook("GuestDate"))& "&"
    rsGuestbook_total = rsGuestbook_total + 1
    rsGuestbook.MoveNext
    Wend
    Response.Write "varTotal="&rsGuestbook_Total

    I generally put "&" in front of all variables because it doesn't cause any problems if it's the first one...and if you later decide to add code you don't spend as much time debugging.

    2. As far as I know, if you want to go forward to reference a file, you should simply reference "gb/guestbook.swf", but there's probably more than one way to skin a cat.

    3. I'd add a _root in front of varTotal in frame 5, even though I'm sure it is on the root, it makes it more clear, especially as the thing grows.

    Those are my ideas. I'm guessing your variable varTotal isn't getting loaded...have you written it out to screen in a dynamic text box?

    ~rockyroad

  5. #5
    Junior Member
    Join Date
    Mar 2001
    Posts
    21
    Have you tried writing the variables out to the screen in the main movie timeline? I see a couple of things that might be causing problems:

    1. In your asp code, you are in a loop, but you don't put & signs before all of your variables. The first time through you're right that varName wouldn't need an & sign, but what if you've got more than 1? Also, I think you'd need one for your variable varTotal.

    Response.Write "varName"&(rsGuestbook_total + 1)&"="&Server.URLEncode(rsGuestbook("GuestName")) _
    &"&varEmail"&(rsGuestbook_total + 1)&"="&Server.URLEncode(rsGuestbook("GuestEmail")) _
    &"&varFeedback"&(rsGuestbook_total + 1)&"="&Server.URLEncode(rsGuestbook("GuestFeedback "))_
    &"&varDate"&(rsGuestbook_total + 1)&"="&Server.URLEncode(rsGuestbook("GuestDate"))& "&"
    rsGuestbook_total = rsGuestbook_total + 1
    rsGuestbook.MoveNext
    Wend
    Response.Write "varTotal="&rsGuestbook_Total

    I generally put "&" in front of all variables because it doesn't cause any problems if it's the first one...and if you later decide to add code you don't spend as much time debugging.

    2. As far as I know, if you want to go forward to reference a file, you should simply reference "gb/guestbook.swf", but there's probably more than one way to skin a cat.

    3. I'd add a _root in front of varTotal in frame 5, even though I'm sure it is on the root, it makes it more clear, especially as the thing grows.

    4. Are you viewing the .swf file in the browser or the .html page? I've had trouble with Flash's html code that gets generated when you publish a file--my variables don't load...so I had to generate the html code in Dreamweaver instead. I'd test using the swf and then if the html doesn't work, fix the html.

    Those are my ideas. But...again, I'm guessing your variable varTotal isn't getting loaded...have you written it out to screen in a dynamic text box?

    ~rockyroad

  6. #6
    I would write it out to a dynamic text box, but I don't have a clue how to do that.

  7. #7
    Junior Member
    Join Date
    Mar 2001
    Posts
    21
    Actually, after looking at your code again, in frame 5, you'll definitely need to add _root. , so you should have
    if (_root.varTotal == null) {


    because you're loading your variables into the root level...not into the mainmovie mc. The way it's referenced, just using varTotal would always return a null value.

    If you don't know how to set up a dynamic text box to test it, I'd just do the database method I explained before...if it's writing the correct info to the db, then it should be writing the correct info into flash.

    ~rockyroad

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