ActionScript 3.0 :: Function Returning Array And Declaring A Function With Event And Variable?

Jul 27, 2009

is it possible to declare function this way

ActionScript Code:
function startShake(e:MouseEvent, num1, num2):void

what i mean is it possible to send to the function not only en event but also a variable and a second question how can i access

ActionScript Code:
function stopShake(e:MouseEvent):Array

this array that function return.

View 1 Replies


Similar Posts:


AS3 :: Flash - Returning A Variable From An Event Listener Function?

Sep 28, 2011

I'm trying to return XML from an event complete back to the main function, but can't figure out how to do it.Here's the functions I'm calling:Main File:

public var mySendAndLoad:SendAndLoad = new SendAndLoad();
mySendAndLoad.sendData(url,variables)
The mySendAndLoad class:

[code]........

View 3 Replies

ActionScript 3.0 :: Declaring A Variable In A Function: Either The Function Or The EventListener - Doesn't Work

Nov 27, 2009

I have a set of Cue Points in an FLV I'm playing. It's an interactive quiz, so the idea is that flash will change a variable, theAnswer, to a different letter depending on which question it is. The answer to question 1 is B, question 2 is D, etc. Either the cue point event listener isn't working, or else it is working and Flash isn't declaring the variables. 1120: Access of undefined property theAnswer. I literally can't find a single problem with my code. I have an almost identical Event Listener further down which works.

[Code]...

View 4 Replies

ActionScript 3.0 :: Declaring A Variable Inside A Function To Use Outside The Function?

May 5, 2011

I want to create a vector, then call a function that populates that vector with arrays. Fine. The only catch is the function itself will declare new array variables to put into the vector, but are these new array variables private to the function only?e.g. something like this

