Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling SWF flash objects?

Status
Not open for further replies.

OreoBean1

Technical User
Oct 23, 2005
27
US
Whats up all.

I have an ASP page that pulls data from an RSS news feed in XML and should output it to HTML form in a nice little flash movie. The flash movie is simple it just rolls up the screen.

When I setup the ASP page which I got from someone else I had to change the objects around to use different drivers. I'm wondering if I should do the same with the flash object? It's currently calling:


Code:
Set Movie = Server.CreateObject("SWFScout.FlashMovie")

I'm wondering. Can I use load variables in the ASP page to call the same function in the client side Flash?

Please help me!
 
You do it indirectly by usign the ASP logic to dynamically change the text sent to the client.

The text might be HTML, CSS, javascript, whatever... just something that the browser interprets and uses to show the page.

But the ASP on the server runs to create the text and then IIS sends the text back to the browser where it is interpretted into a web page... so by the time the browser is looking at it the server is already done runing its logic... i hope that makes sense.
 
I think this excerpt from one of the FAQs explains it better: faq333-3048
-----------------------------------
Reference 3
Q: I have a javascript function (or client-side VBScript function) and I am trying to call an ASP function and it isn't working, why not?
A: ASP is server-side scripting. When the script executes it starts building the html file it will be sending to the browser. When the script finishes it finishes sending the file and then exits. At this point the client browser finishes receiving the file and the body onLoad event fires, so the ASP function no longer exists by the time javascript has started running (on the client).

Reference 4
Q: How do I set a javascript variable equal to the value of an ASP variable?
A: Using Response.Write you can write the value of the variable into your javascript section like so:

<%
'asp section
Dim a, b
a = 1
b = "One"
%>
<script language="JavaScript">
<!--
//assign javascript variables from asp variables
var myAspNum = <%=a%>;
var myAspStr = "<%=b%>";
//-->
</script>
 
Thank you for that information. I don't think it applies to what I am trying to do. Let me explain a little better what that is.

I'm trying to embed a flash movie in an ASP page that will output test aggregated from an RSS feed. I'm using code from ByteScout which you may have heard of, the reference is:
I had to change this code around a bit. Of course they want you to buy their software, after editing the code it pulls the data.

Once it pulls the data though, it's server side. I know that in Flash you can add a load variable string to the Flash movie to include information from a text or ASP file. Doesn't ASP have a property or method to send the data to Flash, and not try to pull it from the Flash component?
 
It's difficult without seeing your code, however, here's what I think is happening.

You don't send data to flash; flash pulls the data. It's hard without looking at your code, but are you calling the same page that the flash is in? If so, you won't get the data unless you are also building a paramaterized data array or string within the object/embed tag that Flash can interpret, or calling a seperate script. Usually you call an external file like below, not the same page.

I think what Sheco is getting at is once the page is comeplete, ASP isn't running any more, so there is no way for ASP to send data to the Flash

Steps:

ASP executes, builds HTML
ASP finishes
Flash movie loads
Flash movie starts playing.

What you want to do is get Flash to execute another ASP page with the data once the page has loaded

Steps:

ASP executes, builds HTML
ASP finishes
Flash Movie loads
Flash movie pulls data from asp or xml file.
Flash movie starts playing.


Code:
<html>
<body>
<!--myFlash.html-->
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="[URL unfurl="true"]http://download.macromedia.com/pub/shockwave/cabs/[/URL]
flash/swflash.cab#version=6,0,0,0" WIDTH="700" HEIGHT="350">
<PARAM NAME=movie VALUE="myFlash.swf">
<PARAM NAME="FlashVars" VALUE="&dataURL=myASP.asp?qs=value">
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#FFFFFF>
<EMBED src="myFlash.swf" FlashVars="&dataURL=myASP.asp?qs=value" quality=high bgcolor=#FFFFFF WIDTH="700" HEIGHT="350" TYPE="application/x-shockwave-flash" PLUGINSPAGE="[URL unfurl="true"]http://www.macromedia.com/go/getflashplayer"></EMBED>[/URL]
</OBJECT>
</body>
</html>
 
However, there are issues with calling cross-domain scripts with Flash. It's possible, but not without some jiggerypoke. I'd point the flash to an asp script that uses server-side xmlhttp to pull the data from where ever your datasource is.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top