AS 3.0 event target problem!!!

I have an interesting problem regarding event.target in Flex
2/ActionScript 3.0. I am using the Flex Grocer app in order to try
something out. I am attaching listeners to all the click events and
then printing out event.target to keep track of my events and where
we clicked, nothing revolutionary here very easy stuff. Once I get
the paths I would like to run code that will execute my steps and
play the clicks back based on the event.target information that I
got and I was able to do that except when we have popups. Here is
the problem:
When I execute a click on a button with event.target =
DataEntry0._UpdateDeleteProd1.Form10.FormItem102.HBox103.Button104
A poupup appears and then I click on the close button on that
popup with event.target=
ConfirmScreen464.UIComponent494.Button498
COUPLE OF PROBLEMS HERE:
1) I don’t have the path to the root (DataEntry0) even
though I use the standard event.target.
2) This is even a bigger problem, the DOM path
(ConfirmScreen464.UIComponent494.Button498) is dynamically
generated (the numbers are dynamically generated) so when I use
that path that I got during the time I was monitoring the app, when
I use my code to play the events that very same target does not
correspond to the popup that the fist event caused.
I tried using IDs but in Flex I have not found anything like
document.getElementById() that is available in JavaScript. Any help
on this will be greatly appreciated.
Thanks
p.s. I looked at the automation library that Flex has (and
Mercury QTP uses) but that will not work for me.

zoran,
Sorry,I didn't explain what to do very clearly :).
Básically, the event.taget parameter is set when you use the
dispatchEvent function, so if you want an event to be dispatched
from a Object you must call the dispatchEvent from this function.
The line I gave you wont work by itself since I don't know
how you reference
DataEntry0._UpdateDeleteProd1.Form10.FormItem102.HBox103.Button104
in your application.
But what you need to do is call the dispatchEvent function in
the Button104 object with the specific event you want to trigger.

