PDA

View Full Version : Loading 'which' value into Flash?


SteveH
07-10-2008, 11:59 AM
Hello

I have an ASP script which shows news items in a browser. It works fine. Now I am hoping to show these news items in my Flash (MX 2004) movie.

Can I ask which ASP value Action Script needs to load in order to be able to show these news items. Is it:

Response.Write(Application("rss-html"))
In my Action Script I have:

var myFeed:LoadVars = new LoadVars();
myFeed.onLoad = function(success) {
if (success) {
bbcNews_txt.text = this.?????????;
}else{
bbcNews_txt.text = "Connection Failed";
}
}
myFeed.sendAndLoad("BBCfeed.asp", myFeed, 'GET');

At the moment I get 'undefined' (not 'Connection Failed') in my 'bbcNews_txt' dynamic text box when I look at it online.

Cheers for any advice.

Steve

gnomeontherun
07-10-2008, 08:02 PM
I can't tell you what you want, because I think you are asking the wrong question. It is saying that your feed is correctly loaded. So

Does the ASP script output a correctly formed XML file? Or is it outputting the variables for Flash formatted variables? (&var1=something&)

That is what I need to know, because how you access variables depends on how you send the variables.

SteveH
07-11-2008, 08:17 AM
Hello Jeremy

Thanks for your reply.

The value that is passed to Flash, I think, is that contained in 'Response.Write'. So yes, the formula would be along the lines of

Response.Write "&variable_passed_to_Flash".

Therefore, I suspect what I need to pass to Flash would be:

Response.Write "&rss-html"

but I will confirm this.

There is no XML sheet. Everything has been formatted in ASP: headlines (links) and brief descriptions, which you can see here:

http://stevehigham59.7host.com/SteveTest/BBCfeed.asp

I think this means I have no need for AS nodes, child nodes, etc, in AS doesn't it?

What I didn't know or, rather, don't know is what I replace the red question marks with.

Cheers.

Steve

gnomeontherun
07-11-2008, 05:00 PM
Ok so you need to modify the ASP script first.

You need to drop some of the tags, <html>, <head> <title> <body>, so you have just the content. You then need to modify it so that the output is like this:

&feedText=<ul><li><a href='http://news.bbc.co.uk/go/rss/-/1/hi/technology/7501073.stm'>Firms 'miss' social site success</a><br>Businesses are not making the most of social networking sites, say researchers.<br> </li></ul>.....


You must also strip ALL ampersands from the included text, they will cause meyhem, so they need to be converted in ASP to &amp;

Lastly the flash code you need to add for the ??? is actually the name of the variable you set - in this case feedText.

var myFeed:LoadVars = new LoadVars();
myFeed.onLoad = function(success) {
if (success) {
bbcNews_txt.text = this.feedText;
}else{
bbcNews_txt.text = "Connection Failed";
}
}
myFeed.sendAndLoad("BBCfeed.asp", myFeed, 'GET');

SteveH
07-11-2008, 05:23 PM
That's great, Jeremy. Thank you very much.

I'm away from my own PC at the moment, so I will try it a little later. But it's looking good!

I'll post back, and thanks again.

Steve

SteveH
07-15-2008, 06:12 PM
Hello Jeremy

Just two quick questions.

My server is making the following available:

Response.Write "&rss-html"

Does Flash, then, which is looking for something to load (using sendAndLoad), not use this:

var myFeed:LoadVars = new LoadVars();
myFeed.onLoad = function(success) {
if (success) {
bbcNews_txt.text = this.rss-html;
}else{
bbcNews_txt.text = "Connection Failed";
}
}
myFeed.sendAndLoad("BBCfeed.asp", myFeed, 'GET');

The other thing was that when you say strip the HTML tags from the code which gives me my feed, do you mean EVERY tag, including those with the <% %> or just those outside it?

Thanks again.

Steve