ActionScript 3.0 :: Use The Event.target.name String With An External DispatchEvent?

Feb 7, 2010

On my stage I have an externally loaded SWF with a button. When clicked the button dispatches an event to the main stage.

On the main stage a listener then loads an SWF into a loader called gallery. The gallery loader is also being shared by buttons on the main stage which use the event.target.name String to call in SWFs with corresponding names. I am using Tweens to fade-out and -in content to the gallery when a button is pressed.

Loading the SWFs was working until I tried to create a universal button function for the dispatchEvent buttons. The problem I have is that I don't know how to define the String to tell the newSWFRequest where to find the SWF when triggered by the external buttons.

[code]...

View 11 Replies


Similar Posts:


ActionScript 3.0 :: Add The Event Target Name To String Addresses

Aug 4, 2009

I am trying to add the event target name to the string addresses. The MC I am trying to target is called 'scotlandAddresses'. I tried the code below.[code]

View 2 Replies

Professional :: Target Event Listener When Loading External SWF

Jan 22, 2010

I'm looking for an alternative to using:
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyFunction);

The problem I am encountering is that eventListener above works fine on its own(stand-alone swf), but when loading an .swf externally into another .swf, the listener fails with the following error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.

How can you target the event listener when loading as an external .swf differently?

View 3 Replies

ActionScript 3.0 :: Flash Event.target.name In External Classes?

Aug 3, 2011

How do I call this function for multiple listeners without IDE timeline and frame names, using external classes? Im moving my timeline code to classes, and Im stuck with this..

View 4 Replies

Flex :: AS3: Event Dispatching Via DispatchEvent- Pass Params?

Jan 2, 2010

I would like to dispatch an event from my class along with a url.

I know that I can do the following:

import flash.events.EventDispatcher;
private function thumbClick(e:MouseEvent):void
{
dispatchEvent(new Event("clicked"));

[Code].....

View 2 Replies

Actionscript 2.0 :: DispatchEvent - Fire An Event When An Animation Has Finished

Nov 3, 2010

I have attached a fla file where I am trying to fire an event when an animation of a car has finished.

View 1 Replies

ActionScript 3.0 :: DispatchEvent - When The Variable P_bw Is Greater Than 0, An Event Is Called?

Aug 13, 2009

I'm trying to write code so that when the variable p_bw is greater than 0, an event is called. I've read that I need to use dispatchEvent but I can't seem to get it working .Here is my code....

package CIS.FLVPlayer[code]............

View 10 Replies

ActionScript 3.0 :: Button Mashing DispatchEvent Leads To Lost Event?

Jul 31, 2009

Is it possible to lose events, or somehow corrupt the event cue, by button mashing? Our buttonPress function calls dispatchEvent, which starts an animation. The last frame of the animation also calls dispatchEvent. After about 20 fast clicks on a button, the animation runs as it should, but the last frame seems to not call dispatchEvent,because the addEventListener function is not called.My hunch is that the last frame did call dispatchEvent, but somehow the event was lost due to the constant button spamming sending other events.

View 0 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.0 :: Access Event.target Outside Event Listener Method

May 13, 2010

how can i access event.target outside event listener method.say for example

my_mc.addEventListener(MouseEvent.CLICK, onC);
function onC(e:MouseEvent):void
{
var m:MovieClip = e.target as MovieClip;
}
trace(m.totalframes);/// not working

now what if i want to get totalframe property of m instance, in short for every movieClip clicked.

View 11 Replies

ActionScript 3.0 :: Add Event Listener On Parent For Event.target = Child?

Jul 30, 2009

I have these buttons in a movie clip and I would like to have only one event listener for the parent, using event.target to point to the children. I have also tried event.currentTarget, and it didn't work.here is the code that works:

test01.abtn.addEventListener(MouseEvent.ROLL_OVER, mouseHandler);
test01.bbtn.addEventListener(MouseEvent.ROLL_OVER, mouseHandler);
test01.cbtn.addEventListener(MouseEvent.ROLL_OVER, mouseHandler);[code]....

It is only targeting the movie clip, not the buttons inside the movie clip.

View 4 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.0 :: Mouse Event And Event Target

Nov 26, 2009

i have these 2 functions and both are the same:

as you can see disabledAction receives e.target as a paremeter from another function (click function actually).

is there a way to somehow call disabledAction from rollOverHandler ? (so that the code doesnt repeat)

Code:
function disabledAction(target:MovieClip):void {
var txt:TextField = Finder.findTextfield( target as MovieClip ) as TextField;
if (txt) {

[Code].....

View 1 Replies

ActionScript 3.0 :: Target Mc Name With String?

Nov 23, 2009

I don't know how to exactly name my problem but I will try.

I have a variable that is sting for example:

var variable:String = "test";

I have the mc with instance name test_page for example.

How I can create tween for this test_page mc merging the content of the "variable" string and word "_page".

View 3 Replies

ActionScript 3.0 :: Target VAR Using String And Number?

Oct 18, 2011

how do I target a VAR using a string and Number, the idea is that i can chnage the number to target that VAR.

var gogo1:Number = 12
var gogo2:Number = 89
trace("gogo" + 2)

[code]....

View 4 Replies

ActionScript 3.0 :: String To Movieclip To Drop On The Target

Jan 31, 2012

I have the following code

[Code]...

Code: Error #1034: Type Coercion failed: cannot convert movieclip1 to MovieClip. My goal is to have the dropTarget.parent.name turned into a movieclip so I can use properties on it. There is a movieclip that I want to drop on the Target, and I can use "this" for source, the movieclip that I'm dragging, but when I want to have properties on the destination, when I want to convert the String to MovieClip, I get #1034 And I don't know what is it that I'm doing wrong...

View 5 Replies

ActionScript 2.0 :: Load A New External JPEG Image Into A MC With A String Var Encoding A String Caption In The URL Link / Text Fader

Jun 6, 2003

I have a very general requirement that seemed very simple: Step 1: Load a new external JPEG image into a MC with a string var encoding a string caption in the URL link (VALUE="../fadeTest.swf?someTextVar=TestCaption") within the EMBED / OBJECT sections. I know how to do this and it semed to work fine. STEP2: When the JPEG is loaded I would like the substituted Text to Fade In over the JPEG. The JPEG should also fade in before the Text. The fade rate should be programmable.

[Code]....

View 1 Replies

ActionScript 3.0 :: Using String To Store Evt.target.data And Apply Property Filters?

Jul 21, 2009

I have about 9 buttons on my stage and I want to write code for the rollover and rollout effects, I only want to write the code once so I am trying to pass the button info into a string via evt.target.data and it pass the info properly into my string variable but when I try to set my filter to that variable, setting my movieclip instance name to that variable, I get 2 errors:
 
1119: Access of possibly undefined property filters through a reference with static type String.Warning: 1072: Migration issue: String is not a dynamic class.  Instances cannot have members added to them dynamically. 

My code is: 
 
import fl.transitions.Tween;
import fl.transitions.easing.*;
var thumbArray:Array=new Array();
var movieClipLoader:Loader;

[Code].....

View 3 Replies

Actionscript 3 :: Get Name Value Of Event Target?

Apr 16, 2011

I'm implementing a text display area inside an app that displays selected text when the user mouses over one of four elements. Rather than creating a handler function for each element, I would like to get the name of the instance that is calling the handler in order to implement a switch statement. I've tried two ways, but both aren't working:

//install event handlers
initialText.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
timeText.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
withdrawalText.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);

[Code]....

Both of those return undefined for the variable name. However, in the debugger, I can trace the event values through currentTarget.name, and that shows the instance firing the handler function, whether it be withdrawalText, initialText or timeText. So how can I apply the name value to a variable in order to determine which text block to display?

View 1 Replies

ActionScript 3.0 :: What's Going On With Event.target ?

Nov 3, 2009

I have a URLLoader and a Loader triggering the same function. If event.target is traced by this function it outputs [object URLLoader] or [object LoaderInfo].However, the if statements don't seem to know what the event is and won't output anything even though it traces fine in the first trace statment. What is going on here?

ActionScript Code:
xmlLoader.addEventListener(ProgressEvent.PROGRESS, preLoader);
photoLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preLoader);[code]............

View 2 Replies

How To Prevent Wrong Event.target

Dec 1, 2010

Now, when I click on the button in the area where the movieclip is it will register this movieclip as event.target. I would like to make the button the event.target regardless where I click and prevent flash from registering the movieclip inside the button as the target.

View 3 Replies

ActionScript 3.0 :: No Event.target Available On FocusOut

Mar 4, 2010

I searched the forum first to find similarities but I couldn't find one. Sorry if this is a double however. If you try to compare a widget's instance through "event.target" after it has raised a "focusOut" event, then you won't get the actual instance.

[Code]....

View 2 Replies

ActionScript 3.0 :: Remove Event.target?

Mar 11, 2010

My parent class adds bonus_mc It then adds an event listener to bonus_mc to listen for a custom event When the custom event is dispatched I want the parent_mc to remove event.target. But it wont, it's says 1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display: DisplayObject.

View 3 Replies

ActionScript 3.0 :: Seeing Event.target Of TweenEvent?

Dec 29, 2010

The logic of the code is as follows (pseudo):
 
function X {
switch
1) tween1 -> on tween finish launch onTweenFinish();
2) tween2 -> on tween finish launch onTweenFinish();

