ActionScript 3.0 :: Target The Event To The Second Level Of Sprite?

Sep 21, 2011

If i have a container, with some sprites and this sprites containes other sprites, wich is the best way to target the Event to the second level of sprite?
 
Container:
 
- sprite1 ---> contain n sprite
- sprite 2 --> contain n sprite
- sprite 3 --> contain n sprite[code]....

View 7 Replies


Similar Posts:


ActionScript 3.0 :: Override Event Target - Move Other Sprite According To The Mouse Events On The Stage

May 27, 2009

i am trying to do a simple blackboard on mouse down, start drawing on mouse move, if drawing, draw line on mouse up, stop drawing i set the listeners on a simple clip with a rectangle. if i dont fill the rectangle, the mouse events wont fall into the rectangle, but if i fill the rectangle, it will paint behind the rectangle, so anyway i wont see any succesfull results. what i did was create another sprite and paint within it; something like

[Code]...

View 3 Replies

ActionScript 2.0 :: CS3 Loadmovie Into Target Mc - Not Level?

Apr 5, 2009

got a file that contains scripting that creates and animates a carousel effect in a faux 3d space - it all works great on a mac and some pc's but on a lot of pc's it doesn't play nicely! i have added some script to carousel script so if the carousel item is clicked it rotates that item to the front and then loads the specified swf into level 1

pc's don't seem to recognise the alignment of the loaded swf and brings it in half cropped off the screen - appearing in the top left of the stage area.how do i tell the loaded swf to centre in the middle of the stage just like the rest of the elements in the movie? how to make the target mc sit at the highest level/depth - in other words above the carousel? this is my onclick script:

Code:
function released()
{
output.text = this.txt_label.text + " has been selected";[code].........

View 1 Replies

ActionScript 2.0 :: Possible To Change Target Level Of MovieClip?

Feb 9, 2007

is it possible to change the target level of a MovieClip? So I have two instances of the same MovieClip, both on level0.[code]Basically, now btn2 will disappear, and btn1 will remain visible.

View 1 Replies

ActionScript 3.0 :: Target An External File Locate Up One Level?

Feb 25, 2011

I was trying to upload an external .txt file which is located up one level from my .fla file but I couldn't make it work, this is what I have...This code works just fine if I put my external .txt file in the same folder as my .fla

ActionScript Code:
var myRequest:URLRequest = new URLRequest("MaterialRef.txt");

but when I try something like... where the .txt file now is in a folder called "Materials" which is located up one level, it just doesn't work.

ActionScript Code:
var myRequest:URLRequest = new URLRequest("../Materials/MaterialRef.txt");

View 0 Replies

ActionScript 3.0 :: Target An External File Located Up One Level

Feb 25, 2011

I was trying to upload an external .txt file which is located up one level from my .fla file but I couldn't make it work, this is what I have...

This code works just fine if I put my external .txt file in the same folder as my
.fla

var myRequest:URLRequest = new URLRequest("MaterialRef.txt");

but when I try something like... where the .txt file now is in a folder called "Materials" which is located up one level, it just doesn't work.

var myRequest:URLRequest = new URLRequest("../Materials/MaterialRef.txt");

View 6 Replies

ActionScript 2.0 :: Changing Level / Target Of New Movie Stop Old File From Playing?

Jun 27, 2003

[code]That is the code used to solve the cache problems, but i dont' really get the second line. How does changing the level or target of the new movie stop the old file from playing?!i also searched what "?" does in flash, but i couldn't seem to find it.

View 3 Replies

ActionScript 3.0 :: Target Sprite From Subclass?

Jan 12, 2012

I create a Sprite in a subclass, add it to the stage. Now I need to target it from another class, but I am going wrong somewhere. This is shorten code, so hope I did not delete some important parts. But you should be able to follow the basic structure.

Main class:

package myClasses
{
import flash.display.Sprite;
import flash.display.Stage;

[code]...

View 3 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 :: Set Stage Level Event Listeners?

Apr 7, 2009

As part of a very large project, I want the ability to set stage level event Listeners.
 
This works very easily with MouseEvent s but I can not seem to get it to run properly with KeyboardEvents.  Having google'd this issue I have found very little on the subject.  Mostly noobish type questions of syntax and so forth, but I have seen comment of people claiming to have it work for them.
 
To ensure no issues with any other code, I have made a blank project and blank .as file, with only the event listener code:
 
[Code].... 
 
Click events are always captured and traced correctly, without fail.  Pressing keys appears to do nothing.  If however you mash the keyboards very very quickly, one or two key events will trigger sporadically.  

View 5 Replies

ActionScript 3.0 :: Check For Any Event Triggered By Child On Parent Level

Jun 24, 2009

I have a movieclip(parentMC) which consists of several other movieclips(childMCs). Each childMC can trigger an event, and each event performs a different function. I want to check from my parentMC whenever there is an event triggered by any of its child.

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

Catch Mouse Event On Sprite?

Sep 14, 2009

i want to know how to catch mouse event on sprite.I have created a class which extends Sprite and then tried to catch mouse event on it. but not successful.so is it neccessary to draw something on it to catch events?

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

ActionScript 3.0 :: Change An Event Target's Name?

Mar 22, 2009

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?

View 3 Replies

ActionScript 3.0 :: Make The Target Of The Event?

Jul 10, 2009

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?

View 3 Replies







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