Hi,
I would like to change the following anonymous to a named function which receives the newsID as an argument and returns the title, content and image of the article (which are currently done within the function).
For calling the function I think I use the following syntax, once it's been given a name,
but how do I retrieve the values that I returned from the function?
Thanks,
Sean
I would like to change the following anonymous to a named function which receives the newsID as an argument and returns the title, content and image of the article (which are currently done within the function).
Code:
titleMC.onRelease = function()
{
varSenderContent = new LoadVars();
varReceiverContent = new LoadVars();
varSenderContent.newsID = this.newsID;
varSenderContent.sendAndLoad("localhost/GetNewsDetail.php",
varReceiverContent, "GET");
varReceiverContent.onLoad = function()
{
for (p in this)
{
if (typeof this[p] == "string")
{
articleContent = this.data.split('~');
_root.copy_mc.article.text = articleContent[1];
image = "http://www.bemod.co.uk/images/newsImages/" +
articleContent[2];
var CTNR_WIDTH=525; //original width of container var CTNR_HEIGHT=156; //original height of container
loadMovie(image, "_root.photo_mc");
_root.photo_mc._xscale=CTNR_WIDTH/800*100; _root.photo_mc._yscale=CTNR_HEIGHT/600*100;
_root.title_mc.title.text = articleContent[0];
}
}
}
}
Code:
titleMC.onRelease = returnArticleContent( newsID )
Thanks,
Sean
Comment