[Code]....
 
results in: ReferenceError: Error #1069: Property name not found on fl.transitions.Tween and there is no default value.
 
What I want is to process all three tweens in a single function, but I need to know which tween it was. It is of course possible to make three separate functions, one for each tween, but that is just not proper.

View 3 Replies

ActionScript 3.0 :: Event.target Movieclip?

Jan 26, 2012

I have a movieclip named button1 that contains a dynamic text named txt in it.My problem is that if i try

if(event.target==button1)
{
}

[code]....

View 1 Replies

ActionScript 3.0 :: Simulate The Event TARGET?

Jan 27, 2009

Is it possible to simulate the event TARGET ?

dispatchEvent(new Event("doSomething"));

I want to simulate a click on a specific item of my menu.

View 9 Replies

ActionScript 3.0 :: Cant AddChild The Event.target?

Jan 29, 2009

i add eventlistener(MouseEvent.MOUSE_OVER) to some movieclip. but when i write: addChild(event.target) it doesnt work.

More info: i have several rectangles on the stage. when movie starts, they all get alpha 0.3, when you mouse over any of them they get alpha 1 with tween. But i made it so that, rectangles are located over the each other. and i want to make it so, that when you mouse over any rectangle it comes to front, but it doesnt work with addChild(event.target).To try it at your own, just create 3 different sized boxes and give then instance names: square_mc, square2_mc, square3_mc and copy+paste this code.

[Code]...

View 3 Replies

ActionScript 3.0 :: Event.target With Methods?

Oct 18, 2009

I am searching for a way to use one eventlistener with multiple buttons that bassically behave the same way.It works with event.target.(any movieclip property here, e.g. alpha).

[Code]...

View 2 Replies

ActionScript 3.0 :: Get Xml File Name From Event.target?

Nov 16, 2009

var urlString1:String="TestDrive/z05483205.xml";
var url1:URLRequest=new URLRequest(urlString1);
loader1=new URLLoader(url1);
loader1.addEventListener(Event.COMPLETE, test);
[Code]....

I expect to see this z05483205.xml

View 1 Replies







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