ActionScript Code:
public var vec:Vector.<Array> = new Vector.<Array>();
private function populateVec():void {

[code]....

Is this "kosher"? a was declared in the private function but added to something outside the function..?

View 4 Replies

ActionScript 3.0 :: Returnig An Array And Declaring A Function?

Jul 25, 2009

why can't i get a return value from this function because i need those values to reset a image to it's previous position.

PHP Code:

Cam.addEventListener(MouseEvent.ROLL_OVER,animIn);
trace(animIn); // here is where i got a problrm
function animIn(evtObj:MouseEvent):Array {[code].......

why i can't do it like that what i mean is why i can't declare this function that way because when i do the fallowing error occur:Ereor #1063

View 5 Replies

ActionScript 2.0 :: Flash8 Declaring A Unique Variable In A Function

Mar 18, 2009

I'm trying to create a unique variable and reference to it with myRewind for some button functions.

I'm trying to create this rewind+variable as the unique identifier but it just seems to be using myRewind as the variable and overwriting it.

Code:

//Setup subsection rollovers
function createRollover(myContainer, rollName) {
btnName = rollName+"_btn";
mcName = rollName+"_mc";

[Code]....

View 2 Replies

ActionScript 3.0 :: Function Returning A Variable?

Aug 9, 2009

I have a variable which needs to be updated upon user input. It works inside the function, the trace function returns the correct type, but for a reason it wont pass it on the variable on the main timeline.[code]

View 5 Replies

ActionScript 3.0 :: Send A Value From One Of My Xml Nodes (<marker>) By Declaring It In A Function 'showData' As A Variable 'XMLMarker'?

Jul 30, 2009

I am trying to send a value from one of my xml nodes (<marker>) by declaring it in a function 'showData' as a variable 'XMLMarker'. If I trace this value (XMLmarker) it returns the right data found in the node <marker> (which is 'myMarker_mc'). However, I need to tell the stage that myMarker_mc is a MovieClip...please see the 'PROBLEM' stated in the code below.

[Code]....

View 0 Replies

ActionScript 3.0 :: Returning A Function Parameter As Variable?

Sep 21, 2011

ok so i've been stuck on this for a while...What i'm trying to do is create a function that updates a global variable (randomVar) that is itself a parameter in the function e.g

[Code]....

Basically, i thought randomVar and vari were the same so when vari was changed randomVar would too but that's not the case. So how do i make the parameter equal the new value(5). I want to repeat the function using different variables so putting randomVar = vari in the function is not possible.

View 5 Replies

ActionScript 3.0 :: Returning Variables From mouse Event Function?

Sep 19, 2008

I am working with code where the variable "k" is a counter. I stripped out the extraneous stuff from the code below - so essentially when the function onExamPlusClick is called, the counter "k" and the minutes of an activity in an array both increment (as well as other things not shown). I'd like to return "k" as well as "activity[0].minutes" to the main program. Since the function is a MouseEvent, I'm unable to change "void" to "number"... and not sure how to return (pass) those variables back to the ain program.

View 3 Replies

ActionScript 3.0 :: Returning A Variable To Another Class From A Loading Function?

Aug 5, 2009

However, on a bright note its coming!!!! So far, everything is going well and I am now seeing the light with AS3I do have a question on returning a variable from a function that loads an external CSS. This particular function is located inside a LoadStyleSheet.as class along with another public function that sets text properties to fields when accessed. What I am looking for is accessing the stylesheet after its been loaded in another class. I know in AS2 I could use the Delegate method for something similar to this situation. Not sure what the next step is for AS3. Anyhow, function script is below.

ActionScript Code:
public function loadStyleSheetItem(loadStyleSheet_str:String):void {
var styleSheet_css = new StyleSheet;

[code]......

View 8 Replies

ActionScript 3.0 :: Returning Data From A Function Called Via Event.COMPLETE?

Aug 3, 2010

i am trying to return an XML object, but having issues. The object is only created via an Event.complete function. I need to return the XML created from my loadXML function via my grabXMLfromFile function.

Code:
function grabXMLFromFile(attrPathToXML:String):XML {
var fileUrl:String = attrPathToXML;
var myUrlRequest:URLRequest = new URLRequest(fileUrl);

[Code].....

View 3 Replies

ActionScript 3.0 :: Error 1021: Duplicate Function Definition Function OnComplete1(event:Event):void {

Jan 14, 2010

im having this errors:

1021: Duplicate function definition function onComplete1(event:Event):void {
1021: Duplicate function definition function stopSound1(event:MouseEvent):void {
1021: Duplicate function definition function backSound1(event:MouseEvent):void {

codes i used:

Code:
var thereReq:URLRequest = new URLRequest("SOUNDS/how.mp3");
var there:Sound = new Sound();
var thereControl:SoundChannel = new SoundChannel();

[code]....

View 2 Replies

Php :: Calling A Page With MySQL Query From Javascript Function Then Returning Results To Another Javascript Function

Jul 8, 2010

I am refactoring some code. I have a PHP page that contains a MySQL query and stores the result in a PHP variable $my_result. This result is then echoed to a Flash SWF during embedding with SWFObject. I now want to call this PHP page that makes the query from a javascript function like so - one change I have made to the PHP is that instead of storing the result in a variable $my_result I am echoing the result. Javascript function to call the PHP page and make the database query

[Code]....

View 2 Replies

ActionScript 2.0 :: Calling A Function With An Array Variable As Arguments Is Resetting Array?

Oct 12, 2006

I'm going to post the full code of the two functions, disregard the "fluff" unrelated to the two functions as it is all working flawless, I've tested this HEAVILY and cannot understand why it keeps setting the entire array to undefined!

Code:
// processReplace Function
function processReplace(transferFiles) {
var processArray:Array = transferFiles.slice();

[Code]....

Basically it's supposed to check to see if the file exists and return as true if it does and add it to a replace array, then the replace array is processed into a single string and put into a dialog box through the flash wrapper prompting them to "replace the files or not".

It makes the replace array just fine, it actually even has the right "count" in it but it's setting all the "filenames" to undefined because of the exists = processSearch function.

I even tried to make a new array and run the search just from that one and set the values from the old one and it's still failing.

Is it because of the "break" or can anyone figure it out? Iknow it's hard because you can't use the code

View 1 Replies

ActionScript 3.0 :: Getting Variable Value From Inside Of Event Function

Feb 29, 2012

How to get variable value from inside event function. Variable was declared outside event function.
var StringVar="sample";
myButton.addEventListener(MouseEvent.CLICK, myClickReaction);
function myClickReaction (e:MouseEvent):void{
StringVar="other sample";
} trace(StringVar); /*

It gives me "sample" value and I would get "other sample" value */. That strange because if that would be normal function trace would give me good result.
var StringVar="sample";
function myClickReaction():void{
StringVar="other sample";
} myClickReaction();
trace(StringVar); /* it gives me result as I wanted to have - "other sample" value */

I know also method of passing arguments into event fuction but it not works for me as I would like to
var StringVar="sample";
myButton.addEventListener(MouseEvent.CLICK, function(e:MouseEvent){ myClickReaction(e, StringVar) },false, 0, true);
function myClickReaction (e:MouseEvent, StrVar:String):void{
StrVar="other sample";
} trace(StringVar); /* it also gives me "sample" value and I would get "other sample" value */
How to do that correctly?

View 11 Replies

ActionScript 3.0 :: Pass A Variable To A Function From An Event Listener?

Aug 29, 2008

How do i pass a variable to a function from an event listener which is inside a function Below is a function that is called when after loading some variables

function dataOK(mydataevent:Event):void{
var j:int = 0;
do {
trace(j);

[Code]....

This is a simplified version of the original code. The above function generates an error because j is undefined in the function. I am wanting to get the variable j when the button is pressed.

How do I pass the variable j to the Button_Click function?

View 1 Replies

Actionscript 3 :: Pass A Variable Into An Event.COMPLETE Function?

Feb 6, 2011

I am running a loop to pull thumbs into a containing movieclip from an xml list. What I want to do is have the thumb's parent movieclip fade in after they are done loading, but I can't figure out how to reference the parent once it's loaded.My code(which currently doesn't work the way I want it):

var vsThumb:articleBox;
var currentarticleX:Number = 0;
var articleLinkURL:String;

[code].....

View 2 Replies

ActionScript 3.0 :: Declaring Variables Inside Function And Use Outside?

Feb 25, 2010

I know that as long as a I declare variables inside a function I can only call them as long as the scope of the function is active. Outside of that function the variables don't exist. Is there any way I can create those variables inside a function and use them outside of it?

View 1 Replies

ActionScript 3.0 :: Declaring And Using Static Method/function

Sep 2, 2009

I wanted to use a couple of stand-alone function/or static methods by declaring them in the external *.as file and import it.

The problem is, when I import it, I had to instantiate a new class from imported class to use any of these functions which is not necessary in my situation, I just wanted to be able call these functions.

It (AS) does not allow me to declare those functions outside of class declaration, (tried with static keyword in front of those functions just like in C++).

I also tried to declare the class itself with static keyword (also just like C++) but AS also does not allow me to do that.

Remember whole points is declare couple of helper functions in external *.as file and use it over and over.

View 5 Replies

Actionscript 3 :: Flash Cs5: Set A Variable Using A Function, Then Read That Variable From A Different Function

Jan 29, 2012

I have a public variable and I am trying to set it, then read it from a different function:

public var str:String;
public function DailyVerse()
{
function create() {

[Code]....

My trace results says null. Why does it not give me "hello"?

View 1 Replies

Actionscript 3 :: Creating Event Listeners That Call The Same Function And Pass A Variable

Feb 20, 2012

I COMPLETELY MESSED UP MY CODE AND DID NOT CHANGE THE MOVIECLIP NAMES WHEN COPING IT INTO STACKOVERFLOW. SO IT MADE NO SENSE.

I am wondering if there is a better way to accomplish the following as3:

//THREE EVENT LISTENERS
shoe_icon.addEventListener(MouseEvent.MOUSE_DOWN, shoeApp);
top_icon.addEventListener(MouseEvent.MOUSE_DOWN, topApp);

[Code].....

View 4 Replies

ActionScript 3.0 :: Function Receive Variable And Search String In Array

Jul 22, 2009

I have an array index problem. I have an Array that holds some strings. I am trying to write a function that receives a string variable (user input)and searches for that string in the array. for that i tried to use "ArrayName.indexOf(input_variable)" but this always returns -1 even if the string which the variable holds is in the Array.

This is the script:
public static function ValidName(inputName:String = ""):Boolean {
trace(validNames.indexOf(inputName));
if (validNames.indexOf(inputName) > -1) {
return true;
} else {
return false;
}}

View 4 Replies

ActionScript 2.0 :: Write A Function To Move An Object And Then Call That Function On A Clip Event?

Jan 29, 2003

is it possible to write a function to move an object and then call that function on a clip event for instance

function (bounce){
script;
script;
}

and then call it by saying

on(mouseOver){
this.bounce;
}

View 2 Replies

Actionscript :: Switching Back Into Previous Function From Event Handler Function?

May 13, 2010

I need to return to my original function after capturing an event (downloading something) with another function. The original function needs to return a value, which depends on the downloaded data. So, I'd like to pause original function for the time needed for the download and the eventhandler function to complete it's work, and resume it afterwards.

The obvious way is to set a flag value (both the original function and the eventhandler are within the same class) and make the original function check it until the eventhandler function changes the flag. But that would be wasteful, and my AS is slow enough already:) [other parts of the application utilise some heavy graphics]. Is there another way? Like an event that gets captured "in the middle" of the function? Or some other form of flow control?

View 2 Replies

ActionScript 3.0 :: Sorting An Array Of Objects And Returning Another Variable

Aug 29, 2011

I have an object array into which I've pushed a number of objects with different variables :- myArray.push({myRef: 1, myValue: "W"}); I can sort the array in numerical order using :-myArray.sortOn("myRef", Array.NUMERIC);but after sorting I would like to collapse the array using something along the lines of :-myArray.join("");to join the OTHER variable (myValue)...Is it possible to do this without pushing every instance of 'myValue' to another array and then joining that?

View 4 Replies

ActionScript 3.0 :: Returning A Value From A Function

Apr 6, 2010

I have an external function that needs to return a customerID value. However, it seems to be returning the initial value instead of the value that I believe is being set within the function.[code]

View 2 Replies

ActionScript 2.0 :: Returning A Value From A Function?

Nov 2, 2005

well I have a function in my index.swf that goes like this

Code:
function getLanguage(language):String {
var sLang:String = language;

[Code].....

View 5 Replies

ActionScript 2.0 :: Returning Value From Function?

Dec 14, 2007

I have the following function defined in a class:

Code:
vidNetStream.onMetaData = function(myMeta){
_root.totalDuration = myMeta.duration;
//trace(_root.totalDuration + "!");
}

totalDuration is a private variable defined in my class.... how can I get that function to effectively save totalDuration?

View 2 Replies

ActionScript 3.0 :: Call The Same Function Within A Function AND When Listening For An Event?

Feb 3, 2009

How could i call the same function within a function AND when listening for an event?
would something likt this:

[Code]...

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved