ActionScript 3.0 :: Passing Extra Argument In Event Listener?

Nov 19, 2009

I have one event handler for several object's events.  I would like to pass a value through to the function from the event listener:

function chkEmpty(event:Event){
if(event.currentTarget.text==){
thisIsBitIWantToBeAbleChange.text = You haven't entered anything in the box, please try again
hisIsBitIWantToBeAbleChange.setTextFormat(validate_frmt);
}

 
Could I give the event.currentTarget a value that I could test for? So if the value is 1, I effect output1_txt, if 2, output2_txt, etc etc. If so, are there customisable values that I could use that wouldn't do anything to the display object,?

View 8 Replies


Similar Posts:


ActionScript 3.0 :: Padding Extra Argument From Event Listener To Handler

Nov 19, 2009

I have one event handler for several object's events. I would like to pass a value through to the function from the event listener:

PHP Code:

function chkEmpty(event:Event){
if(event.currentTarget.text==""){
thisIsBitIWantToBeAbleChange.text = "You haven't entered anything in the box, please try again"

[Code].....

Could I give the event.currentTarget a value that I could test for? So if the value is 1, I effect output1_txt, if 2, output2_txt, etc etc. If so, are there customisable values that I could use that wouldn't do anything to the display object,?

View 6 Replies

ActionScript 3.0 :: Passing More Argument On Event Listener?

Apr 21, 2010

I am wondering what is the way of passing and argument to a listener.. doing something like this:

Code:
myThing.addEventListener(Event.COMPLETE, doThis(arg));
function doThis(e:Event, arg:int){
...
}

What is the proper way, i this doesnt really brake the code, it doesnt work either...

View 11 Replies

ActionScript 3.0 :: Event Listener Function With More Than One Argument?

Dec 29, 2009

So I guess the usual stuff is to have

function listenToEvent(evt: Event){
//stuff
}

[code]......

View 1 Replies

ActionScript 3.0 :: Passing Value To A Mouseclick Event Listener?

Jan 26, 2009

Let's say I have 10 different buttons, a click on each button will open a different website. Currently, I have 10 different functions for 10 buttons. Is there a way to simplify the code and only have one function for all the buttons and only pass the URL to the onclick function?

button121.addEventListener(MouseEvent.CLICK, clickButton121("http://www.myurl.com"));
function clickButton121(event:MouseEvent, urlString:String):void{
myURL = new URLRequest(urlString);
navigateToURL(myURL);
}

I can say it will be very inefficient if i have 100 buttons and having to write 100 functions.

View 3 Replies

ActionScript 3.0 :: Passing Variable To Event Listener?

Aug 17, 2009

how do you pass a variable to a listener function? Im trying to add bmp when the mouse goes over this class but i keep getting the undefined error.

Code:
package FlashPackage{
import flash.display.*;
import flash.events.*;

[Code].....

View 2 Replies

ActionScript 3.0 :: Simple Parameter Passing On Event Listener?

Oct 11, 2009

I'm new to ActionScript and have a fairly basic question. I want an eventlistener to call a function and pass it a parameter that will send the movie to a specific frame. My code generates and invalid parameter type error. It's as follows:
 
TL_AboutUs_btn.addEventListener(MouseEvent.MOUSE_OVER, DropSubMenu(10)); // calls a function to drop a sub menu
function DropSubMenu(sm:number)
{ gotoAndPlay(sm);}
 
Error is "1046: Type was not found or was not a compile-time constant: number."

View 3 Replies

ActionScript 2.0 :: Passing A Clip Event To Listener And Button?

Jun 26, 2003

I would like to know if it is possible to pass a clip event on to both the function that has a listener, and to the button that is being pressed. I am finding the listener takes it and thus the button doesn't see it.I found a walk around, however, I'd like to know if it is possible say for one clip event to be seen by both objects?For example, with the mouse over a button the listener function detects the event and carries itself out, however, the button misses the event now.

View 2 Replies

ActionScript 3.0 :: Passing A String As The Name Of A Mouse Event Listener Function?

Jun 28, 2011

I am trying to essentially pass a string as a function name into an event listener, but I am not sure how to approach this. Is there a way to convert a string into a function?
 
Here is some code I have for me to show you what I am doing.

package{
//some import statements
public class changes extends MovieClip{

[Code]....

View 7 Replies

ActionScript 3.0 :: Event Listener Passing Variables - Give Access To EventType?

May 12, 2009

I'm using the following addlistener to listen for a custom event the event works if i put e.Event in the functions parameter but i don't get the passed variables however if i go into the .as folder where the dispatch originates and put EventType in the parmeters field of the function then i get all the variables.........but if i put EventType instead of e.Event in the first example then I get undefined for EventType.....how do give access to EventType?

[Code]...

View 7 Replies

ActionScript 3.0 :: Argument Passing To A .exe?

Feb 26, 2012

I have a .swf file through which i am passing arguments to .exe file which is basically a C++console application, how is it possible, should i tweak the sourcecode in th application file for it to accept the arguments passed?

View 1 Replies

ActionScript 3.0 :: Passing More Than One Argument With FlashVars?

Sep 28, 2009

I had been trying finding a way to passing more than one arguments using FlashVars. Below is the snippet of HTML code, using this parameter:

HTML Code:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,

[code]....

View 3 Replies

ActionScript 2.0 :: Passing A Function As An Argument?

Jan 12, 2004

I have a global function that does some stuff with a LoadVars in it.I 90% of the cases, the onLoad reference of the LoadVars is the same, but I sometimes need to do something else when the LoadVars is loaded.Is there a way to pass a function reference to a function so that I could do something like that :

[AS]
_global.function myFunction(maybeFunction)
{
myLoadVars = new LoadVars();

[code]...

View 1 Replies

ActionScript 3.0 :: Passing An Argument Using AddEventListener?

Jul 28, 2009

The transition from AS2.0 to 3.0 has been a long and broken trail for me.

Is there a way to pass arguments to a function via addEventListener, like (but unlike) this: timerTurn.addEventListener(TimerEvent.TIMER, moveUnit, "unitname", "unitdirection")

where moveUnit is the function I want triggered, and "unitname"/"unitdirection" are the arguments?

View 1 Replies

ActionScript 2.0 :: Passing A Function As An Argument

Jan 12, 2004

My question is slightly complicated : I have a global function that does some stuff with a LoadVars in it. I 90% of the cases, the onLoad reference of the LoadVars is the same, but I sometimes need to do something else when the LoadVars is loaded. Is there a way to pass a function reference to a function so that I could do something like that :

[Code]....

View 1 Replies

ActionScript 2.0 :: Input Text Passing Extra Info To PHP?

Nov 23, 2009

So I'm building a little contact form in flash and it works, but it is passing along all of the font styling information into the email sent to the client. Kind of annoying. I want it just to send the plain text.

Here's what I'm using:

This code is in the actionscript, picking up the input text fields and posting them to the PHP file. It also tells a status box to update with current info:

Code:
loadVariables("send_email.php?flashmo=" + random(1000), this, "POST");
message_status.text = "sending...";
var i = 0;

[Code]....

View 2 Replies

ActionScript 3.0 :: Passing An Instance Name Argument Into A Function?

Sep 29, 2010

Well I want to set up a function that will calculate the x position of where my MovieClip's instance name will go. Here is the code i currently have.

function xBtnPosition(btnName: String, btnXpercentage: Number):String
{
var xFinalPosition: String = -(((btnName.width * btnXpercentage) / btnName.scaleY));

[code].....

View 3 Replies

Actionscript 3 :: Passing E:MouseEvent As An Argument Via SetInterval?

Jun 26, 2010

So i have this function

capture_mc.buttonMode = true;
capture_mc.addEventListener(MouseEvent.CLICK,captureImage);
function captureImage(e:MouseEvent):void {

[code]....

View 2 Replies

ActionScript 3.0 :: Passing Vector Object As Argument?

Apr 11, 2011

So far, I have a class that creates a Vector object, and pushes data into it:

ActionScript Code:
public var mList:Vector.<cusClass> = new Vector.<cusClass>();

The data is read by a second class like so:

ActionScript Code:
trace(firstClass.mList);

The problem Im having is take that same Vector and passing it into a third class (from the second class) as an argument in a method: ActionScript Code: views.mUpListing(firstClass.mList);

[Code]...

View 2 Replies

ActionScript 2.0 :: Passing Argument/variable To External Swf?

Jan 25, 2008

I am using a carousel with items in it...when the user clicks an item in the carousel, I want a new swf to load to _level0 and replace the carousel on the stage...the new swf reads an xml...however the xml should be different for every item on the carousel...is there any way to pass the xml file name to the loadMovie command so the new swf can use it?

View 2 Replies

ActionScript 1/2 :: Passing Video Into Flv Playback Component With Extra Parameters?

Mar 9, 2010

I've been given a video url that I want to pull into an the flvplayback component. The url for the video I've been given is:The problem is when I set the contentPath with the above url the component won't load the video with the extra parameters ?var_log=102|441100001-1|- added as it says the path must end with .flvI am asumming that the video provider needs this extra var/parameter to be called in order to track the number of video requests, in which case I will need to keep this in.

View 2 Replies

Actionscript :: Flex - Passing Extra Parameter To Request When Using CallResponder

Nov 2, 2011

I am running flex with BlazeDS. My backend is in Java.

I have the following function in actionscript:

override public function execute():void
{
super.execute();
var responder:CallResponder = new CallResponder();

[Code].....

View 1 Replies

ActionScript 3.0 :: Passing Argument From A When Using One Class For Multiple Assets?

Aug 7, 2009

I had a class that I was passing a simple argument to like so:
 
var quiz_1_2:CaseStudyQuiz = new CaseStudyQuiz(2);
addChild(quiz_1_2);
 
I now would like to use this class for multiple MCs in my library. I thought I could let Flash create a class for each of them and specifying the CaseStudyQuiz class as the Base class. When I do that, I get the following error:
 
1136: Incorrect number of arguments.  Expected 0.

View 12 Replies

ActionScript 3.0 :: Passing Ampersand As Argument To Flash From Javascript?

Oct 16, 2009

We can pass arguments to flash from javascript like this

fc.callFunction("_root","js_playSong",["Path=songs/song1.mp3 &Album=Jazz"])

where fc is a JSFCommunicator.

But how to pass argument like this

fc.callFunction("_root","js_playSong",["Path=songs/song1.mp3&ArtistPath=http://sample.php?artist_id=24&name=kamal"])

In the above argument the red colored ampersand should not be considered as separator between two variables.

View 1 Replies

ActionScript 3.0 :: Set A MovieClip Return Value By Passing A String Argument

Oct 3, 2009

I'm trying to figure out how to set a MovieClip return value by passing a string argument and using that string to define the child of a given movieclip. I'm doing something wrong because I keep getting null traced instead of home_mc.[code]

View 2 Replies

ActionScript 3.0 :: Event Listener - Error #2007: Parameter Listener Must Be Non-null?

Feb 4, 2009

this is the error I am having:

TypeError: Error #2007: Parameter listener must be non-null.at flash.events::EventDispatcher/removeEventListener()
at project1_fla::MainTimeline/btnName()

here is my code:

ActionScript Code:
import caurina.transitions.Tweener;
import caurina.transitions.properties.ColorShortcuts;[code]..........

View 1 Replies

ActionScript 3.0 :: Passing Entire Doc Class As Function Argument - Good Or Bad?

Sep 8, 2009

I saw a post that touched on this, but I thought it deserved a thread of its own for explicit verification. It seemed that some of the resident geniuses here had given the thumbs-up to passing your whole doc or app class to a function. Please correct me if I'm wrong, as this sounds convenient but I assumed it would cause heart attacks and CPU meltdowns.

EXAMPLE: Say I have an app class that controls my entire game (or slideshow), and it has an ENTER_FRAME scrolling function that's 50 lines long with tons of conditionals so I want to take it out and make it an external file. I pop it into a new .as file but now all my variables are out of scope. I could pass them each individually, but there are so many it's impractical. So my question is: good or bad practice to pass the entire class?

[Code]...

View 4 Replies

ActionScript :: Javascript - Event Listener To Listen "all The Time" Not Just Wait For Any Particular Instance (mouse Click - Keyboard Event) Of Event?

Jul 7, 2011

I am trying to learn JavaScript and I am wondering whether JavaScript has a event listener just like ActionScript's ENTER_FRAME. Basically, I want this event listener to listen "all the time" not just wait for any particular instance (mouse click, keyboard event) of event.

View 3 Replies

ActionScript 3.0 :: Send Extra Param's To Event Handler?

Oct 28, 2009

I made this example to experiment. But what i can't seem to get working is to retreive the parameters in the onTimer function.This is the test class:

package {
import event.MyCustomEvent;
import flash.events.TimerEvent;

[code].....

View 10 Replies

CS3 Send An Argument With A Tween Event?

Mar 17, 2009

What I want to do is to remove an item from the array targetArray when the tween hitFade has finished. I added a MOTION_FINISH event to the hitFade tween which calls the spliceTarget function. I wanted to send an argument to the function indicating the targetArray index to splice, but apparently I'm not allowed to send any argument.

how do I send the targetArray index (i) along to the spliceTarget function?

I'm guessing that I could put i into a global variable and use that in the spliceTarget function, but that seems kind of roundabout.

Code:
var hitFade:Tween = new Tween(targetArray[i], "alpha", Strong.easeOut, targetArray[i].alpha, 0, 1, true);
hitFade.addEventListener(TweenEvent.MOTION_FINISH, spliceTarget);

[Code]....

View 8 Replies







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