ActionScript 3.0 :: Pass Event.currentTarget To Function

May 12, 2011

I'm making a tile game in flash and I need to pass event.currentTarget (the current tile) into a new function which sends the tile back to it's start position.[code]I need to call this function from other places in my code..I've tried passing the object itself to another function as a variable but it loses it's start position information !

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Event.currentTarget - Use One Function For All Buttons - Load Another MovieClip In Library

Dec 7, 2009

I have a movieClip in my library that I am loading into a scrollPane. When I click on the scrollPane I want to know the name of the target I am clicking on. I am trying event.currentTarget but all that I get in the output box is ObjectMovieClip. I want to use one function for all my buttons so when I click on them it loads another movieClip in my library. I realize I could make 3 separate functions, but I'ld like to use just one.

[Code]....

View 13 Replies

ActionScript 3.0 :: Difference Between Event.target & Event.currentTarget?

May 4, 2010

i'm new to AS3. Couldn't understand what some of the explanations out there are getting at, so i decided to post it here. In the code example below, what does event.target & event.currentTarget point to?

[Code]...

View 5 Replies

ActionScript 3.0 :: Event.target Or Event.currentTarget?

Jul 11, 2011

I have a Flex 4 List component which I have tied a click event to. In my event, my assignment of the source file paths works just fine --> my larger image displays just fine when a thumbnail click happens. My problem comes when trying to attach elements of the dataProvider to text inputs on another panel. Actionscript is throwing an error. Can someone point me in the right direction??

[Code]...

View 6 Replies

Actionscript 3 :: Pass A Function Name Into An Event Listener?

Jun 23, 2011

private function myFunction(numIn:Number){
trace ("numIn " + numIn);
}[code].....

This won't work, but can you see what I'm trying to do? It's kind of like a function pointer, or when you pass a function name into an event listener.

View 2 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 :: Using Event.currentTarget With XML?

Jan 16, 2009

I am loading a series of thumnails through an XML file into a scrolling movieClip. I am able to get all of the images to load and scroll and even control their alpha value using event.currentTarget. What I am having a problem with is getting the corresponding XML attribute(@title) to load into a dynamic text field.Here is a snippet of my XML file:

<thumbs>
<thumb img="http:url_1"
title="Title One" />[code]....

The thumbnail alpha changes and the text field changes to the text that is defined by the first title attribute. What I need to figure out is how to use a variable instead of the "#". I'm assuming that I should be able to make use of event.currentTarget like I did to change the alpha of the thumbail movieClip.

View 7 Replies

IDE :: Event.currentTarget.name To External URL?

Mar 14, 2009

AS3 coding, and despite being able to find posts about most of my problems, this problem has stumped me, and I'm not certain what words to search for.I'm trying to make a list of MCs on my stage to link to external URLs.I figured the following would work, but it just pulls the 'event.currentTarget.name+"URL"'the instance names of the MCs are "idlink" and "findStore"Is there a way I can get the loadLink variable to pull the URL instead of the "idlinkURL" string, or is my logic for this completely backwards?

Code:
var buyLinks:Array = [idlink, findStore];
// add listeners to the menu array

[code].....

View 1 Replies

ActionScript 3.0 :: Possible To Pass An Argument To The Function Triggered By An Event Handler?

Mar 31, 2009

