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 3892
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, table
design, etc. I have a couple of questions, however. First, stored
procedures vs. functions. In my world, a function is a body of code
that returns a value; a procedure is a body of code that does things
but does not return a value (other than...
|
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
produce two messages having the same message digest.
That conjecture is false, as demonstrated by Wang, Feng, Lai and
Yu in 2004 . Just recently, Wang, Yu, and Lin showed a short-
cut solution for finding collisions in SHA-1 . Their result
|
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 my mappings between named colors,
HEX values and the Long Integer values used in Access are
not jibbing. Anyone have a nice list laying around?
Danny J Lesandrini
dlesandrini@hotmail.com
|
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 slots, all pointing to
a common base function. These functions should be protected, not public.
Here is a short example of what I'm trying to accomplish:
class XYZ
{
| |
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 make things simpler and better readable I'd make all default parameters
named parameters so that you can decide for yourself which one to pass and
which not, rather than relying on massively overlaoded methods which
hopefully provide the best...
|
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
on it's own. However when I call the child object I get an error
" has no properties (in firefox)."
I simple test:
|
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
Date() - Returns the current system date
Now() - Returns the current system timestamp (date and time)
|
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 (most recent call last):
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |