all groups > flash data integration > december 2005 >
You're in the

flash data integration

group:

XML and Flash



XML and Flash kko_k
12/24/2005 4:32:14 AM
flash data integration: Hey!

I''ve got an swf that loads an external ASP file that responds by writing out
an XML.
(It's a flash guestbook, so users add text to text fields, and calls the ASP
page to add it to the database. And then the ASP page responds by printing out
all entries so that the swf can load them up to show them.)

One problem though.

If the ASP prints onto the browser screen something like

<gb>...<entry><name>somename</name><body>somecomment</body></entry>...........[r
epeat]...</gb>
(so via using ">" and "<" when using Response.Write), the Flash doesn't
recognise the "<" and ">" so it doesn't work.

If the ASP Response.Write doesn't use the ">" but uses ">" instead, then those
< and > signs don't pring onto the browser, but it's present if you do View
Source. In this case, the Flash seems to recognise the "<" and ">" but only ONE
'entry' is fed into the swf......
so even tho there are many <entry>.....</entry>, it only sees one of them,
then the </gb> tag.....

Am I meant to use ">" of ">"?How do i make it see all of them? ??

(Please tell me if I haven't explained this problem well enuff...)
Re: XML and Flash Motion Maker
12/26/2005 8:53:35 AM
Are you saying when you do this:


myReply_xml.onLoad(success)
{
trace (this)
// or
trace (myReply_xml)

}

you do not see the full XML you send from ASP?


--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
Hey!

I''ve got an swf that loads an external ASP file that responds by writing
out
an XML.
(It's a flash guestbook, so users add text to text fields, and calls the
ASP
page to add it to the database. And then the ASP page responds by printing
out
all entries so that the swf can load them up to show them.)

One problem though.

If the ASP prints onto the browser screen something like

<gb>...<entry><name>somename</name><body>somecomment</body></entry>...........[r
epeat]...</gb>
(so via using ">" and "<" when using Response.Write), the Flash doesn't
recognise the "<" and ">" so it doesn't work.

If the ASP Response.Write doesn't use the ">" but uses ">" instead, then
those
< and > signs don't pring onto the browser, but it's present if you do View
Source. In this case, the Flash seems to recognise the "<" and ">" but only
ONE
'entry' is fed into the swf......
so even tho there are many <entry>.....</entry>, it only sees one of them,
then the </gb> tag.....

Am I meant to use ">" of ">"?How do i make it see all of them? ??

(Please tell me if I haven't explained this problem well enuff...)

Re: XML and Flash kko_k
12/28/2005 12:53:57 PM
Yes, that's correct!

Instead of
<gb>
<entry><name>NAME1</name><body>BODY1></body></entry>
<entry><name>NAME2</name><body>BODY2></body></entry>
<entry><name>NAME3</name><body>BODY3></body></entry>
</gb>

I only see
<gb>
<entry><name>NAME1</name><body>BODY1></body></entry>
</gb>
Re: XML and Flash Motion Maker
12/29/2005 9:48:03 PM
<body>BODY1></body>
<body>BODY2></body>
<body>BODY3></body>
There are too many > in these tag nodes. This would lead to malformed XML
and Flash would probably parse incompletely.

Here is a stripped ASP file (I used Javascript but it should work with
VBScript) that returns the XML you posted. I used it in a Flash movie and
all entry nodes are returned.

<%@ language = "JScript" %>
<%

/*----------------------------------------------------------------------
Define response data as xml
---------------------------------------------------------------------*/
Response.ContentType = "text/xml";

/*----------------------------------------------------------------------
Build XML in a variable
---------------------------------------------------------------------*/
returnXML = "<gb>";
returnXML += "<entry><name>NAME1</name><body>BODY1</body></entry>";
returnXML += "<entry><name>NAME2</name><body>BODY2</body></entry>";
returnXML += "<entry><name>NAME3</name><body>BODY3</body></entry>";
returnXML += "</gb>";


Response.write(returnXML);
/*----------------------------------------------------------------------
Force all data responses back
---------------------------------------------------------------------*/
Response.flush();
/*----------------------------------------------------------------------
Terminate any further responses
---------------------------------------------------------------------*/
Response.end();
%>

--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
Yes, that's correct!

Instead of
<gb>
<entry><name>NAME1</name><body>BODY1></body></entry>
<entry><name>NAME2</name><body>BODY2></body></entry>
<entry><name>NAME3</name><body>BODY3></body></entry>
</gb>

I only see
<gb>
<entry><name>NAME1</name><body>BODY1></body></entry>
</gb>

Re: XML and Flash kko_k
12/31/2005 12:49:56 AM
Thanks, Motion Maker,
Yes, sorry, that was my typo when I was typing the post (then using copy
paste... :-( )
I don't have the ">" right after the BODYs.

This is what I have in my ASP code...


<% '---------------This file is the showEntries.file-------------------------

'----Start Declaring all variables
Dim DBConn, strDB, strInsertSQL

'----Give the Database Connection String
strDB = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
Server.MapPath("/kkodesign/database/gb.mdb") & ";DefaultDir=" &
Server.MapPath(".") & ";DriverId=25;FIL=MS
Access;MaxBufferSize=512;PageTimeout=5"



'----Open the database and insert the data

Set DBConn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.Recordset")
DBConn.Open strDB
'response.write "iSuccess=1" 'Send a success response to Flash


Response.Write"<?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;
standalone=&quot;yes&quot;?>"
Response.Write"<gb>"

Dim sqltext
sqltext = "SELECT * FROM guestbook"
set RS = DBConn.Execute(sqltext)
While NOT RS.EOF
Response.Write"<entry>"

Response.Write"<name>"
Response.Write RS("name")
Response.Write"</name>"

Response.Write"<date>"
Response.Write RS("date")
Response.Write"</date>"

Response.Write"<comment>"
Response.Write RS("body")
Response.Write"</comments>"

Response.Write"</entry>"
RS.MoveNext
WEND

Response.Write"</gb>"




'-----Close the database connection
DBConn.close
Set DBConn=Nothing
%>
Re: XML and Flash kko_k
12/31/2005 1:16:33 AM
I think I just found my error!!!!!! =)

Response.Write"<comment>"
Response.Write RS("body")
Response.Write"</comments>"

Re: XML and Flash Motion Maker
12/31/2005 1:57:31 AM
Great! Generally malformed XML is the place to look when all the XML tags or
data do not appear in Flash.

--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
I think I just found my error!!!!!! =)

Response.Write"<comment>"
Response.Write RS("body")
Response.Write"</comments>"

The tag names were different!

AddThis Social Bookmark Button