question about PHP Vs Actionscript ..?
First of all, I have a complicated requirement!
and Im not sure it will possible or not, so please read my requirement.
What I want is I've a flash xml widget(created myself!) works like when I post a new article it'll be displayed in that widget through accessing rss. Then I placed it my website for visitors can publish it there site as a widget, the real requirement is coming now, I want to add a "pcode"(pcode means like utm tag, see the example http://www.mysite.com/?pcode=demo
in this url "demo" is the pcode) after the ending of each links from the article widget title(note: its an swf).
So there is a 'variable' for pcode sets by php guy.
So I want to pass that variable from php to Actionscript and it should display at the end of the article url like /?pcode=varible
And my Actionscript is given below
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
var xml:XML;
function onLoaded(e:Event):void
{
var style:StyleSheet = new StyleSheet();
var no = "rsswidget";
style.setStyle(".heading", {fontWeight:"bold", color:"#6184b7", fontSize:12});
style.setStyle(".readmore", {fontWeight:"normal", color:"#6184b7", fontSize:11});
开发者_如何学编程xml = new XML(e.target.data);
var il:XMLList = xml.channel.item;
for(var i:uint=0; i<il.length(); i++)
{
t.setStyle("styleSheet", style);
t.htmlText = "<a href='"+il.link.text()[0]+'?utm_source=rsswidget'+"' class='heading'>"+il.title.text()[0]+"</a>"+"\<br />"+il.description.text()[0]+"\<br>"+"<a href='"+il.link.text()[0]+'?utm_source=rsswidget'+"' class='readmore'>"+'Read more »'+"</a>"+"\<br />_____________________<br /><br />"+"<a href='"+il.link.text()[1]+'?utm_source=rsswidget'+"' class='heading'>"+il.title.text()[1]+"</a>"+"\<br />"+il.description.text()[1]+"\<br>"+"<a href='"+il.link.text()[1]+'?utm_source=rsswidget'+"' class='readmore'>"+'Read more »'+"</a>"+"\<br />_____________________<br /><br />"+"<a href='"+il.link.text()[2]+'?utm_source=rsswidget'+"' class='heading'>"+il.title.text()[2]+"</a>"+"\<br />"+il.description.text()[2]+"\<br>"+"<a href='"+il.link.text()[2]+'?utm_source=rsswidget'+"' class='readmore'>"+'Read more »'+"</a>";
}
}
loader.load(new URLRequest("http://www.mysite.com/RSS/index-rss.php"));
Is that something practical..? I know its complicated!
Any suggestions would be appreciated!
Although feel free to ask any further clarifications needed..
Thanks in Advance
Paul
Use the URLLoader class. It can load all sorts of data, including url-encoded variables.
精彩评论