Where Do Javascript RETURN Values Go?
If I access a javascript function which is supposed to return values, how do I access them and where? And should it be getURL() or loadVariables?
My javascript functions return values such as "status=ok" (without quotes).
Now, should I use getURL or loadVariables or loadVars? Should it be GET or POST or none? I've so far tried everything with no luck. Part of the complication is that my project is one with a movie loaded into a movie. The loaded movie is the one calling the javascript. Would the Status variable get loaded into THIS or level0?
FlashKit > Flash Help > Flash ActionScript
Posted on: 03-01-2004, 01:28 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Return Values
how do I return two values from the same function and then use the returned values seperately in another part of the script?....so say i want to return the variables var1 and var2 I know i would use return var1 and return var2 but when i use them in another part of the script i have to use var3 = func();.....but how would the script know that i wanted to use var1 as opposed to var2?
PHP Return Values
I have a Flash Form, and a PHP script that send an email, and all this is working fine. My issue is that in the PHP form, it verifies the e-mail address, and I would like some way of capturing the output of the PHP form in my flash form. basically, in this manner:
Flash form Submit Button Pressed.
Goto frame that displays a "Proccessing" type of animation
Info sent to PHP page.
PHP page processes, and sends email, or fails with error.
Flash picks up the return and does appropriate action.
In the PHP page, I'm using echo $ret_val to print the return value of my functions to the screen.
Thanks
PHP Return Values
I have a Flash Form, and a PHP script that send an email, and all this is working fine. My issue is that in the PHP form, it verifies the e-mail address, and I would like some way of capturing the output of the PHP form in my flash form. basically, in this manner:
Flash form Submit Button Pressed.
Goto frame that displays a "Proccessing" type of animation
Info sent to PHP page.
PHP page processes, and sends email, or fails with error.
Flash picks up the return and does appropriate action.
In the PHP page, I'm using echo $ret_val to print the return value of my functions to the screen.
Thanks
HELP Need A Function To Return 2 Values
ok, i've written a function and im trying to get it to return 2 different values
example of what i need
Code:
thisArray = myFunction(args)
----output----
thisArray[0] = first value
thisArray[1] = second value
is there a way to do this?
or do i return 1 string value which is a concantenated string of 2 values with an identifier in between?
Code:
thisVariable = myFunction(args)
thisArray = split(thisVariable, ":")
----output----
thisArray[0] = first value
thisArray[1] = second value
where the : is the identifier
im trying the second method now, but for some reason it returns 'undefined' all the time...
Fscommand() And Return Values
Hi all,
Does anyone know if fscommand() returns the result of the function called?
Say for example that I have a browser script function that returns a value when called. Does the following work?
x = fscommand("someScriptReturningX")
If not, is there another way for flash to access this value?
Thanks,
Makac
Different Return Values For A Function?
Hey,
I have a function which could return different types of possible datatypes,
depending on the input. What should i set to be the return value of the function in the definition?
Isn't this ok:
ActionScript Code:
public function getSubData(inDataType:string):Object {
var obj_to_return:object;
if (inDataType == "arr") {
obj_to_return = global_array; //An array with some sprites in it.
}
else if (inDataType == "sprite") {
obj_to_return = global_array[0]; //A sprite
}
return obj_to_return;
}
When using the function in my code:
var sprite_obj:sprite = getSubData("sprite");
i get:
"1118: Implicit coercion of a value with static type Object to a possibly unrelated type..."
Is this possible?
Thanks,
Guy
ENTER_FRAME Return Values
I'm trying to return a value from a function but I keep getting this error: "Incorrect Number of Arguments. Expected 1." I think there should be a pretty easy solution to this one but I just don't know what it's asking for here. I assumed it wanted the name of the variable I was trying to return but that wasn't right. Here's the code. Also, is it possible to return more than one value from a single function?
Thanks,
Joe
Attach Code
function getGreenInfo(event:Event):Number {
var greenNumber:Number;
greenNumber = greenBar.currentFrame;
return greenNumber;
}
stage.addEventListener(Event.ENTER_FRAME, getGreenInfo);
trace(getGreenInfo());
GetPixel() Return Values
I'm using getPixel() for reading a map from a bitmap but it returns somewhat strange and varying values.
I'm also using the conversion from base-10 to base-16 (toString(16))
Like if I have a area of white #FFFFFF it returns #FEFEFE. This is true for everything with FF value, does AS3 never return FF or could the problem be with pngs?
I do use palette based pngs and check that the image has the right colors.
The real problems start with other colors,
when it finds green (#00FF00), it returns FE00. and with blue just FE
Return Mutual Values In Two Arrays
Hi,
suppose I have 2 arrays:
Code:
var array1:Array = new Array("jim", "jane", "richie");
var array2:Array = new Array("john", "jim", "bert", "jane");
How can I return or trace the mutual values of both arrays, in this example being:
Code:
"jim"
"jane"
?
Thanks,
Jerryj.
Return Values From Event Handler
hi..i have a class (PrimaryAssets) i am creating, but i am uncertain on how to do a fundamental get method. For example, this class will hold information such as a parsed stylesheet, a gateway url, etc. The thinking is that other classes needing this info would simply access it by a new PrimaryAsset object. Seems to makes since, rather than re-writing a bunch of URLRequests/URLLoaders.
here is the part where the PrimaryAsset class loads and parses the StyleSheet. It happens after the initial gateway url is defined:
Code:
//<-------------------LOAD CSS------------------->
public function getCSS(cssPath:String=null):void
{
var urlr:URLRequest= new URLRequest()
var cssUrll:URLLoader= new URLLoader()
urlr.url=this.gateway+cssPath;
cssUrll.addEventListener(Event.COMPLETE,parsecss);
cssUrll.load(urlr);
}
private function parsecss(ev:Event):StyleSheet
{
var ld:URLLoader= ev.currentTarget as URLLoader;
this.css= new StyleSheet();
this.css.parseCSS(ld.data);
return css;
}
now, when i call a new PrimaryAsset object, all is fine. But i would like to call something like
Code:
var pa:PrimaryAssets= new PrimaryAssets();
pa.addEventListener(PrimaryAssetEvent.READY,parseCSS)
function parseCSS(pae:PrimaryAssetEvent):void
{
var CSS_stylesheet:StyleSheet=pa.getCSS();
}
how/where should i be returning the css from my PrimaryAssets class? The event handler is not the place
Problem With Return Values And LoadVars()
Hey
Anyone have an idea to fix this problem. Using LoadVars() to load a string and then format this into a Array. The problem is that i can not return it since trace b is executed before trace a.. Therefor there exist no values in "point" when returned by the function. Anyone have an idea to fix this?
function readobj (test):Array{
var point:Array = Array();
var loadValue = new LoadVars();
loadValue._parent = this;
loadValue.onData = function(inString){
point[0] = 344;
trace("a");
}
loadValue.load(this.loadfile);
trace("b");
return point;
}
Return Mutual Values Of Two Arrays
Hi,
suppose I have 2 arrays:
Code:
var array1:Array = new Array("jim", "jane", "richie");
var array2:Array = new Array("john", "jim", "bert", "jane");
How can I return or trace the mutual values of both arrays, in this example being:
Code:
"jim"
"jane"
?
Thanks,
Jerryj.
Anonymous Function – Return Values
Hello, I will appreciate any help with this problem; let me describe a little bit what I’m trying to do:
I have 2 SWF, one.swf and two.swf
1 LocalConnection to send 1 variable from one.swf to two.swf
one.swf code:
var param:Number = new Number(5);
var sending_lc:LocalConnection = new LocalConnection();
sending_lc.send("_Connection1", "myMethod", param);
two.swf code:
this.createTextField("text1_txt", 1, 20, 20, 100, 20);
texto1_txt.border = true;
var receiving_lc:LocalConnection = new LocalConnection();
receiving_lc.connect("_Connection1");
receiving_lc.myMethod = function (param:Number){
text1_txt.text = param; //just to test values
temp = param;
};
// I need to do this
Switch (“param value”) {
….
}
This code actually works pretty well sending the “ param ‘ from one.swf to two.swf
Problem:
I need to be able to use “param” value out of the function, because a I need to perform a switch with this value, since the function wich receives de “param” value is an anonymous function I don’t know how to do to get the value from outside the function because a don’t have a reference name to the function so, the normal way to return a value is not going to do the job.
I will appreciate any help, thanks
How To Get Information From Web Service And Return Values
I have a client and server (both in .NET 2, C#) scenario, where a swf file (written with Flash CS3/ActionScript3) is to be embedded in an ascx page in the client.
The client itself can communicate with the server using web services.
1) Is there anyway that my Flash file can call the methods in the client that retrieves information from a web service? For example in the client, there's a method called GetNames(), which retrieves names of employees from a web service provided by the server.
2) Is there anyway that my Flash file can return values to the client. For example in the Flash interface, a user selected the name "Alex", can the string "Alex" be passed back to the client, which would in turn do its own processing?
It would be great if I could get some actual code samples to point me in the right direction.
Return Values From Uploading Data With FileReference?
Hi,
when you send Data with an UrlLoader, you also can receive Data back.
Is this not possible with FileReference?
For example when you upload a File with FileRefernce to an PHP Script.
Can you now receive also Data back from this upload?
Thanks in advance
Call Javascript And Return Values To Flash
Hi all expert,
I am learning Actionscript recently. Do anyone know how to call a javascript's function and get back the result from it.
javascript code:
function getvalue()
{
return myvar;
}
....and I call it from my flash like this:
getURL("javascript:getvalue()","anotherframe");
Thank very much!
October
Use Of The "name='return'" (from HTML Form Values) In Flash
I'm converting a form button from HTML into flash and have no problem with any of the name/value pairs except "return" (i.e. name="return" value="http://www.thisURL.com/this.php"). I know Flash uses the RETURN expression, so I know that's what's causing the problem. Has anyone been able to use the form name="return" in Flash w/o getting an AS error?
thanks guys...
AS2: What Datatype Should A Function Return, If It May Not Return *anything*?
The title of this post may not make much sense, let me explain...
I have a function:
findSurface(origin:Point, vector:Point, attempts:Number):Point {...}
The function has an obscure use, but the idea is thus: given those three arguments, returns a point IF the 'line' (created by the origin and vector arguments) intersects the object the function is called on. [but that is another story...]
More importantly, if there is no point of intersection at all, what should the function return? Void? Null? Undefined? Object? Or can I use one of those return types instead of Point incase the function does not encounter an intersection?
I'd be glad to try explaining better if anyone might know, thanks.
Generating Random Values For A Variable While Excluding The Already Generated Values
Hey Flashers:
Here's my question this time around. I want to generate random values between 1and 50 for a variable but I want every time I generate the new value to exclude the already generated values from the pool of options. Something like playing the lottery where no two drawn numbers can be the same. Any hints or references to open code will be greatly appreciated.
As always, thanks a lot!
Function Populated By Node Values Returning Undefined Values
I have been working on some code which extracts the information from an xml document, styles it with css and then loads the various node values into a text field and arrays. The user click on a link in the text field which calls myFunction using asfunction and that in turn should enter the array values relating to that link into text fields.
Everything in general seems to work OK except the value that is returned to the two text fields on pressing the link in the CCTextField "which in turn calls myFunction" returns undefined for those values of the arrays. I check the agency[2] value in the function that populates the arrays and the value is returned as it shoiuld be so it appears there must be something amiss with myFunction, or at least it would seem so.
Any takers as to what this problem might be?
I have supplied some shortened code below.
PHP Code:
CCTextField.styleSheet = myStyle;
// NOTE: CCTextField styleSheet has been created beforehand
my_xml = new XML();
// NOTE: my_xml has been created beforehand
my_xml.onLoad = function(sucess) {
if (sucess) {
processXML(my_xml);
}
};
// Load up the XML file into Flash
my_xml.load('TEST.xml');
// This is the function that will be called when
// the XML document is loaded succesfully
function processXML(xmlDoc_xml) {
var listText_comm = ""; // List text variable
var entryNum = 0; // Entry number variable
var agency = new Array(); // Agency array
var production = new Array(); // Production array
for (var n = 0; n<xmlDoc_xml.firstChild.firstChild.childNodes.length; n++) {
categoryNodeName = xmlDoc_xml.firstChild.firstChild.childNodes[n].nodeName;
if (categoryNodeName == "client") {
listText_comm += "<a href='asfunction:_root.myFunction," + entryNum + "'>" + xmlDoc_xml.firstChild.firstChild.childNodes[n];
trace("client " + xmlDoc_xml.firstChild.firstChild.childNodes[n]);
} else {
if (categoryNodeName == "title") {
listText_comm += " - " + xmlDoc_xml.firstChild.firstChild.childNodes[n] + "</a>";
trace("title " +xmlDoc_xml.firstChild.firstChild.childNodes[n]);
} else {
if (categoryNodeName == "agency") {
agency[entryNum] = xmlDoc_xml.firstChild.firstChild.childNodes[n].firstChild.nodeValue;
trace("agency " +xmlDoc_xml.firstChild.firstChild.childNodes[n].firstChild.nodeValue);
} else {
if (categoryNodeName == "production") {
agency[entryNum] = xmlDoc_xml.firstChild.firstChild.childNodes[n].firstChild.nodeValue;
trace("production " +xmlDoc_xml.firstChild.firstChild.childNodes[n].firstChild.nodeValue);
entryNum++; // click over the entry number by 1
}
}
}
}
}
trace("AGENCY 2 = " + agency[2]); // this returns agency number 2 OK
_root.CCTextField.text = listText_comm; // CCTextField shows this text OK
}
function myFunction(listItem) {
clientF = agency[listItem]; // THIS RETURNS undefined ON PRESSING THE LINKS IN CCTextField
productionF = production[listItem]; // THIS ALSO RETURNS undefined ON PRESSING THE LINKS IN CCTextField
trace(listItem); // this trace = the list item passed by asfunction OK
}
[MX] Weirdness With Values Used By Array Populated Clip Values.
Hi,
I have used invisible buttons on top of some text, as part of a volume control interface.
The text buttons are set out as 0 – 25 – 50- 75 -100 referring to the % that a music tracks volume will change to once a button is pressed – so far so good.
Now to give values to the text buttons in order for them to make the text clip that they are on top of go to & stop & the right frame I have used arrays to give a reference the location of the text clip:
numbs_array = [_root.volHold_mc.vol0, _root.volHold_mc.vol25, _root.volHold_mc.vol50, _root.volHold_mc.vol75, _root.volHold_mc.vol100];
I then reference that in a home made “release” function as “this.monica.gotoAndStop(2);” “monica” being the reference to the address of the clip.
It all works fine except the code seems to make the movie play clips in an order that they have not been designated in the array – Like a button on top of the “25”% value will play the animation for the “75”% clip?
The whole problem is probably much better seen through the movie – the problem section of which i have attached below.
Passing Values From ASP To Change Alpha Values Etc
Is this possible? I currently have a log in system, logging each page a user visits, these visits amount to a value and have this value passed to flash to control alpha values, tints etc to reflect look and feel. is this possible?
Database Values To Array Values
Hi all,
I've created a movie which uses a number of arrays to construct the elements of a flash-based gallery.
What I need is a practical method of getting values from a database into an array via an ASP page.
The plan was to load the variables into these arrays using the an asp page and a loadvars object to create a string (basically the array values in quotes separated by commas) which was then to be inserted into the parameters for the creation of the array. Needless to say this hasn't worked- the create array object seems to interpret the whole string as the first value in the array, i can't find a way of populating the array from just a single asp page.
I've given up with this method and really need a few pointers.
Thanks
Writing Values To A Text File And Reading Values From The Same File
Hi, I want to create a page counter in Flash and I was wondering how to write a value (the next number for the visitor) to the text file and read the current value from that file. In a simplified form I would just read the number currently in the file, add 1, and rewrite the number to the file. Eventually when I get that worked out I will adapt it to only add 1 for each different user session instead of each page hit, but I'll start with the easy stuff first.
Thanks
Return
Hi,
I don't know if it's possible but I'm going to ask anyway.
When the mouse is inactive for 20 sec. the movie goes automaticly to another scene where a 'screensaver' is showed. Now when you move the mouse, the movie should return to where he was. Is that possible?
Can anybody tell me please?
Thanks in advance
Greetings
Camme
Got The Return - But How About This?
Hi all, a little while back I posted a thread about a drag and drop action with a slow return on the draggable mc if it wasn't dropped on the target.
Well I have got a .fla file that does this but I have a couple of further questions.
Below is the scripting that goes on the first frame. How can I amend the scripting to add up to say nine or ten draggables?
And also how can I make to action (ie goto and play, load movie, tell target etc...) trigger when the draggable MC is placed on the target?
If you click HERE you will see the swf in it's current state.
And here is the code for the first frame:
// turn off that ugly pointer finger
MovieClip.prototype.useHandCursor = false;
// initialize our three clips, "ball1", "ball2", and "ball3"
for (i=1; i<4; i++) {
tmp = _root.attachMovie("myClip", "ball"+i, i, {ID:i});
tmp._x = (i-1)*148+(38+tmp._width/2);
tmp._y = 30+tmp._height/2;
// set the x & y origins as where the clip was first placed (before any dragging)
tmp.xOrig = tmp._x;
tmp.yOrig = tmp._y;
// init attached mc on the correct frame
tmp.gotoAndStop(i);
tmp.onPress = function() {
this.startDrag(true);
};
tmp.onRelease = tmp.onReleaseOutside=function () { this.stopDrag();if (this.hitTest(dropRing)) {this._x = dropRing._x;this._y = dropRing._y;for (i=1; i<4; i++) {if (i != this.ID) {_root["ball"+i].resetClip(_root["ball"+i].xOrig, _root["ball"+i].yOrig);}}} else {this.resetClip(this.xOrig, this.yOrig);}};
}
// this prototype eases the mc calling it back to returnX and returnY
MovieClip.prototype.resetClip = function(returnX, returnY) {
this.onEnterFrame = function() {
this._x -= (this._x-returnX)/2;
this._y -= (this._y-returnY)/2;
// This if deletes the onEnterFrame when the clip gets back to its origin (or very
// close to the origin) The Math.abs serves to allow the the checking to be coordinate
// independent.
if (Math.abs(this._x-this.xOrig)<.5 && Math.abs(this._y-this.yOrig)<.5) {
delete this.onEnterFrame;
}
};
};
Anyone able to put me right?
Diggz
Got The Return - But What About This?
Hi all, a little while back I posted a thread about a drag and drop action with a slow return on the draggable mc if it wasn't dropped on the target.
Well I have got a .fla file that does this but I have a couple of further questions.
Below is the scripting that goes on the first frame. How can I amend the scripting to add up to say nine or ten draggables?
And also how can I make to action (ie goto and play, load movie, tell target etc...) trigger when the draggable MC is placed on the target?
If you click HERE you will see the swf in it's current state.
And here is the code for the first frame:
// turn off that ugly pointer finger
MovieClip.prototype.useHandCursor = false;
// initialize our three clips, "ball1", "ball2", and "ball3"
for (i=1; i<4; i++) {
tmp = _root.attachMovie("myClip", "ball"+i, i, {ID:i});
tmp._x = (i-1)*148+(38+tmp._width/2);
tmp._y = 30+tmp._height/2;
// set the x & y origins as where the clip was first placed (before any dragging)
tmp.xOrig = tmp._x;
tmp.yOrig = tmp._y;
// init attached mc on the correct frame
tmp.gotoAndStop(i);
tmp.onPress = function() {
this.startDrag(true);
};
tmp.onRelease = tmp.onReleaseOutside=function () { this.stopDrag();if (this.hitTest(dropRing)) {this._x = dropRing._x;this._y = dropRing._y;for (i=1; i<4; i++) {if (i != this.ID) {_root["ball"+i].resetClip(_root["ball"+i].xOrig, _root["ball"+i].yOrig);}}} else {this.resetClip(this.xOrig, this.yOrig);}};
}
// this prototype eases the mc calling it back to returnX and returnY
MovieClip.prototype.resetClip = function(returnX, returnY) {
this.onEnterFrame = function() {
this._x -= (this._x-returnX)/2;
this._y -= (this._y-returnY)/2;
// This if deletes the onEnterFrame when the clip gets back to its origin (or very
// close to the origin) The Math.abs serves to allow the the checking to be coordinate
// independent.
if (Math.abs(this._x-this.xOrig)<.5 && Math.abs(this._y-this.yOrig)<.5) {
delete this.onEnterFrame;
}
};
};
Anyone able to put me right?
Diggz
What Is Return(); ?
I've never had to use "return" before in AS, but I'm sure I am going to need to later on. Could one-na-ya guys post a simple function in which 'return' is used? I have the description of it in ASDG2, but no example.
Thanks.
Steveo
Return
On my main movie (which is a projector) I made a button that loads an external .swf, here is the script attached to the button, it works properly:
************************************************** ***
on (release) {
if(this == Number(this)){
loadMovieNum("mc_01.swf",this);
} else {
this.loadMovie("mc_01.swf");
}
}
************************************************** ***
On the, now loaded, external movieclip (mc_01.swf) I have a button that, when pressed, will return to the original projector. I cant seem to make this happen!
I tried this code attached to the button (on the external .swf):
************************************************** ***
on (release) {
gotoAndPlay("_parent",1);
{
//is the original considered the parent?
************************************************** ***
that didnt work...
Way To Return A Value?
I have five different masses on screen and I need a way to be able to first assign a number for their mass values. Then I need to be able to return that value when I ask for it so that I can assign it to a variable.
I'm still fairly new with this stuff, and am learning as I go along. If anyone could hlpe me with this it would be much appreciated.
TIA
Return
function makeMove(row, col){
var buttons = [[B00, B01, B02], [B10, B11, B12], [B20, B21, B22]];
trace("in makeMove");
if (board[row][col] != "E") return;
board[row][col] = turn;
}
Do anyone know what the purpose of return in these statement? Whether return true or false, what the effect of the following statement?
Why Would This Return NaN?
This worked in another swf but when I pasted it into this new one it returns Nan. Could it be a scope thing? The image loads fine.
Thanks.
Code:
fullListener.onLoadProgress = function() {
loadStatus_txt.text = "Loading image...
" + Math.floor((bytesLoaded / bytesTotal) * 100) + "% of image loaded";
};
'return' Won't Return
Does anyone know why a return statement would not return a value?
First take a look at the following two functions:
PHP Code:
function goFirstClip() {
trace("
DATABOOK GETTING FIRST CLIP: "+this.nodeID);
var fc:String= this.getFirstClip(this);
trace("...found clip final: "+fc);
}
function getFirstClip(object):String {
trace("...looking at: "+object.nodeLabel+" - of type: "+object.nodeID);
if (object.nodeID.toLowerCase() == "clip") {
var nl:String=object.nodeLabel;
trace("...found clip: "+nl);
return nl;
} else {
getFirstClip(object.children.goFirst());
}
}
As you can see, the first function calls the second. The second function is recursive.
Basically, I have an object tree called DataBook. Each branch has a Collection of child objects called, 'children'. My Collection class is a wrapper for the Array class and it has a method, 'goFirst()', which returns the first element of the Collection.
Ultimately I will be returning the actual child object, but for this example I'll deal with one property of the object, 'nodeLabel', a String.
Everything works fine until it comes time to return the found value to the original function.
You can see that I have two trace functions in place, '...found clip' and '...found clip final'. When the recursive function finds the object in question, it traces '...found clip: ClipName'. It should then return the found value to the original calling function. However, by the time it gets there, it's undefined. The original function traces '...found clip final: undefined'.
So, to restate the inquiry, does anyone know why a return statement would not return a value? (...or return the value as undefined?)
Return Of Nan
Hi, posted thread a few weeks ago regarding a NaN issue. Followed the advice with no resolution to the problem. Since then I have found the cause, but not the solution ... is there someone who is not a math dummy like me who can show me the best solution please?
Three input text boxes:
costlitre
tanksize
fillcost
Code:
if (fillcost== "") {
fillcost= 0;
if (tanksize== "") {
tanksize= 0;
costlitre = (Number (fillcost))/(Number(tanksize));
This always results in a NaN result in the "costlitre" text at the beginning of the MC. Once values are put into the "tanksize" input, the NaN dissapears.
If I use:
costlitre = (Number (fillcost))*(Number(tanksize)) it returns "0"
costlitre = (Number (fillcost))+(Number(tanksize)) it returns "0"
costlitre = (Number (fillcost))-(Number(tanksize)) it returns "0"
all of which are good.
If I use:
costlitre = (Number (fillcost))/0 it returns "0"
It only occurs when an input text is divided by another input text.
Any ideas?
Thanks,
Glen.
Return Url?
Just curious if it is possible to return the HTML doc name that the flash resides in?
so if the swf is located in "0001.htm" actionscript can retrieve that string.
Return To There
I have a draggable click that I want to return to a specific x and y when the user releases the clip. The trick is, I want it to happen over time (say 5 frames) so the clip doesn't simply blink to the original x and y, but moves to it.
I'm completely baffled!
Why Use Return?
I'm trying to understand the purpose of using return in functions. I'm reading Robert Penner's "Programming Macromedia Flash MX" and there is a good example of how to apply functions using the prototype feature:
// Code start
MovieClip.prototype.spin = function (angle) {
this._rotation += angle;
return this._rotation;
}
result = _level5.box.spin(10);
// Code stop
I created a second movieclip called box2, and rather than call it through a variable, I simply called the function this way:
box2.spin(10);
They both produce the same result. I'm just wondering what the purpose is for using return in this particular case. I unfortunately can't seem to find more information on this simple idea. I am reading ahead but I am afraid if I don't understand this concept now, I'm going to miss something very important in the future!
Any tips would be greatly appreciated.
Why Use Return?
I'm trying to understand the purpose of using return in functions. I'm reading Robert Penner's "Programming Macromedia Flash MX" and there is a good example of how to apply functions using the prototype feature:
// Code start
MovieClip.prototype.spin = function (angle) {
this._rotation += angle;
return this._rotation;
}
result = _level5.box.spin(10);
// Code stop
I created a second movieclip called box2, and rather than call it through a variable, I simply called the function this way:
box2.spin(10);
They both produce the same result. I'm just wondering what the purpose is for using return in this particular case. I unfortunately can't seem to find more information on this simple idea. I am reading ahead but I am afraid if I don't understand this concept now, I'm going to miss something very important in the future!
Any tips would be greatly appreciated.
Return To Top
I have made a scrollable static text area that works fine, however once leaving that movie clip to read another section I would like that text field to return to the top. This is where I am having trouble. Basically so when the viewer returns to that section it's at the beginning again. What action do I need to write on a button to return the text ( movie clip) to the top.
I have a movie clip on main stage called 'AboutClip', inside this are 3 layers, one containing a movieclip called ScrollBar, which is a button with
'on (press)' {
startDrag (_root.AboutClip.Content, false, 300, 200, 300, 400)
and a stop drag action on release.
The content clip is just a text area inside a movie clip ( Content) with a mask.
The third layer contains the actions: Two frames: Ist frame:
Scrollpos = getProperty ( _root.AboutClip.ScrollBar, _y);
p = number((Scrollpos*-1));
setProperty ( _root.AboutClip.Content, _y, p);
Second frame
gotoAndPlay (1);
Any help here would be great. Thanks in advance
Return
I've got function:
ActionScript Code:
checkPos = function(trg,end){
this.createEmptyMovieClip("czek",1);
czek.onEnterFrame = function(){
pos = trg.getPosition();
if (pos >= end) {
return true
delete this.onEnterFrame
} else return false
}
}
(function getPostition() work gr8)
I want to force function checkPos() to return true if position of trg will be equal to "end", but there is problem with onEnterFrame function :
when I remove onEnterFrame, return in checkPos() function work fine, how can I transfer "return" from czek clip to checkPos() func ?
sorry 4 my eng I hope U understant me
XML Return
I have seen in most tutorials functions return nothing ie function():void. It seams like a lot of people are struggling with xml getting undefined errors cause they can't call it out of the load xml function. Could you return the XML in the function and be able to work with it from there?
Return To Sender Help
I have two search fields triggered by either a mouse release or the return button, but hitting return only triggers one search field! Is it possible to get around this?
Return Function
Can somebody tell me how can I use return function for my film:
I have a large movie with 20 scenes and in every scene I have a webservice from where can user going to sitemap. But if user choos nothing, can he click return button, and appear again in the same scene and in the same position(I mean keyframe) from where he went.
If someone know return function, please tell me....
Return Variable
I am trying to use a return in a variable in Flash 4.
The problem is I have several variables input by user then Flash combines them using NewVariable= var1 &" "& var2 roughly. So I can create a space between each variable even several spaces however if I place a return in the " " Flash removes it.
Any Ideas
Macdivitt
Adding A Return
how do you add a return in a textfield?
this is my code:
var = "hello there"
textfield.text = *hard return* + var
so i want the hello world to appear on the second line. what do i put for the *hard return* ?
Hit Return To Submit
can someone please tell me how to assign the return button to act as though i've clicked on a submit button?
|