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


Similar Posts:


ActionScript 3.0 :: Argument With Event Listeners

Oct 19, 2009

let's say i have a function that is

function myFunction(argument1:int, argument2:int):void {
trace(argument 1 + argument2);
}

i can use myFunction(1,2); to get a trace of "3" but if it's a mouse event, or timer event, or anything myMC.addEventListener(MouseEvent.MOUSE_DOWN, myFunction); we can't put arguments in this because it would have been

[Code]....

View 2 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 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 :: 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

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 :: 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 :: 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 3.0 :: Tween In Function Plus Tween Event Listener?

Feb 18, 2009

What I want to happen is, user clicks button, button slides across screen, when the slide is finished frame 2 is displayed. I am getting an Output of:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at howTo_fla::MainTimeline/howTo_fla::frame1()

and my code looks like:

import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

[Code]....

View 3 Replies

ActionScript 3.0 :: Proper Listener On Tween Event Inside Mouse Event

Feb 23, 2011

My stage has about 25 buttons on it. Each button when pressed to tweens the background to some random x/y coordinates and then loads an external swf file.This is all working, but the timing is off. How can I wait for the initial background tween to end before I make the loader call to the .swf file.Currently each button's behavior is called on the MouseEvent.CLICK event which calls a function that knows its unique filename.swf. I know you can add the MOTION_FINISH even to the tween event but then I would have to call a new function and lose track of the button that initially called it.

View 3 Replies

ActionScript 3.0 :: Send Event To Child?

Feb 19, 2007

Is it possible to send a custom event to a child?

[Code].....

when I click the parent, it gets click event. in the click event handler, the parent dispatches a custom event of type E. and the child is listening for E. obj.dispatchEvent() by default targets for obj it is called from. So, the event being dispatched won't reach the child if obj had one. Is there a way to send an event from parent to child? Better yet, is it possible to send an event to an object not in the DisplayList nor is a DisplayObject (the object is instanciated, but it doesn't have graphical role in the program)?

View 3 Replies

ActionScript 3.0 :: Onscreen Keyboard - How To Send Event

Nov 5, 2008

Relative newbie with AS3 but I need to make an onscreen keyboard for a touchscreen. Through some searching and coding I have a keyboard object that can send events based on clicks but I'm not sure how to go that "last mile" to trigger an actual keyboard event so the selected TextField gets updated.

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

ActionScript 3.0 :: Flex: Send Event Or Something To Repeater Item

Feb 13, 2010

I have a Tile with a repeater. I need to select a repeater item or the tile and change its values, or fire an event, or something.

View 1 Replies

Professional :: Trigger An Event To Send The Playhead To Another Frame And Load Another Swf?

Mar 7, 2010

I am in the final stages of building my new web site: http:[url]....On most of the pages in the portfolio there is a video "Commentary" link (top right corner).Each of the commentaries are flv called up by f.ex:
 
