How to target the movieclip on the stage of cutom class

This is the code and the clips are target1_mc & target2_mc

package {}
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.text.TextField;


public class recipeMC extends MovieClip {}

private var startX:Number;
private var startY: Number;
private var counter: Number = 0;


public void recipeMC() {}
this.mouseChildren = false;
this.buttonMode = true;
this.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
this.addEventListener (MouseEvent.MOUSE_UP, dropIt);
}
private void pickUp(event:MouseEvent):void {}
this.startDrag (true);
this.parent.addChild (this);
this.x = startX;
startY = this.y;

}
private void dropIt(event:MouseEvent):void {}
this.stopDrag ();

If (this.hitTestObject (target1_mc)
|| this.hitTestObject (target2_mc)) {}
this.removeEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
this.removeEventListener (MouseEvent.MOUSE_UP, dropIt);
this.buttonMode = false;
This.x = myTarget.x;
This.y = myTarget.y;
counter ++;
} else {}
reply_txt. Text = "Try Again!";
This.x = startX;
This.y = startY;
}

}
}
}

If target1_mc, for example, is on the main timeline (and this instance of the class is added to the display list), use:

MovieClip (root) .target1_mc

Tags: Adobe Animate

Similar Questions

  • How to set the stage (or the background in the stadium?) to be transparent?

    How to set the stage (or the background in the stadium?) to be transparent?

    Thank you

    Gary

    Select the scene.

    Color sample

    Then set the Alpha slider to 0.

    .

    Darrell

  • How to target the buttons that are nested by 2 levels and one more thing...

    OK I'm going.  The link below, this is what I deal with

    http://clienttestsite.X10.MX/beta/garage.swf

    The garage door has a chevrolet logo that is thrilling. I know not how to make buttons but I need the garage door to become a button when you click on the animation plays instead of playing automatically.

    The upper part of the chest of the tool will be a button that plays the animation backwards and the drawers are the buttons that open to an e-mail for each form.  But I do not know how to target those buttons because they are nested two levels below the main timeline.

    In the case where he changes the way to proceed, once completed this film will be imported in another.

    Help, please!

    Thanks in advance.

    As long as the object that you want to make clickable is an object with an instance name (movieclip, button, etc.) you can make it work like a button.  If you know how the code for the buttons, then this should be everything you need to know to make the garage door a clickable object.

    Target buttons that are nested you can use the point rating to target... Since you did not identify the details of nesting, here's how it goes mainly...

    Toolchest.Drawers.drawer1.addEventListener(...etc)

  • External SWF dynamic text box.  How to target the area of text in AS3?

    Hello... I am loading an external file in a master file. Load the external file into an empty clip that is located on the stage of the main file. This external file that is loaded has a dynamic text box that I am trying to target using AS3.


    The way he did in AS2 has emptyMovieClipName.textBoxName.text = "whatever" "


    I tried to focus my text box using this same code, but it does not work in AS3 environment.

    Clues how proceed in AS3 would be appreciated!

    Thank you...
    Brenda

    you load not in a vacuum. you are attaching a child magazine empty and property content loader is the main timeline of your external swf.

    Here's how you need to reference your textfield in your external swf file:

  • How to target the individual in creationComplete

    Greetings,

    I have created a symbol and an attached creationComplete event and that I created a function called init() and init I am trying to use jquery to set the opacity to 0 but hard time targeting the example I've tried

    does not work

    SYM.init = function() {}

    $(sym.getSymbol (this)) .css ("opacity", '0' ");

    }

    does not work

    SYM.init = function() {}

    $(this) .css ("opacity", '0' ");

    }

    Any help? Thank you

    Hello

    SYMgetSymbolElement(). CSS ('opacity', ' 0');

    And it's done.

    This means that sym.init = function() {} is not mandatory.

  • To access the display object on the stage of another class

    I Googled that nothing helps, I only found how to manipulate the scene itself and not a display on that object and I'm noob enough to not be able to figure it out from there. :/

    I have a clip on the main timeline with the instance name displayName. I created a button that should change this framework displayName will to (in order to... makes you guess? display the name of the button.) Awesome. )

    So, I'm trying to write the code in a reusable manner and have everything related to a class called GeoPuzzle buttons. Inside the GeoPuzzle I instantiate a touch event and run code. However, the function should be able to change displayName in the main part of the timeline and, of course, the compiler says displayName does not exist because I'm in a class and I don't mean the scene.

    Here's the code simplified in the class:

    package com.freerangeeggheads.puzzleography {}
    import flash.display.MovieClip;
    import flash.events.TouchEvent;

    SerializableAttribute public class extends MovieClip {} GeoPuzzle
    declaring variables

    public void setInitial (abbrev:String, fullName:String, isLocked:Boolean): void {}
    Set the parameters
    this.addEventListener (TouchEvent.TOUCH_BEGIN, geoTouchBeginHandler);
    }

    public void GeoPuzzle (): void {}
    }

    public void geoTouchBeginHandler (e:TouchEvent): void {}
    e.target.addEventListener (TouchEvent.TOUCH_END, geoTouchEndHandler);
    other methods
    nameDisplay.gotoAndStop (e.target.abbrev);
    }

    public void geoTouchEndHandler (e:TouchEvent): void {}
    other methods
    nameDisplay.gotoAndStop ("USA");
    }
    }
    }

    The lines in bold are my problem. Now this code does not actually as it is the case if you find an error in it, Yes, I have no idea what the problem is, but he DID run forward and these lines always gave me wrong so I'll try to help out on multiple fronts.

    How can I say displayName to change its current image within the display object class?

    Thank you!

    any display list object can refer to any display list object, but this is not necessarily good OOP.

    in any case, for your class reference displayName:

    . DisplayName MovieClip (this.parent)

  • How to get the name of a class private data controls?

    How can I get the names of the controls within a class private data?

    I use the framework of the actor and try to create a tha method will be executed when run the actor. This method should an o list all names of control inside the data class to find the initial value within a configuration file (config.ini file), the key to the configuration file will be the name of the control.

    Thank you.

    You already do the substitution method just because you write for the bundle by name.  And then how are you going to respond to all types of data might be the key.  You do more difficult things that it takes to really very few benefits.

  • How to change the default editor (IDE) class?

    How to change the default editor for my custom IDE (IDE) class (in this case it is FlashDevelop)?

    Options by default in preferences > Script files are only Animate and Flash Builder.

    Thank you!!

    Those are the only options available to animate, unless someone in the community has done something to customize this feature.

  • What should I do to the stage of a class?

    I have a class that puts objects on stage with addChild (obj), it allows to position myself objects using pixels (say obj.x = 10; obj.y = 50 ;) very well but if)

    I have try this: obj.x = stage.stageWidth / 2;  I get a message that I can not access a property or method of a null object reference

    The stage property is available for objects that are currently on the display list. Your best bet is probably to pass a reference of the scene to the class when you instantiate.

  • find the width of the stage of a class

    I know that this should be simple, but for some reason, it does not...

    I want to create a 'Square' class that will automatically bounce back on the "walls" (edge of the stage), so he needs to know the dimensions of the stage to do this. But using of Stage.stageWidth or one of a dozen other things I've tried just does not work.

    The error I get is:
    TypeError: Error #1009: cannot access a property or method of a null object reference.
    to Square()
    at SquareTest()
    My code is less to-if anyone can help, that would be much appreciated!

    Its Stadium, no stage
    stage.stageWidth

  • How to target the element of the main stage of in a symbol

    I have a symbol where I want to put an action click here to do something to another item on the main stage, how can I do this?

    Check out my tutorial here:

    Targeting of the symbols: discovering the mystery l EdgeHero

    This was made with a previous version of Animatebut the principles still apply.

    In addition, if you use the snippet window, it will give you good scope.

  • How to run the stages of synchronously in Teststand?

    Hi all

    I want to run a few steps synchronously, such asno step for affecting some conditions to DUT input, and a step for a few tests of measurement points under the conditions.and of the measurement is in real time.

    So I would like to know if this function can have do this.and how to do.

    Thank you.

    BR

    Johnny

    Hey Johnny,

    Here's a simple example in TS 4.1.1.  I would use a Rondezvous.  You simply create the Rondezvous with 2 threads.  Then spawn you a sequence in a new thread (Set DUT).  Inside of there, you have a step value Rondezvous Rondezvous.  Then another called sequence acquire data with a step of Rondezvous value Rondezvous.

    How works the Rondezvous is that first create you and set the number of threads.  Then TestStand expected at each stage of the Rondezvous he meets until the number you have set has been encountered.  Be careful because you may have a condition where you can't meet enough steps Rondezvous.  In this case you can set the time-out period to it will just continue or terminate if they are never met.

    I hope this helps!

  • How to change the stage width and height at run time?

    stage.stageWidth = 700;

    but it doesn't work.

    Thank you

    You must also change your html code.  That is to say use externalinterface and javascript.

  • (Question LVOOP) How one access the data of another class in another class?

    Hello-

    Ass title suggests, how do I access another class (or is it class?) data from another (different) class?  I will attach a picture showing where my problem is...

    I was told this:

    http://zone.NI.com/reference/en-XX/help/371361H-01/lvhowto/setting_scope_classes/

    May contain some helful info, but I can still understand how to unbundle Renault of classes inside the component class data (as seen in the attached photo).

    I think there could be something simple I'm missing here when it comes LVOOP or OBJECT-oriented programming in general... If any of you are willing to help me, it would be much appreciated!

    Thank you!

    -pat

    Personal data are always private, you can never set public. Unbundle cluster function can be used only on the thread of class when he is in the class. If you need to access private data, you must create accessors.

    It of simple, just the class right click and select new, VI for access data members. He invites you to a dialog box to fill you with what you want to create, elements of data and if you want them available through property nodes (recommended). Once completed, this will generate the Afterward screw., you can use in any other VI. The nice thing about making them nodes of property is that you can plop down a property node and it thread class, and all the created accessor functions will appear in the list.

  • Target the scene and add < iframe > go inside symbol?

    Having trouble again. I'm SLOWLY the CC thing use 2014 =).

    Now, I need to be able to target a symbol on the stage of inside of an element inside a symbol and add it with an < iframe > and move the iframe attributes.

    I have a file - please see the stock symbol and whitewater1.click and whiteawater2.click videoui in this symbol (link below (drop box)

    Here's what I have so far...

    Insert the code for the mouse, click here

    Go on a label or a specific time and stop. For example:

    SYM. Stop (500); or sym.stop ("myLabel");

    SYM. Stop ("videotwo");

    Change the text in an element

    SYM. $("télétexte") .html ("video to: TheNigglesbear");

    var youtubevidtwo = $("< iframe/>");

    sym.getComposition () .getStage ().getSymbol("vcontainer").append (youtubevidtwo);

    youtubevidtwo.attr('type','text/html');

    youtubevidtwo.attr('width','616');

    youtubevidtwo.attr('height','347');

    youtubevidtwo.attr ('src','http://www.youtube.com/embed/eqzwoIQseyA?rel=0'); / / url/Video_Id

    youtubevidtwo.attr('frameborder','0');       // 1 | 0

    youtubevidtwo.attr('allowfullscreen','0');   // 1 | 0

    This same code - with different path for symbol of course-works fine on the document.compositionReadyscene, but don't know how to target the videoui and add the iframe and its attributes from inside another symbol.

    Help please - it should really be more ADVANCED examples of possible targeting methods. I find a lot on the targeting of the symbols inside symbols, or stage of symbols, but not much about the symbols on stage for another symbol on the stage.

    Thanks in advance.

    Dropbox - videoPhotoUI.zip

    Note that vcontainer is not a symbol instance, so in whitewater2 click Manager you need to change the code at line number 11 of:

    $.getComposition () .getStage () .getSymbol ("vcontainer")

    for the following:

    sym.getComposition () .getStage (). $("vcontainer")

    It will Add an iframe that is new to the container, however, if you need to replace the old with the new video, you can try the following:

    container var = sym.getComposition () .getStage (). $("vcontainer");

    Container.Find ("iframe"). Remove();

    Container.Append (youtubevidtwo);

    I hope this helps.

    DIA-

Maybe you are looking for

  • Cannot send Mail from Gmail in Thunderbird

    I downloaded Mozilla Thunderbird, is the most recent version. I can receive mail, but cannot reply or send. I use a Mac mini, Mac OS X 10.10.1. A screenshot with the error code is attached. Help is very appreciated! -Jon

  • Satellite L850 wake up

    I put the L850 in hibernation, came back later and he doesn't wake up. Tried to remove the power and battery and pressing the power button for 30 seconds to drain, then replace battery and power, but the same thing happens. Just seeing battery, light

  • No NOR-DAQmx eligible simulation device

    Hi all I am developing an application for a PXI-6132, but I don't have the equipment yet, so I would like to start this with a simulated device, unfortunately when I'm at MAX, I see no device at all to choose, so I was wondering what I can do and I c

  • I'm trying to migrate from Windows 2000 to Windows XP, with all updates.

    original title: sharing fails file of Windows XP Home edition I'm trying to migrate from W2K to Windows XP Home edition (Pro/SP3 with all current updates from today ' hui).  My network has several computers with the help of a working group.  I notice

  • Windows 7 folder sharing - Windows credentials

    C - Windows 7 Professional, shared server drive Network - consists of 5 Windows 7 Pro computers and 1 Server Windows 7 Pro Network and computers working great until a hard disk on a workstation failure.   New hard drive.  Re-install of OS Windows 7,