Similar Messages

  • How do I use the event.target.name String with an external dispatchEvent?

    ...I hope the title question makes sense...
    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.
    (I may be doing this all wrong... but figured the best way to load an SWF on to the main stage from an external SWF was by using dispatchEvent??)
    My code triggers the Event and the gallery loader fades out, but then it cannot find the new SWF:
    Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
    Please can someone help me understand the way to make the String point in the right direction? (I think the only errors are in bold below)
    Code:
    var myTweenIn2:Tween;
    var myTweenOut2:Tween;
    var nextLoadS2:String;
    // Listen for external event dispatched from external btns
    addEventListener("contactStage", btnClickExtrnl);
    function btnClickExtrnl(e:Event):void {
    nextLoadS2 = ?????
    myTweenOut2=new Tween(gallery,"alpha",None.easeOut,gallery.alpha,0,0.2,true);
    myTweenOut2.addEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteF2);
    // Btns Universal function
    function tweenOutCompleteF2(e:TweenEvent){
    myTweenOut2.removeEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteF2);
    myTweenOut2=null;
        var newSWFRequest:URLRequest = new URLRequest("swfs/" + nextLoadS2 + ".swf");
    myTweenIn2 = new Tween(gallery, "alpha", None.easeOut, gallery.alpha, 1, 0.2, true);
        gallery.load(newSWFRequest);
        gallery.x = Xpos;
        gallery.y = Ypos;
    Thank you.

    That works – thank you!
    I'm now using this code to fade in each of the SWFs:
    function contactStage(e:MouseEvent):void {
        var newSWFRequest:URLRequest = new URLRequest("swfs/"+e.currentTarget.name+".swf");
        myTweenIn = new Tween(gallery,  "alpha", None.easeOut, 0, 1, 0.2, true);
        gallery.load(newSWFRequest);
        gallery.x = Xpos;
        gallery.y = Ypos;
    But I cannot add the fade out function. I have amended the above code to create:
    var myTweenOutX:Tween;
    var myTweenInX:Tween;
    function contactStage(e:MouseEvent):void {
    myTweenOutX=new Tween(gallery,"alpha",None.easeOut,gallery.alpha,0,0.2,true);
    myTweenOutX.addEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteFX);
    function tweenOutCompleteFX(e:TweenEvent){
    myTweenOutX.removeEventListener(TweenEvent.MOTION_FINISH,tweenOutCompleteFX);
    myTweenOutX=null;
        var newSWFRequest:URLRequest = new URLRequest("swfs/"+e.currentTarget.name+".swf");
    myTweenInX = new Tween(gallery,  "alpha", None.easeOut, 0, 1, 0.2, true);
        gallery.load(newSWFRequest);
        gallery.x = Xpos;
        gallery.y = Ypos;
    But get this error:
    ReferenceError: Error #1069: Property name not found on fl.transitions.Tween and there is no default value.
    at ACOUSTIC_fla::MainTimeline/tweenOutCompleteFX()[ACOUSTIC_fla.MainTimeline::frame1:110]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at fl.transitions::Tween/set time()
    at fl.transitions::Tween/nextFrame()
    at fl.transitions::Tween/onEnterFrame()
    Where am I going wrong?

  • Event.target == null in AIR client

    Hello,
    once again I have a question, and this may very well be a tricky one:
    I have the need to check if a dynamic XFA form has been signed from inside this form. This is quite easy and works perfectly if I just use a button on the form or just about any script event I can think of. It does, however, NOT work if I use the form inside an AIR client which is using a FormBridge construction to communicate with the PDF.
    The problem seems to be that event.target is always null in that case. So what I'm looking for is either an explanation why event.target is null when embedding the form inside AIR or how to check if the form is signed without having to use event.target (or the doc object if you will).
    Can anyone think of anything to achieve this?
    Many thanks,
    Steffen.

    Here is the site: http://coenraets.org/blog/2009/12/air-2-0-web-server-using-the-new-server-socket-api/
    My question is under socketDataHandler() function.
    Thanks.

  • Compile error for DragManager.acceptDragDrop(event.target)

    This line
    DragManager.acceptDragDrop(event.target);
    seems to be giving me the following compile error:
    Implicit coercion of a value with static type Object to a
    possibly unrelated type mx.core:IUIComponent.
    (There is an arrow pointing to "target", I guess indicating
    that that is the Object causing the problem.)
    I'm not sure why this is giving me an error since the
    official Adobe document describing how to migrate applications from
    Flex 1.5 to Flex 2 says that
    DragManager.acceptDragDrop(event.target) is what's supposed to
    replace event.handled=true.

    Hi.
    The problem is that DragManager.acceptDragDrop expects a
    UIComponent but Event.target is typed as Object. You need to cast
    the target as a UIComponent. Try this:
    DragManager.acceptDragDrop(UIComponent(event.target));

  • MovieClip Event handling problem

    hi all I m trying to make an drawing app, I make a 1 button for create drawing shape (square shape)
    user can draw square and circle on a blankpage movieclip, but the problem is when we click on squre button then i m changing mousecursor to crosshair cursor( instancing and startdraging a moviclip from library) then user no-one movieclips event works.. I need that I can click on paper and able to draw rectangle. thankyou for help.
    you can download the file from here
    https://sites.google.com/site/amit0shakya/home/mousecursor-click
    amit shakya
    [email protected]

    change your code as:
    private function startDraw(event:MouseEvent):void
       crossCursor=new Mcursor()
       addChild(crossCursor);
       crossCursor.startDrag(true);
       crossCursor.mouseChildren=false;
       crossCursor.mouseEnabled=false;
       Mouse.hide()
       if(event.target.name=="rectangleMC")
        whichShape="rectangle"

  • HTTP Submit Button vs event.target.submitForm

    Dear All,
    I have a problem that looks like I would need some expert help to resove.
    I have designed a small Form with Acrobat LiveCycle Designer ES 8.2
    The plan is people to fill out the form and submit it to a script on a web page.
    Here is the problem.
    When I insert a regular HTTPSubmit button. Everithing is working just fine. All th fields are submited, and I can process them from there with my script.
    However, when I try to make a regular button and add javascript to the click event.
    event.target.submitForm({cURL: "http://mysite/myscript.php", cSubmitAs:"HTML", cCharSet:"utf-8"});
    The form is submited but non of the fields are.
    As an example output from REQUEST array in PHP.
    With the regular HTTP Submit button I get:
    Array
        [familyname] => 1
        [SubjectNumber] => 2
        [Site] => 3
    While with the above javascript I get:
    Array
        [form1] => Array
                [0] =>
    Looks like with the Javascript I somehow cannot submit the actuall fields.
    Finally, let me tell you the reason why I even want to use Javascript instead of the regular HTTP Submit button.
    My plan is so people can actually change the location where to submit the form.
    From what I read if I use a regluar submit button, the URL must be hardcoded and cannot be changed (selected, by the user dinamically)
    While if I use javascript then I can easily have a text field where people can enter the site where they want to submit the form and use it.
    Thank you very much for your help
    Please let me know if you need any further information
    Regards
    Tsvyatko

    Hey gays, thanks for answering.
    However, looks like I still have problems.
    When I insert a regluar HTTP submit button, it asks for the URL or it will give error.
    Anyhow, if I leave the URL setting blank, and try to execute the code u mentioned, I get a messege, "submit canceled" and nothing is happening,
    And if I enter something in the URL, looks like it still overites the code and submits the form the the hard coeded url.
    In addition, the regular submit button does not even allow me to enter code in the click even, so I did enterend in the mose in even,
    as to execute the code before the button is clicked.
    In addition I also tried to enter the even in a text field exit which I was hoping to use so the user can enter their own url.
    In other words.
    could please be more specific.
    On which even shown I enter the code.
    p.s.
    Finaly,
    in Form Calc
    If I enter this on the mouse enter of the button:
    form1.SCOPA_p2.HTTPSubmitButton1.event__click.#submit.#target = form1.SCOPA_p2.HTTPSubmitButton1_txt.rawValue;
    I get error accessor form1.SCOPA_p2.HTTPSubmitButton1.event__click.#submit.#target is unknown
    Any other thoughts
    Thanks
    Tsvyatko

  • Why can't I remove event.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.

    Well here is my class's code.  It's the last function that is causing me problems - remove bonus.  The bonus object is dispatching an event when it's y position is>390, so the event listener is working.  It's a problem with how am I trying to remove the bonus.
    I just tried casting it to no avail.
    package {
         import flash.display.*;
         import flash.events.*;
         public class GameScreen extends MovieClip {
              var paddle:Paddle;
              var ball:Ball;
              var bonusType:Array;
              var brick:Brick;
              var hitBrick:Brick;
              var level:Level;
              var levelNum:Number=1;
              var bonus:Bonus;
              var brickArray:Array;
              var hitTest:Boolean;
              var hitArray:Array;
              var bonusToBeRemoved:Bonus;
              public function GameScreen() {
                   setUpGame(levelNum)
                   //this.addEventListener
              private function setUpGame(frameNo:Number){
                   ball=new Ball();
                   paddle=new Paddle();
                   addChild(paddle)
                   paddle.x=300;
                   paddle.y=380;level=new Level(frameNo)
                   addChild(level)
                   addChild(ball);
                   this.addEventListener(Event.ENTER_FRAME,updateGame)
              private function updateGame(e:Event):void{
                   testPaddleCollision();
                   paddle.movePaddle();
                   checkBrickHit()
              private function checkBrickHit():void{
                        for(var i:int=0;i<level.numChildren;i++){
                             if(level.getChildAt(i) is Brick){
                                   brick=Brick(level.getChildAt(i))
                                       if(brick.hitTestPoint(ball.x,ball.y,true)){
                                            brick.noOfHits++
                                            hitArray=brick.respondToHit()
                                            if(hitArray["removeBrick"]){
                                                      level.removeChild(brick)
                                            if(hitArray["isBonus"]){
                                                      addBonus(hitArray["xPos"],hitArray["yPos"])
              private function testPaddleCollision():void{
                   if (ball.hitTestObject(paddle)){
                             ball.bounceOnPaddle(1); 
              private function addBonus(xPos:Number,yPos:Number){
                   bonus=new Bonus();
                   bonus.x=xPos
                   bonus.y=yPos
                   addChild(bonus)
                   bonus.addEventListener(Bonus.OFFSCREEN,removeBonus)
                   if(paddle.hitTestObject(bonus)){
                        applyBonus()
              private function applyBonus(){
              private function removeBonus(e:Event){
                   bonusToBeRemoved=Bonus(e.target)
                   removeChild(DisplayObject(e.target))

  • Event.target movieclip

    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)
    it will only recognize the click when it dosent intersect the dynamic textfield
    So i have to do:
    if(event.target==button1||event.target==button1.txt)
    do you have any explanation for why i cant only check if the target is button1? because the textfield is inside the button so normally it is considered as a part of it
    because the movieclip button1 is the container

    Use currentTarget instead of target.
    The difference between them is that target is the object that dispatched the event, while currentTarget is the object with the listener assigned to it.  Sometimes they are the same object, but target can often be another object within the object that has the listener assigned to it.
    If you would like an explanation/with examples...
    http://www.wastedpotential.com/?p=10

  • How do I use event.target.name in AS2?

    Thanks to kglad I was able to see how event.target.name in AS3 could make a button load a movieclip with the same namesake.
    I'm doing the same thing now in AS2 but don't know what to write instead of event.target.name.
    And so at the moment each button pushes info into an array and then a function uses that to decide which movieclip to attach to a holder after it has faded out once, and then fades in again...
    // ***** IMAGE GALLERY START ***** //
    // Add image to holder
    imgholder.attachMovie("img0", "image0_0", 1)
    // Array
    var nextLoad = ["img0"];
    // Btn listeners
    img5.onRelease = function() { trace (nextLoad); nextLoad.pop(); nextLoad.push("img5"); btnClick() } // Written on 1 line
    img4.onRelease = function() { trace (nextLoad); nextLoad.pop(); nextLoad.push("img4"); btnClick() }
    img3.onRelease = function() { trace (nextLoad); nextLoad.pop(); nextLoad.push("img3"); btnClick() }
    img2.onRelease = function() { trace (nextLoad); nextLoad.pop(); nextLoad.push("img2"); btnClick() }
    img1.onRelease = function() {
    nextLoad.pop();
    nextLoad.push("img1");
    btnClick()
    img0.onRelease = function() {
    nextLoad.pop();
    nextLoad.push("img0");
    btnClick()
    // The btn function
    function btnClick() {
    trace ("click");
    var myImgTween:Object = new Tween(imgholder, "_alpha", Strong.easeOut, 100, 0, 1, true);
    myImgTween.onMotionFinished = function() {
    fadeOutImg();
    // The btn function part II
    function fadeOutImg() {
    trace ("fadeOutImg");
    imgholder.attachMovie(nextLoad, "image1_1", 1);
    var myImgTween:Object = new Tween(imgholder, "_alpha", Strong.easeOut, 0, 100, 1, true);
    I know I should be able to push the button name into the array, but am having to use a string... I'm sure my code is cumbersome!! But it works. I've tried pushing the button name but it end up including the full stage reference.
    Is there a cleaner way of doing this using event.target.name?
    Thanks for looking!

    There is no event.target in AS2. However since AS2 has no way of remembering the scope object where the target object resides, you can use this to your advantage to retrieve the name of the target by using the "this" command in the function whenever you use the above format "mc.onPress = myfunc". FYI, the popular workaround Delegate, made it possible that when you called "this" in the function, you could retrieve the scope object where the target instance resides. So without its use, "this" will return the name of the target object. Anyway this is the code you can use:
    imgholder.attachMovie("img0","image0_0",1);
    var nextLoad = ["img0"];
    img5.onRelease = onImgRelease;
    img4.onRelease = onImgRelease;
    img3.onRelease = onImgRelease;
    img2.onRelease = onImgRelease;
    img1.onRelease = onImgRelease;
    img0.onRelease = onImgRelease;
    function onImgRelease():Void {
       nextLoad.pop();
       nextLoad.push(this._name);
       btnClick();
    // The btn function
    function btnClick() {
       trace("click");
       var myImgTween:Object = new Tween(imgholder, "_alpha", Strong.easeOut, 100, 0, 1, true);
       myImgTween.onMotionFinished = function() {
          fadeOutImg();
    // The btn function part II
    function fadeOutImg() {
       trace("fadeOutImg");
       imgholder.attachMovie(nextLoad,"image1_1",1);
       var myImgTween:Object = new Tween(imgholder, "_alpha", Strong.easeOut, 0, 100, 1, true);

  • AS 3.0 how to set event target?

    Hi,
    I am trying to execute an event on a specific target and I am
    not successful in doing this in AS 3.0 since event.target is read
    only. Here is the scenario:
    - I have a button and the path to this button is:
    DataEntry0._UpdateDeleteProd1.Form10.FormItem102.HBox103.Button104
    I know this because I did install a listener to and when I
    clicked I recorded the path.
    - I would like to execute a click programmatically on that
    path by just creating an event and setting the target to that
    button
    (DataEntry0._UpdateDeleteProd1.Form10.FormItem102.HBox103.Button104)
    however I don’t know how to set the target. Can anybody help
    or point me to the right direction so I can do this.
    Thanks…

    zoran,
    Sorry,I didn't explain what to do very clearly :).
    Básically, the event.taget parameter is set when you use the
    dispatchEvent function, so if you want an event to be dispatched
    from a Object you must call the dispatchEvent from this function.
    The line I gave you wont work by itself since I don't know
    how you reference
    DataEntry0._UpdateDeleteProd1.Form10.FormItem102.HBox103.Button104
    in your application.
    But what you need to do is call the dispatchEvent function in
    the Button104 object with the specific event you want to trigger.

  • What is Event queue problem?

    HI,
    I have come across JSF document, they mentioned that Event queue
    Problem ins SUN's JSF implementation. what is that?

    You're going to have to be a little more specific.

  • Using event.target.submitForm to submit a PDF and XML attachment in a single email.

    I have a button on a PDF form which emails a PDF and XML attachment of the current form in two seperate emails. The code is as follows:
    event.target.submitForm({cURL:"mailto:" +  "[email protected]" +"?subject="+"Request for action " + "&body=Please find attached..." ,cSubmitAs:"XML",cCharset:"utf-8"});
    event.target.submitForm({cURL:"mailto:" +  "[email protected]" +"?subject="+"Request for action " + "&body=Please find attached..." ,cSubmitAs:"PDF",cCharset:"utf-8"});
    This results in 2 seperate emails, when all I need is a single email with two attachments. Is there a way to do this?

    As far as I know you can only attach one attachment at once.

  • GUI event handling problems appear in 1.4.1 vs. 1.3.1?

    Hi,
    Has anyone else experienced strange event handling problems when migrating from 1.3.1 to 1.4.1? My GUI applications that make use of Swing's AbstractTableModel suddenly don't track mouse and selection events quickly anymore. Formerly zippy tables are now very unresponsive to user interactions.
    I've run the code through JProbe under both 1.3 and 1.4 and see no differences in the profiles, yet the 1.4.1 version is virtually unusable. I had hoped that JProbe would show me that some low-level event-handling related or drawing method was getting wailed on in 1.4, but that was not the case.
    My only guess is that the existing installation of 1.3.1 is interfering with the 1.4.1 installation is some way. Any thoughts on that before I trash the 1.3.1 installation (which I'm slightly reluctant to do)?
    My platform is Windows XP Pro on a 2GHz P4 with 1GB RAM.
    Here's my test case:
    import javax.swing.table.AbstractTableModel;
    import javax.swing.*;
    import java.awt.*;
    public class VerySimpleTableModel extends AbstractTableModel
    private int d_rows = 0;
    private int d_cols = 0;
    private String[][] d_data = null;
    public VerySimpleTableModel(int rows,int cols)
    System.err.println("Creating table of size [" + rows + "," + cols +
    d_rows = rows;
    d_cols = cols;
    d_data = new String[d_rows][d_cols];
    int r = 0;
    while (r < d_rows){
    int c = 0;
    while (c < d_cols){
    d_data[r][c] = new String("[" + r + "," + c + "]");
    c++;
    r++;
    System.err.println("Done.");
    public int getRowCount()
    return d_rows;
    public int getColumnCount()
    return d_cols;
    public Object getValueAt(int rowIndex, int columnIndex)
    return d_data[rowIndex][columnIndex];
    public static void main(String[] args)
    System.err.println( "1.4..." );
    JFrame window = new JFrame();
    window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel();
    Dimension size = new Dimension(500,500);
    panel.setMinimumSize(size);
    panel.setMaximumSize(size);
    JTable table = new JTable(new VerySimpleTableModel(40,5));
    panel.add(table);
    window.getContentPane().add(panel);
    window.setSize(new Dimension(600,800));
    window.validate();
    window.setVisible(true);
    Thanks in advance!!
    - Dean

    Hi,
    I've fixed the problem by upgrading to 1.4.1_02. I was on 1.4.1_01.
    I did further narrow down the symptoms more. It seemed the further the distance from the previous mouse click, the longer it would take for the table row to highlight. So, clicking on row 1, then 2, was much faster than clicking on row 1, then row 40.
    If no one else has seen this problem -- good! I wouldn't wish the tremendous waste of time I've had on anyone!
    - Dean

  • Attached corresponding image in mouse without using event.target.name in actionscript 3

    Hi,
    AS3:
    How to get general id (or) name from xml loaded images. bcoz, i want to drag and drop that images in generic method. Now, i currently used the event.target.name for each one.
    So, code length was too large. See my code below.
    /*********loading images through xml********/
    var bg_container_mc:MovieClip
    var bg_bg_myXMLLoader:URLLoader = new URLLoader();
    bg_bg_myXMLLoader.load(new URLRequest("xml/backgroundimages.xml"));
    bg_bg_myXMLLoader.addEventListener(Event.COMPLETE, processXML_bg);
    function processXML_bg(e:Event):void {
              var bg_myXML:XML=new XML(e.target.data);
              columns_bg=bg_myXML.@COLUMNS;
              bg_my_x=bg_myXML.@XPOSITION;
              bg_my_y=bg_myXML.@YPOSITION;
              bg_my_thumb_width=bg_myXML.@WIDTH;
              bg_my_thumb_height=bg_myXML.@HEIGHT;
              bg_my_images=bg_myXML.IMAGE;
              bg_my_total=bg_my_images.length();
              bg_container_mc = new MovieClip();
              bg_container_mc.x=bg_my_x;
              bg_container_mc.y=bg_my_y;
              ContentHead.addChild(bg_container_mc);
              for (var i:Number = 0; i < bg_my_total; i++) {
                       var bg_thumb_url=bg_my_images[i].@THUMB;
                        var bg_thumb_loader = new Loader();
                       bg_thumb_loader.load(new URLRequest(bg_thumb_url));
                       bg_thumb_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded_bg);
                       bg_thumb_loader.name="bg_load"+i;
                       bg_thumb_loader.addEventListener(MouseEvent.MOUSE_DOWN, bg_down)
                       bg_thumb_loader.x = (bg_my_thumb_width-18)*bg_x_counter;
                       bg_thumb_loader.y = (bg_my_thumb_height-45)*bg_y_counter;
                       if (bg_x_counter+1<columns_bg) {
                                 bg_x_counter++;
                       } else {
                                 bg_x_counter=0;
                                 bg_y_counter++;
    function thumbLoaded_bg(e:Event):void {
              var my_thumb_bg:Loader=Loader(e.target.loader);
             var sprite:Sprite = new Sprite();
              var shape:Shape = new Shape();
              shape.graphics.lineStyle(1, 0x0098FF);
              shape.graphics.drawRect(e.target.loader.x-2, e.target.loader.y-2, e.target.loader.width+4, e.target.loader.height+4);
              sprite.addChild(shape);
              sprite.addChild(my_thumb_bg);
              sprite.x=4;
              bg_container_mc.addChild(sprite);
              my_thumb_bg.contentLoaderInfo.removeEventListener(Event.COMPLETE, thumbLoaded_bg);
    //  get name for each image. 
    I want to change this code in generic method. do needful.
    function bg_down(event:MouseEvent):void {
              var bg_name:String=new String(event.currentTarget.name);
              var bg_load:MovieClip=event.currentTarget as MovieClip;
              if (event.currentTarget.name=="bg_load0") {
                      var alaska_mc:alaska_png=new alaska_png();
                       addChild(alaska_mc);
                       alaska_mc.x=stage.mouseX;
                       alaska_mc.y=stage.mouseY;
                       alaska_mc.name="alaska_duplicate"+alaska_inc;
                       alaska_inc++;
                       alaska_mc.startDrag(false);
                      alaska_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
                       alaska_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load1") {
                       var lake_mc:lake_png=new lake_png();
                       addChild(lake_mc);
                       lake_mc.x=lake_mc.mouseX;
                       lake_mc.y=lake_mc.mouseY;
                       lake_mc.name="lake_duplicate"+lake_inc;
                       lake_inc++;
                       lake_mc.startDrag(false);
                       lake_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load2") {
                       var mountn_mc:mountn_png=new mountn_png();
                       addChild(mountn_mc);
                       mountn_mc.x=mountn_mc.mouseX;
                       mountn_mc.y=mountn_mc.mouseY;
                       mountn_mc.name="mountn_duplicate"+mountn_inc;
                       mountn_inc++;
                       mountn_mc.startDrag(false);
                       mountn_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load3") {
                       var town_mc:town_png=new town_png();
                       addChild(town_mc);
                       town_mc.x=town_mc.mouseX;
                       town_mc.y=town_mc.mouseY;
                       town_mc.name="town_duplicate"+town_inc;
                       town_inc++;
                       town_mc.startDrag(false);
                       town_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load4") {
                       var water_mc:water_png=new water_png();
                       addChild(water_mc);
                       water_mc.x=water_mc.mouseX;
                       water_mc.y=water_mc.mouseY;
                       water_mc.name="water_duplicate"+water_inc;
                       water_inc++;
                       water_mc.startDrag(false);
                      water_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load5") {
                       var city_mc:city_png=new city_png();
                       addChild(city_mc);
                       city_mc.x=city_mc.mouseX;
                       city_mc.y=city_mc.mouseY;
                       city_mc.name="city_duplicate"+city_inc;
                       city_inc++;
                       city_mc.startDrag(false);
                      city_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load6") {
                        var citywide_mc:citywide_png=new citywide_png();
                       addChild(citywide_mc);
                       citywide_mc.x=citywide_mc.mouseX;
                       citywide_mc.y=citywide_mc.mouseY;
                       citywide_mc.name="citywide_duplicate"+citywide_inc;
                       citywide_inc++;
                       citywide_mc.startDrag(false);
                      citywide_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load7") {
                       var downtown_mc:downtown_png=new downtown_png();
                       addChild(downtown_mc);
                       downtown_mc.x=downtown_mc.mouseX;
                       downtown_mc.y=downtown_mc.mouseY;
                       downtown_mc.name="downtown_duplicate"+downtown_inc;
                       downtown_inc++;
                       downtown_mc.startDrag(false);
                      downtown_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load8") {
                       var powerlines_mc:powerlines_png=new powerlines_png();
                       addChild(powerlines_mc);
                       powerlines_mc.x=powerlines_mc.mouseX;
                       powerlines_mc.y=powerlines_mc.mouseY;
                       powerlines_mc.name="powerlines_duplicate"+powerlines_inc;
                       powerlines_inc++;
                       powerlines_mc.startDrag(false);
                      powerlines_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load9") {
                       var tropical_mc:tropical_png=new tropical_png();
                       addChild(tropical_mc);
                       tropical_mc.x=tropical_mc.mouseX;
                       tropical_mc.y=tropical_mc.mouseY;
                       tropical_mc.name="tropical_duplicate"+tropical_inc;
                       tropical_inc++;
                       tropical_mc.startDrag(false);
                      tropical_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load10") {
                       var waters_mc:waters_png=new waters_png();
                       addChild(waters_mc);
                       waters_mc.x=waters_mc.mouseX;
                       waters_mc.y=waters_mc.mouseY;
                       waters_mc.name="waters_duplicate"+waterthumb_inc;
                       waterthumb_inc++;
                       waters_mc.startDrag(false);
                      waters_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
    Please suggest me if any  one.
    Regards,
    Viji. S

    for each loader created, create a movieclip and add your loader to the movieclip.  assign all the properties you want to retrieve later to the movieclip and assign your event listeners to the movieclip.

  • How to check event.target type in "if" statement

    Hi, i have "roll over" event listener and i would like to that works only with MovieClips (without textfields etc.). I would like to write something like that:
    if(event.target == MovieClip){ do something }
    else { do something else}
    This doesn`t work properly.
    How to check type of event.target in "if" statement?
    Thanks for any help.


    if(getQualifiedClassName(event.target) == "flash.display::MovieClip"){ do something }
    else { do something else}
     .

Maybe you are looking for

  • Mysterious Free Space Issue

    Hello All, Not sure if this is in the right forum or not - but I'm having an issue with my MDD Power Mac G4. I have 23 GB of free space on the drive my OS is located on - the drive is just under 70 GB in all. Recently I've been having issues with fre

  • HT1349 Has anyone had issues with the iphone 4s and facebook.

    Has anyone had issues with the iphone 4s and facebook. I have downloaded the app and sometimes it will let me log in and then it will log me out and not let me back in. I have deleted and downloaded it several times and nothing is working. HELP!

  • Netui:select seems to be broken in Portal 9.2

    Hi I have problems with the tag and I slowly think it might be a bug in the tag. The optionsDataSource attribute seems not to work anymore. It only puts the actual text '{pageFlow._options}' in the dropdown box. I tried to use it with the pageFlow an

  • CD Cover Art Missing

    I am running iTunes on a Windows XP PC and have had to move my library to a new paprtition as the original was full.  Since then I have lost the majority of my CD covers (ca. 95% of them) and when I try to download them (right click on the entire alb

  • Error with Virtual Java

    Hi, Error is: Could not load the Java Virtual Machine. Eventid 4096 I have install Workflow 7, but after i use turnkey i got this error. I dont undertsand. I have also Jboss for adobe livecycle service failed to start. I'm using Jboss and mysql in tu