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). -
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];
-
}
-
}
-
}
-
}
-
For calling the function I think I use the following syntax, once it's been given a name, - titleMC.onRelease = returnArticleContent( newsID )
but how do I retrieve the values that I returned from the function?
Thanks,
Sean
3 3883
Hi, you cannot make a function return multiple values, what you can do is make the function do all by itself without returning anything, or returnan array or an object and use that returned array/object to do whatever you whant.
Anyway, you cannot call a function that return values the way you did, that way the button will recieve the returned "something". You need to call the function from a variable, so the variable will be the one recieving what the function returns. Like this: -
titleMC.onRelease = function() {
-
//if the function returns an array:
-
var some:Array = returnArticleContent; //yes, if you dont pass parameters, you don't put ();
-
//if the function returns an object:
-
var some:Object = returnArticleContent;
-
-
//now do whatever you want with the "some" variable.
-
}
-
If the function returns an object, the variable will become that object. And then you can work with that variable -now an object- and do whatever you want width it.
Kind regards,
The_Nephilim
PD: Sorry if I missed any "k", I'm not in my house and this eyboard sucs
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). -
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];
-
}
-
}
-
}
-
}
-
For calling the function I think I use the following syntax, once it's been given a name, - titleMC.onRelease = returnArticleContent( newsID )
but how do I retrieve the values that I returned from the function?
Thanks,
Sean
Thanks so much. That's perfect. You star!!!!
Hi, you cannot make a function return multiple values, what you can do is make the function do all by itself without returning anything, or returnan array or an object and use that returned array/object to do whatever you whant.
Anyway, you cannot call a function that return values the way you did, that way the button will recieve the returned "something". You need to call the function from a variable, so the variable will be the one recieving what the function returns. Like this: -
titleMC.onRelease = function() {
-
//if the function returns an array:
-
var some:Array = returnArticleContent; //yes, if you dont pass parameters, you don't put ();
-
//if the function returns an object:
-
var some:Object = returnArticleContent;
-
-
//now do whatever you want with the "some" variable.
-
}
-
If the function returns an object, the variable will become that object. And then you can work with that variable -now an object- and do whatever you want width it.
Kind regards,
The_Nephilim
PD: Sorry if I missed any "k", I'm not in my house and this eyboard sucs
You're welcome Sebarry.
Good luck with your project.
Best regards!
The_Nephilim
Thanks so much. That's perfect. You star!!!!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: BlueDragon |
last post by:
The place where I work is moving to MS SQL Server from Lotus Notes. I
have done a lot of coding in Lotus Notes, and have, I suppose,
intermediate skills in basic SQL -- queries, insert, updates,...
|
by: Bryan Olson |
last post by:
The current Python standard library provides two cryptographic
hash functions: MD5 and SHA-1 . The authors of MD5 originally
stated:
It is conjectured that it is computationally infeasible to...
|
by: Danny Lesandrini |
last post by:
I'm using an Access database to drive a web site and the
colors of various table backgrounds are stored in Access.
I want users of the Access database to be able to select
colors for the site, but...
|
by: Kejpa |
last post by:
Hi,
I have a function Sum as....
Function Sum(ByVal ParamArray Values() As Double) As Double
Dim rSum, itm As Double
For Each itm In Values
rSum += itm
Next
Return rSum
End Function
|
by: Ben Voigt |
last post by:
I have a function that is called for several distinct reasons. It is
conceivable that a subclass would want to handle those cases differently.
Therefore, what I want to do is have multiple v-table...
|
by: cody |
last post by:
I got a similar idea a couple of months ago, but now this one will require
no change to the clr, is relatively easy to implement and would be a great
addition to C# 3.0 :)
so here we go..
To...
|
by: Pacific Fox |
last post by:
Hi all,
haven't posted to this group before, but got an issue I can't work
out... and hoping to get some help here ;-)
I've got a base object that works fine with named arguments when called...
|
by: MMcCarthy |
last post by:
Access has a number of built-in functions which can be generally used in queries or VBA code. Some of the more common ones are:
Note: anything in square brackets is optional
Date Functions
...
|
by: Gabriel Rossetti |
last post by:
Hello,
I can't get getattr() to return nested functions, I tried this :
.... def titi():
.... pass
.... f = getattr(toto, "titi")
.... print str(f)
....
Traceback...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |