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


Similar Posts:


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

ActionScript 3.0 :: Event Listeners For MCs On Stage And External Classes?

Nov 6, 2010

I found this code for a contact form at msinghinteractive easy-to-use-flash-as3-contact-us-form-class and it dynamically creates input fields and buttons. I didnt like the dynamically drawn submit and reset buttons, so I added my own MCs(my 'buttons') to the stage. I tried modifying the code and took out the dynamically drawn buttons..However, I cant figure out how to add Event Listeners to the buttons which exist on the stage--Im getting undefined errors...The fla is directly associated to a main.as class which just determines the parameters of the .as class it is tied to -to set the size of the Contact form.This is the entire class:

Code:
package{
import classes.*;
import flash.display.*;

[code]....

where btn is the instance name of my submit button MC.My problem is that because my buttons exist on the stage I dont know how to add Event listeners within that class---or rather doing that doesnt work because the listeners are throwing that undefined property errors--I gave them instance names...

View 7 Replies

Actionscript 3 :: Flash - Event Target In XML Menu

Jan 13, 2011

I have a Image XML menu that works well, but with a litle problem with target in TweenMax. I will post only the code that is relevant to resolve the problem

I have a MC in library, and inside I have 3 movie clips, img_mc, bg_mc (this is a background for text) and title_mc (inside this mc I have a textfield named title-txt).

I create a for loop for the MC, and I use e.currentTarget in my tween animations.

When I hovered the title_mc is suposed to scale the background, but because bg_mc are in back of the text, the hover don't works. I do not know how to target the title_mc for on MOUSE:OVER scale the bg_mc.

[Code].....

This Last piece of code don't works because title_mc is over bg_mc.

If I put in event MC.container_mc.title_mc.addEventListener(MouseEvent.MOUSE_OUT, out_bg); the Text will scale too, and I don't want this...

View 1 Replies

Flash ::capture Child's Event.target?

Dec 23, 2011

I want to get the value of e.target inside the visual parent of a movieclip( ChildClass). in the following code.

public class ParentClass extends MovieClip
{
public function ParentClass()

[Code]....

View 1 Replies

ActionScript 3.0 :: Flash Getting The Event Target Depth

Apr 8, 2011

I can't figure out how to get the depth of event target Object...

My code looks like this:

Code:

private function createFooterItem(footerItem:XML):void {
var button:Sprite = new Sprite();
button.graphics.beginFill(0xFF0000, 0);

[Code]....

View 3 Replies

Flash :: Error #1009 With RemoveChild On Event.target?

Oct 4, 2011

private function bubbleFlury()
{
for (var i = 0; i < fluryAmount; i++)

[code].....

View 1 Replies

ActionScript 3.0 :: Flash - (event.target.name).addEventListener Does Not Work?

Aug 18, 2010

I have an array and want to add event listener to these. I have cards on stage and define their name using "event.target.name"HP Code:trace(event.target.name)returns the clicked objetc's instance name. But When I want to add event listener to these, some problems occur.I try to use it in so many places like;

PHP Code:
mainsTimeline2.insert(new TweenMax(event.target.name, {x:stage.stageWidth y:(stage.stageHeigh /

[code]...

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

Flash :: Creating An Instance Of A Movieclip With Event.target Information?

Jul 6, 2010

Is it possible to access the type of object being interacted with so I can create a new instance of the same object? So for example in the code below I have the movieclip myItem. After it's clicked it is removed from stage and then moved to the inventory. When I click on it there, is it possible to create a new instance of mcItemToDuplicate using the event information parameters? (while allowing myItem to be where it is).

My code looks something like this:

public function moveclip() {
var myItem:mcItemToDuplicate = new mcItemToDuplicate();
stage.addChild(myItem);

[Code]....

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

Flash :: Grab An Event In An Intermediary Handler, Hold It In A Property, Then Dispatch It Later And Still Get The .target?

Jul 22, 2010

Is it possible to grab an event, hold it in a class property, do some action, then, when that action is complete, dispatch an event and then retrieve the original event.target in the listener?I am trying to avoid using a custom event for now, as it is giving me massive amounts of heartburn when dispatching it from a loaded SWF.Here is some code (that doesn't work)what I am attempting to do:

package
{
import fl.transitions.easing.Regular;
import fl.transitions.Tween;[code]....

I am able to stash the event in a class variable, and then access it later, but the cherry on the icing would be to get it from the event fired withing tweenHandler() in my example above.

Edit: Well,it doesn't look possible.I am currently storing the retrieved event in a property _event and then getting it at a later time when I need it.This seems to work, but isn't wonderful.

View 1 Replies

Actionscript 3 :: Flash Builder 4.5 - Can't Import External Classes?

Aug 31, 2011

I just installed the trial version of 4.5 of flash builder, migrating from 4.0 and I am encountering quite a frustrating problem. For some reason in which I can not peg, FB refuses to compile anything with an import from an external class, like greensock, bulk loader etc. I keep getting a 1172: Definition could not be found for any import from my external class AS3 folder on my harddrive.

Now I did edit my build path in the project and include the AS3 folder there as I usually do in past FB projects. Even code hinting works when typing in the import lines and even making new objects from those imports. But every time I save or try to compile, such errors appear on each one consistently. This is coming from a fresh install of 4.5 btw on any Flash Professional project and I would like to use it but I can't seem to get around such a fundamental problem.

View 1 Replies

ActionScript 3.0 :: Flash Has Stopped Importing External Classes?

May 19, 2011

Flash, for whatever reason has completely stopped allowing my external files to communicate with one another. In order to confirm this I ran a few tests. I have two very simple actionscript files Main.as and TestDialog.as.

Main.as is as follows

Code:
package
{
import flash.display.MovieClip;[code]....

Every time i run my program it throws error 1180 method test possibly undefined.If i try and run the constructor function TestDialog() i get the incorrect number of arguments error.

View 6 Replies

Actionscript 3 :: Link Library Symbols In Flash CS4 To Base Classes From An External .swc (rsl)?

Jan 27, 2010

This question stems from this question that I asked yesterday.I've followed Theo's advice and created a .swc with all the common classes and added the .swc as an external library to my module .swf. This all seems to have worked smoothly--I don't get TypeErrors and my classes are all present in the catalog.xml of the .swc file when I unzip it--but now I've encountered a new problem: when I try to link a symbol in the module .fla's library to a base class from my .swc rsl, it says the base class definition can't be found in the classpath. The whole reason I want to use rsls is so I can do this,If I now include the project's source path or the .swc in the normal (not external) library path, will that cancel the sharing benefits of the rsl, or will the compiler still know not to compile the shared classes into the module .swf?

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