myMCL.loadClip("http:url.....);

Once the video is done playing, it fades to black.I would really like the flv to trigger an event to send the playhead to another frame and load another swf.I could use a pause command and let the main time line pause so many milliseconds and then proceed, but it is probably not consistent how long it takes each viewer to download the video and watch it.

View 11 Replies

ActionScript 3.0 :: Event Listener And Dispatcher - Send And Load Class

Jul 29, 2009

I'm having an issue with an event dispatcher and an event listener. Here is the application code...
Code:
Select allpackage {
import flash.display.MovieClip;
import flash.events.*;
import flash.net.URLVariables;
import SendAndLoad;
public class Test extends MovieClip {
[Code] .....

It will trace the loader.data variables but doesn't dispatch the event to the main application (Test). I'm listening for the event on the stage of the main but it doesn't trigger the event to display that the login has been successful even though it traces from the sendAndLoad class...

View 3 Replies

ActionScript 3.0 :: Use The DispatchEvent Command To Send The Fire Button Event And Parameters

Mar 6, 2009

I have a game with two joysticks and I use the dispatchEvent command to send the fire button event. What would be a good way to send the number of the joystick to check who pressed the fire button. A bit dirty way would be to save just the number in root or in my main class.

View 1 Replies

Actionscript 3 :: Send Events Between Objects On Same Level (Global Event Manager)?

Sep 8, 2011

I came to the point where I need to communicate between 2 objects (let's say Tank and the Cannon). It is tile game, and when the Tank approach specific tile I need my Cannon to shot the Tank. When Tank gets that specific tile I want to dispatch some custom event and have listener in Cannon class body to make the shot happen. Other way I would have to check in ENTER_FRAME loop (inside Cannon body class) if the Tank touched tile that runs the Cannon shooting - but this is not elegant and efficient. The issue is complicated by the fact that the Cannon and Tank are added to the Engine (document class) and can't simply hear for each other, because they seat on the same level in display list.

Initially I could addEventListener to the Engine, but this way my document class would enlarge to the XXL size (all listeners functionality, all methods for game etc). What I would accomplish is to have event listener in every Cannon object (defined in body class) listening for Tank's dispatching the event. I saw some 'Centralized Event Manager' article in the net, but can't download full classes [url]...

View 1 Replies

ActionScript 3.0 :: Bug Using Tween MOTION_FINISH Event?

Dec 30, 2010

I programming a game and when i destroy an enemie, i wan't the game to create a textfield with the enemie's points value that moves and disapears after a while.So when the enemie is destroyed, i create the textfield and ad a tween. Then i ad an eventListener to the tween so the textfield is destroyed when the tween is completed.

Code:
var points:TextField = new TextField;
var tween:Tween = new Tween(points,"y",Strong.easeOut,points.y,points.y-30,0.5,true);tween.addEventListener(TweenEvent.MOTION_FINISH,delete_txt);
addChild(points);

Then the function that deletes the textfield :

Code:
protected function delete_txt(e:Event)
{
removeChild(e.target.obj);e.target.removeEventListener(TweenEvent.MOTION_FINISH,delete_txt);
}

It does work most of the time but like once in 20-30 times the textfield doesn't disapear and just stays in the air. I placed a trace in the delete_txt function and the program doesn't seem to get to it when the bug occurs.I'm not getting any error.

View 5 Replies

ActionScript 3.0 :: Tween Event On Complete

Oct 4, 2010

I have a tween called fadin_Tween_1 and would like to create an eventListener for for COMPLET.

View 1 Replies

ActionScript 2.0 :: Tween On Mouse Event?

Nov 20, 2006

All it does is tween the x and y positions of a circle and textfield. I've tinkered with it a bit by putting the tween functions in a separate Tweener class and made it accept whatever display object is passed to it. For demonstration purposes, I have it set up so that the tweens occur as soon as the circle and textfield are created. The problem is that I would like the tweens to occur only when they are clicked on. I don't know how tp do this. How do I write _circle.addEventListener(MouseEvent.MOUSE_DOWN,... .) and _text.addEventListener(MouseEvent.MOUSE_DOWN, tweenerIt) so that they are the triggers?

[Code]...

View 4 Replies

ActionScript 3.0 :: Dispatch Event On Tween Complete?

Feb 5, 2009

I don't seem to get the dispatch event working when i use atween. I tried before an dispatch Event andthat worked great. My working example:For example i have a class called LoadImageAnd inside this class i have:

loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
completeHandler);
private function completeHandler(event:Event):void {

[code]......

View 3 Replies

ActionScript 3.0 :: Tween Start Event Not Firing?

Apr 21, 2010

I have this code below which produces no errors

import Card;
import fl.transitions.Tween;import fl.transitions.easing.*;import fl.transitions.TweenEvent;
 var ace_clubs1:Ace_clubs = new Ace_clubs();ace_clubs1.scaleX=0.4;ace_clubs1.scaleY=0.4;[code]......
 
The only thing is the TRACE output for the MOTION_START EVENT does not fire.

View 8 Replies

ActionScript 3.0 :: Firing Off An Event At End Of Alpha Tween?

May 5, 2010

If I have a movie clip that resides and plays in one frame, and I want an second (visible=false) movie clip to play on the same single frame as soon as the first is finished...  what kind of event to I use? Do I have a frame action inside and at the end of the first movie clip that throws out some kind of event to tell the second to play?Basically, I have a menu (first movie clip) that alpha tweens up, then the buttons (second movie clip) to appear when the first is 100% alpha.

View 8 Replies

ActionScript 3.0 :: Tween Event To Play In Reverse?

Oct 6, 2010

I have an simple animation playing using the tween event, then I have an even listener to check when it's finished. On finish I want the tween to play in reverse. I used yoyo() which half does what I want but this loops, is there anything that will just reverse like yoyo but just stop at the beginning of the tween

[code]....

View 4 Replies

ActionScript 3.0 :: Getting MOTION_START Tween Event To Launch?

Jun 26, 2011

First of all I'm sorry I don't know action Script well at all, (Im a graphic designer trying to figure it out) This is the Script I have:

function drawPageC(e:MouseEvent):void
{
exitTween = new Tween (currentPage,"y",Regular.easeOut,currentPage.y,770 ,40,false);
prevPage = currentPage;
currentPage = new drawing();
currentPage.x = 0;
currentPage.y = -770;
addChild(currentPage);

[Code]...

It works with MOTION_FINISH, but I would like the new page to load as the old one moves away, so they move together not one at a time.

View 8 Replies

ActionScript 3.0 :: Event (Tween) - Loading Series Of Pictures?

Jul 29, 2009

I'm loading an XML file with a series of pictures. The pictures cycle through on a timer of about 3 seconds. The pictures load with an alpha of 0 and there is a tween to fade them in. The problem I'm having is trying to tween them back out to a value of 0. (My function fadeOut never fires (no trace))

Here's the code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
var myTween:Tween;
var xmlRequest:URLRequest = new URLRequest("imageData.xml");
[Code] .....

View 2 Replies

ActionScript 3.0 :: Listen To A Motion Tween And Use An Event Handler To Do Something?

Mar 6, 2011

I looked at some tween event handler tutorials but couldn't figure  out how to get it to work with the below. I copied the tween code and  paste it in a frame that has an animated character. I want the character  to run across the screen and after the tween is finish I want to be  able to jump to a different frame.

[Code]....

View 3 Replies

ActionScript 3.0 :: Flash Recognize An Event When A Tween Ends?

Mar 16, 2011

I have a programmatic tween (fl.transitions.Tween) on a MovieClip and want to apply a ColorTransform on it when it ends. Basically, the Tween scales an item down to its original size, and I want to know when the scaleX is back to 1, and then trigger the application of a ColorTransform. Is there a way to do that or must I use a timer in conjunction with the Tween?

View 5 Replies

ActionScript 3.0 :: Trigger Fade Tween Event Listener?

Jul 30, 2009

Here's how I'd like events to unfold:when the first image is completely downloaded, fade it up and start the timer After 5 seconds, pause the timer and completely download the next image. Fade it up and start the timer again Remove the previous image from the stage

I set my fade's alpha to .5 to see if the previous image was being removed, and it was not. What is wrong with my syntax?

[Code]...

View 3 Replies







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