Ok, I have 2 buttons on the stage. Each button does almost the same thing, so I want to create a single function, and each button calls that same function (we'll name that function "Navigate")... however, the function will need to end up doing something different dependant on which button was clicked.So, previously, in AS2, I would've added some code onto the buttons themselves with on(release) methods, like so:

Code:
// Define the Navigate function
function Navigate(myLabel){

[code].....

View 7 Replies

ActionScript 3.0 :: Pass An Argument To The Function Triggered By An Event Handler?

Mar 31, 2009

Trying to migrate my way of thinking from AS2 to CS4/AS3. Ok, I have 2 buttons on the stage. Each button does almost the same thing, so I want to create a single function, and each button calls that same function (we'll name that function "Navigate")... however, the function will need to end up doing something different dependant on which button was clicked. So, previously, in AS2, I would've added some code onto the buttons themselves with on(release) methods (see CODE EXAMPLE 1) So, each button effectively calls the Navigate function, and passes a different frame label to the function. Now, I'm trying to recreate this functionality in AS3. As you all know, on(release) has been done away with (still don't know why), but we now have to use event handlers, so I'm trying to figure out a way to pass a different frame label argument to the Navigate function. Currently I can achieve that by using a switch statement to test which button was clicked, and act accordingly (see CODE EXAMPLE 2).

[Code]...

View 2 Replies

Actionscript :: Pass Arguments Into Event Listener Function In Flex

Jun 20, 2011

Since when using sql lite if you try and do a function at the same moment it throws an error, im just trying to make a function that will check if its executing, and if it is try again in 10 milliseconds, this exact function works fine if i dont have to pass any arguments to the function but im confused how I can pass the vars back into the function it'll be executing.[code]

View 4 Replies

ActionScript 3.0 :: Pass Additional Arguments To An Event Listener Function?

Aug 19, 2009

I am trying to pass an additional arguments to my listener function, like this[code]...

View 8 Replies

ActionScript 3.0 :: Can Pass Touch Event To Class Defined 'global' Function

May 12, 2011

I have a class file defined in my package as MyGlobals.as.[code] (I have tried adding/removing "static" and "dynamic" to no effect.)I am trying to call a touch event from the main timeline in this way:myObject.addEventListener(TouchEvent.TOUCH_BEGIN, MyGlobals.myFunctionName);(I have tried removing the class name to no effect.)When I compile I get the error 1046: Type was not found or was not a compile-time constant: TouchEvent. This error occurs on function definitions in the class file.What syntax/concept am I getting wrong? The functions were working fine when I was using constants in the timeline, but I need to be able to reuse these functions over and over again, so I wanted them to be able to take touch event variables so that I didn't have to write a different function for every touch event.I tried googling "error 1046" but I can't find anything useful.

View 3 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

Flash :: Assign Variable Name To Event.currentTarget?

Dec 13, 2009

I want to use mutliple images in my flash script and instead of writing tons of code I want to get the 'currentTarget' and assign a variable name to it so I can tweenlite it . Instead of me naming all the instances i thought the following would work but it doesn't.

wedding.addEventListener(MouseEvent.ROLL_OVER, pan_over) ;
function pan_over(e:MouseEvent):void{
var ct:string = Event.currentTarget.name ;

[code].....

View 2 Replies

Call A Function With Event Parameter When Have No Event Parameter To Pass?

Aug 14, 2009

Forgive me for this stupid noob question but I want to call a function (loadList) that originally gets triggered after a mouseevent from another function (addToXML) that does not have an event.

The loadList function takes info from a XML var, sticks it into an array which then gets loaded into a tile list and that is working fine.

The addToXML function when called adds elements to the XML var after which I want to call the first function with the event parameter so it refreshes the items in the tile list.

I know it can do this by creating a new array and loading that into the tile list in the addToXML function, but it be much simpler to just recall the function.

I have tried things like

Code:
addToXML.addEventListener(Event.COMPLETE, loadList);

but all the event constants I have tried give me error messges like "1061: Call to a possibly undefined method addEventListener through a reference with static type Function."

View 3 Replies

Actionscript 3.0 :: Control Scaling In Array Using Event.currentTarget

Jul 30, 2011

I'm trying to tween six Movieclip (using TweenLite) in an Array to where they scale up when pressed. When another is pressed it scales up and the others will scale down. I'm having trouble getting them to do this consistently. This is probably a minor fix for most of you, but I have been tackling this for two days.[code]

View 1 Replies

ActionScript 3.0 :: Control Scaling In Array Using Event.currentTarget?

Jul 30, 2011

I'm trying to tween six Movieclip (using TweenLite) in an Array to where they scale up when pressed. When another is pressed it scales up and the others will scale down.I'm having trouble getting them to do this consistently. This is probably a minor fix for most of you, but I have been tackling this for two days.

Code:
import flash.events.MouseEvent;
import flash.display.MovieClip;

[code].....

View 1 Replies

ActionScript 3.0 :: Run A Function With CurrentTarget.name?

Oct 25, 2011

i'm wondering how i can run a function that has the same name as the current target. so when i click a button with the instance name "notes" this will run the "notes" function e.g

ActionScript Code:
evt.currentTarget.name();//run the function with the same name as the target

this doesn't work and returns a Error #1006: value is not a function.

View 2 Replies

ActionScript 3.0 :: Sending Looped Event.CurrentTarget To Start Position?

Nov 23, 2010

I've got a problem with an if/else statement within a function which checks to see which 'drop area' one of ten items should to snap to.. the problem is I can only set the start location of each item to work on the first hitTest, otherwise after clicking another item or positioning any item in one of the drop areas, the drop area becomes it's start location due to startDrag() and stopDrag() been called again to move the object..

What I've tried to do here is to create a variable (which does trace the correct (currentTargetHome) movieclip reference, but as a string) but it doesn't work when I try to access it's attributes using [currentTargetHome]. The item exists within the movieclip "gamePage" and the rest of the function works !

[Code].....

View 9 Replies

Flash :: Use E.currentTarget To Move An Object In A Function Nothing Happens?

Feb 20, 2010

package {
import flash.display.;
import flash.events.;

[code]....

View 1 Replies

Actionscript 3 :: Check If A Movieclip Exists On A Specific Location Relative To Event.currentTarget?

Sep 22, 2011

How can I check if the stage contains a movieclip on a specific x and y location on the stage?I'm building a colour-guessing game. The purpose is to walk a path through a generated field of hexagons, each assigned a random colour (yellow, red, blue or green), based on what soundfile you hear. So if you hear "yellow", you have to click a yellow tile etc.But because I want it to be a path, and the colours of the tiles are randomly generated, I have to check which colours border the currently active tile. I literally have no idea how to do this. I thought this might work but it doesnt:

if ((this.tile.y == (event.currentTarget.y - 64)) != null) {
//add the colour of this tile to array
}

[code].....

View 2 Replies

Professional :: Event Listener - Remove The Child (e.currentTarget) And Create A New Child In Its Place With The Next Line But It Doesn't Work

Feb 19, 2010

public function GlobalSolutions()
{
Navigation(' Home ', 'index', 235, 0x97F9EC);
Navigation(' Office Supplies ', 'Office_Supplies', 295, 0x97F9EC);

[code]....
 
I want to remove the appropriate child (e.currentTarget) and create a new child in its place with the next line, but it doesn't work. What do?

View 13 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

ActionScript 1/2 :: Pass The Event Onwards Through The Event Bubbling Flow?

Apr 18, 2010

I have:
 
Class my_class
{ public function my_class( an_mc )
{

[code]....

View 4 Replies

ActionScript 3.0 :: Create Custom Event Class If I Dont Need To Pass Custom Property With That Event?

Dec 28, 2009

Is there a point of creating custom event class if i dont need to pass custom property with that event?

View 3 Replies

ActionScript 1/2 :: Pass Parameters Along With A Function That Is A Parameter To Another Function?

Sep 3, 2010

I'm having some trouble passing parameters with a function that is itself being passed as a parameter.In my application code I'm instancing that class five times:they are buttons in a menu.In that class, I've got an onRelease handler that does a number of things when a button is released, one of which is to invoke a function that is defined in the application level of the code.My problem is that I don't know how to send the function parameters.In my StandardButton class I have:

class StandardButton extends MovieClip
{
/* define properties */[code]..........

The function is successfully being "sent" to the StandardButton class, but without any parameters.How can I send parameters to the class instance with the way I've got this architected.

View 7 Replies

AS3 :: Pass Custom Event Data

Aug 9, 2010

I am trying to pass custom event data from 1 class to another class...here is my codes..[code]

View 2 Replies

Actionscript 3 :: An Event Would Pass Throughout The Whole Application?

Mar 29, 2011

I have code in a flex component that I want to listen for an event, the source of the event is a custom class that's being run by another class that's being run by another class etc etc. I was under the impression that an event would pass throughout the whole application, so I was hoping if I dispatched the custom event in the class like so..

private function finishEvent():void {
var evt:EventDispatcher = new EventDispatcher;
var finished:Event = new Event("finishedInterpret");[code]...

the event gets fired basically when the executeBatch is finished, and the finishEvent is being called, but I'm the listener isn't getting anything. I tried setting it to db.addEventListener, but that had now effect.

View 1 Replies







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