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.
I have done an ovveride of the standard TextInput component In this component I have :
addEventListener( FocusEvent.FOCUS_OUT, handleFocusOut ); My method is trigerred when the field loose focus for another field (nice)Problem : It is trigerred alose when the whole flex application lose focus (when my field has the current focus inside my form)
I have a textfield in flex with a focusOut event on it. I can type in the box and in Firefox and Chrome when I click elsewhere on the page (outside the flash element) the focusOut event will be triggered. However in IE8, the texfield never loses focus when you click elsewhere on the page, outside the flash object. I've tried with focusManager.browserMode set to true and false with no difference (I believe that effects incoming focus anyway).
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.
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:
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?
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??
When you change from txtOne to txtTwo, the Alert is showed and after pressing OK, the focus will return to txtOne. I don't want that to happen. How to solve this?
I am writing a flex application and I have two Spark TextAreas. I want to create an EventListener so that when the user clicks on a text area, the text inside the TextArea is cleared:
this.addEventListener(FocusEvent.FOCUS_IN, onFocusIn); private function onFocusIn(ev:FocusEvent):void { if (this._showsCaption) {
[Code]....
Currently I can implement this with a Spark TextInput, but when I click on the TextArea, the focusIn event never fires and the onFocusIn() handler is never called.
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:
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?
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?
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.
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.
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.
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.
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).
var urlString1:String="TestDrive/z05483205.xml"; var url1:URLRequest=new URLRequest(urlString1); loader1=new URLLoader(url1); loader1.addEventListener(Event.COMPLETE, test); [Code]....
Can I change an event target's name? or it's an only-read property? I've been googling it but to no avail... For example, say this is my button code:
[Code]...
if trace the event target's name, you get buttonOne. But what I need to do is have the event's target's name to become buttonOne1. because I already have a button with the instance name. That's my setup, not the way I would do it OF COURSE, but this is the way the unique file is setup for my aunt, to have two set of buttons that calls the same image...(not the thumbnail issue I had before)... so the Question: is there a way to add a letter or remove a letter from the event target's name? You know how you can add a letter to the beginning of an array like buttonsArray.unshift(newButton)....can you do the same thing with an event.target.name?
I made this file, test1.fla where a movieclip named mc1 contains two other mcs. Then I wrote some simple code to make the target of the event (in this case a mouse event) shrink a little.
Here's the code I've used:
Code: mc1.addEventListener(MouseEvent.MOUSE_OVER, onDown); mc1.addEventListener(MouseEvent.MOUSE_OUT, onUp); function onDown(evt:MouseEvent):void {
[Code]....
When I test this movie, only the selected mc that I hover is the one that shrinks, the other does not shrink (I am talking about those guys inside mc1). However I have done a similar file called test2.fla in which I replaced the nested mc's with shapes, the code is exactly the same, but in this case it's mc1 that shrinks, I mean no matter what shape I hover with mouse, both shrink.
I know (think so) that this is because of event propagation, but why do these two files react in a different manner? Is it becase the mc's inside mc1 can also be a display object container, but shapes cannot?
i am a little new to this ActionScript thing, and I find problem trying to understand this one thing:When I call an event listener function, then sometimes we use
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 hope .
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.
Important Pieces of Code:
[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...
I have an instance of a movie clip called dirt I assigned a variable to dirt called dirt.val I also added an event listener to dirt that calls a function In the function I want to access the dirt.val property, but evt.target.val doesn't work.
how to manage the target of a mouse event. As everyone knows, if I use localX/Y property on a mouse event, I'll get the x/y coordinate of the curson referred to the target Sprite. But if I need these coordinate referred to another Sprite, layed in the bottom of the stage (therefore unreachable for the event), how can I do for these?
i also has another problem here is the senario .first i select the square (there are too many object one of is square )then click the button now my event target is button previous one is square so i need to change the square(object) using that button.
I have a bunch of movie clips in my main timeline with at least 2 nested clips inside them, MyMc.nested1.nested2 etc. I have given the top most movie clips that sit on the main timeline instance names. In a document class I created a private variable typed as an array and placed all those MC names in that array. I then looped through the length of the array and assigned 2 event listeners to each instance. Example:
for (var i:uint = 0 ; i < _activities.length ; i++){ _activities[i].buttonMode = true; _activities[i].addEventListener(MouseEvent.MOUSE_DOWN, pickUp); _activities[i].addEventListener(MouseEvent.MOUSE_UP, dropIt);}
in the event pickup() is were my trouble seems to come in.In the pickup function I have the following:
event.target.startDrag()
This seems to work, but only on the lowest nested Movie clip......nested2I can use event.target.parent.parent.startDrag() and that seems to work.... Except when I place another movieclip in the second layer of the of the MyMC , if that is accidently clicked, it will now drag the Stage.I attempted to use the event.target.mouseChildren = false but that only seems to work on the lowest nested object... nested2 as that seems to be the one I am clickingIs there something I am missing to say, click only the top level mc then ignore all nested mc?
I've been following this tutorial[URL].. i'm making a website with buttons however when i test the scene it scrolls and loops each content for the pages.this is the code i've got for the action script