addition of mc library on the stage by using a binding name

Hello

I was about to ask this question, I'm glad this has been answered. However, in my project I need to add several instance of the class of dynamic library, I know how the AS2 way, can we elighten me with AS3 way, specifically with this new function addchild (movieclip)?

Thank you!

First check if you have given the instance name of the button as "mc" in your myMovieClip.

Then enter your code even

myMovieClip.mc.addEventListener (MouseEvent.MOUSE_DOWN, showans);  You can also write a CLICK event...

In showans, you write like this.

function showans(e:MouseEvent):void

{

e.currentTarget.parent.atext.visible = true;

}

Tags: Adobe Animate

Similar Questions

  • I need to remove an item from the library to the stage

    At this moment I have a button that brings a symbol from the library to the stage. Ideally, I want to be able to click on the symbol itself to make the scene. Can someone help me with this?

    for example:

    var sym:WhateverClass = new WhateverClass();

    sym.addEventListener (MouseEvent.CLICK, clickF);

    function clickF(e:MouseEvent):void {}

    e.currentTarget.parent.removeChild (e.currentTarget);

    }

  • Elements of library on the stage

    I have tomatoes in the library named 'tomato01' through 'tomato07 '.  I have a table with all these names in it.  I have a random function this pictures one of these names at a time.  Then, I want to be able to place this specific tomato on the stage.  EX if the random number is 7 it would tomato07 on the scene at a specific location and size.

    All elements of the tomato in the library have ot have the same class as him are assigned?  So I don't know about the code.

    Can anyone help?

    This is the code I have for now, but it doesn't do a specific tomato. Thanks in advance.

    CODE:

    var tomatoArray:Array is ['tomato01', 'tomato02', 'tomato03', 'tomato04', 'tomato05', 'tomato06', 'tomato07'];.

    var randomNumber:Number = Math.floor (Math.random () * tomatoArray.length) + 0;

    trace (randomNumber);

    trace (tomatoArray [randomNumber]);

    function Main()

    {

    var newTomato:TomatoSample = new TomatoSample();

    this.addChild (newTomato);

    newTomato.x = 25;

    newTomato.y = 45;

    }

    Main();

    If you want to be able to load one of tomatoes from the library, they each need to have your title of single class, Tomato01, Tomato02, etc...

    If you want to use a string to instantiate an instance of the class, then you need to use code such as...

    var ClassRef: Class = Class (getDefinitionByName ("className"));

    var classInstance: * = new ClassRef();

    addChild (classInstance);

    where "className" would be Tomato01, Tomato02, etc...

  • Randomly generate movieClips from the library onto the stage

    Hello

    I'm calling the objects from the library for a collection set.

    Major problems with how best to attribute the good and bad objects update later a score.

    Can anyone help me how can I first assign the clips in the library in an array of good and bad and then after randomally fill the stage with them.

    Concerning

    James

    see you never fake in your output panel, when using:

    public void placeWords() {}

    random location

    var x: Number = Math.floor (Math.random () * mapRect.width) + mapRect.x;

    var y: Number = Math.floor (Math.random () * mapRect.height) + mapRect.y;

    check all blocks to see if it's over everything

    var isOnBlock:Boolean = false;

    for (var j: int = 0; j

    If (blocks [j].hitTestPoint(x+gamesprite.x,y+gamesprite.y)) {}

    isOnBlock = true;

    break;

    }

    }

    not on everything, so use location

    trace (isOnBlock);

    If (! isOnBlock)

    {

    var goodObjects:Array = ["WordObject1"];

    var badObjects:Array = ["WordObject2"];

    If (Math.Random)<>

    {

    var r: int = Math.floor (Math.random () * goodObjects.length);

    var classRef: Class = getDefinitionByName (goodObjects [r]) in class;

    var newObject:MovieClip = new classRef();

    newObject.typestr = "good";

    } else

    {

    r = Math.floor (Math.random () * badObjects.length);

    classRef = getDefinitionByName(badObjects[r]) in class;

    newObject = new classRef();

    newObject.typestr = "bad";

    }

    gamesprite.addChild (newObject);

    newObject.x = Math.floor (Math.random () * stage.stageWidth);

    newObject.y = Math.floor (Math.random () * stage.stageHeight);

    break;

    }

    }

  • How can I view a clip from the library onto the stage in AS3?

    Hello

    I have a clip in my library and I want to display on the stage using AS3.

    what I define as a variable? Do I need to use this code: addchild (movieclip);

    can I use the 'x' and 'y' to position?

    What the code would look like?

    Ben.

    Steps to follow:

    1. Click Moviclip library and click on: link...
    2. Check the box export for ActionScript.
    3. Assign to the class "mov_clip".
    var movie:mov_clip = new mov_clip;movie.x = 50;movie.y = 50;addChild:(movie);
    
  • Installation of connectors of the IOM by using a different name.

    Hello


    In my environment of IOM, I have two target resources which are directories of Sun.

    In my env IOM, I installed a 9.0.4.12 connector SJSDS (version of IOM is 9.1.0.2). The output of the connector box names all artifacts IOM using the convention IPLANET or IPNT (UD_IPNT_USR, adpIPLANETMODIFYUSER, etc.).

    Since I want two instances of this connector, I need to use a different name. To customize this name that I need to change the xml (iPlanetResourceObject.xml, iPlanetXLResourceObject.xml) files? Seems very tedious and prone to error.

    Is that what someone does that, you can share your experiences.

    Thank you
    Sunny

    This is a very common method to enable support of multiple areas AD (with different numbers).

    It is tedious and prone, but this is the simplest way to achieve this. You should consider writing some XSLT to automate parts of the process.

    Best regards
    / Martin

  • Part of the library to the stage

    I have a library called tomato and element AS a link called tomatoPieces.  I'm trying to get to add the item to the scene and then randomally move the item.  Here's the code so far but the problem, it seems if stop add the method addEventListener onstage.  I should be grateful if you would help or direction. Thank you...

    import flash.display.Sprite;

    import flash.display.MovieClip;

    import flash.events. *;

    var newX:Number = 0;

    var newY:Number = 0;

    var speed: Number;

    var speedX:Number;

    speedY var: number;

    var totalDistance:Number;

    var previousDistance:Number = 0;

    var currentDistance:Number = 0;

    main() function

    {

    for (var i: Number = 0; i < 9; i ++)

    {

    trace (i);

    var parts: tomatoPiece = new tomatoPiece();

    pieces.scaleX =. 25;

    pieces.scaleY =. 25;

    addChild (pieces);

    trace (this.) AddChild (pieces). (Name)

    tomatoPieces();

    }

    }

    function tomatoPieces()

    {

    trace ("listener configuration");

    addEventListener (Event.ADDED_TO_STAGE, Setstage);

    }

    function Setstage(event:Event):void

    {

    trace ("Setup");

    This.x is this. GetRandomXPosition();

    This.y is this. GetRandomYPosition();

    Speed = Math.round (Math.Random () * 5 +.5);

    this.addEventListener (Event.ENTER_FRAME, MoveCircle);

    }

    function GetRandomXPosition (): number

    {

    //

    basic formula: Math.floor (Math.random () *(1+High-Low)) + low;

    //

    return Math.floor (Math.random () * (1 + (stage.stageWidth + this.width) + this.width)-this.width);

    }

    function GetRandomYPosition (): number

    {

    //

    basic formula: Math.floor (Math.random () *(1+High-Low)) + low;

    //

    return Math.floor (Math.random () * (1 + (stage.stageHeight + this.height) + this.height)-this.height);

    }

    function MoveCircle(e:Event)

    {

    this.previousDistance = this.currentDistance;

    this.currentDistance is this. GetDistance();

    If (this.currentDistance < this.previousDistance)

    {

    This.x += this.speedX;

    This.y += this.speedY;

    }

    on the other

    {

    This. SetNewPosition();

    }

    }

    function GetDistance (): number

    {

    return Math.sqrt (Math.pow(this.x-this.newX,2) + Math.pow (this.y - this.newY, 2));

    }

    function SetNewPosition()

    {

    this.newX is this. GetRandomXPosition();

    this.newY is this. GetRandomYPosition();

    this.totalDistance is this. GetDistance();

    var time: Number = this.totalDistance / this.speed;

    speedX = (this.newX - this.x) specifying;

    Fast = (this.newY - this.y) specifying;

    }

    It's what I expected.  If you want to move the pieces you need to target the pieces, not the main timeline.  Everywhere you use "it" will target the main timeline, not pieces.

    If you were to move all this code placement and movement within each room, then it would be better to use 'this' for the code.  Who would also make more sense for the ADDED_TO_STAGE listener that you have implemented earlier. It is a way to solve this problem.  After you create each piece you let each piece handle his own movement by having this code within each.

    Another way to handle it would be to store references to the elements in an array and has the movement function loops through the Bay to move each piece one after the other.

  • Flash cs4 nothing visible in the library or the stage, but can be seen in swf

    Hello

    I'm not sure what I've done - graphic symbols, text are visible in the swf but not on stage, in the workspace or in the library.  I wonder if I have accidentally reset something. I tried to import an .ai graph in a file in flash cs4 when it happened first - graphics is not visible in the workspace, but could be considered in swf. Now, I don't see anything in any flash file I open even those who have been very well before.  Workspace just blank and empty when library window select symbols in the library. If I try to get something, or insert text, it disappears as soon as I switch to the selection tool, but is not visible unless I look at the SWF (control-enter). Please help - much appreciated!

    The project window is just a blank white square in the workspace of developer too.

    I've sorted it.  For anyone else having the same problem, here's how:

    http://code.Google.com/p/flashbug/issues/detail?ID=34

  • How to successfully deploy a library shared the ADF?

    I have created a library that depends on the length of JSP, JSF 2.0, ADF Model DURATION etc., JSTL 1.2. When I try to use a class of this library in an application, (I added a ref library to weblogic application. The app XML) I get the following error:

    >java.lang.NoClassDefFoundError: org/apache/myfaces/trinidad/model/RowKeySet

    How am I supposed to properly deploy my library / specify dependencies, so that weblogic server might find them? MANIFESTO. MF in the container of the library, made by JDeveloper, contains only the manifest-Version headers and hand-Class.

    Under subsection 38.2 in the Guide Oracle® Fusion Middleware Fusion developer Oracle Application Development Framework 11 g Release 2

    > If you are packaging a component with dependent jars, such as third party jars, you have two options:

    > 1. If the environment of your exercises control over the placement of the jars, you can place the ADF library JAR and its dependent jars in a JDeveloper Extension Library. The advantage of using a > JDeveloper Extension Library, it is that they do not clutter your project with specific references to the dependent jars.

    > 2. If using Extension Library JDeveloper is not possible, you can place the dependent jars in the same location as the ADF library JAR and include an entry manifest classpath for each person dependent > JAR.

    I hope that I don't need to include all the pots to jsf/adf/bc4j in the container in my library, I do?

    Well, I finally managed to make it work. You need a war with the shared library jar under WEB-INF/lib, and then reference it in the application weblogic.xml.

  • Flash CC: access a specific object on the stage

    I'm writing the javaScript code to execute with Flash CC.

    How can I access a specific object on the stage? It has a name (square_sym), but I can not read the code. What should I do?

    TIA

    He needs an instance name.

    If there is not a button or a movieclip, right click on the object > click on convert to symbol > select movieclip > ok > in the properties panel, enter an instance name, for example square_mc.

    then on the timeline that contains the button or movieclip you can use:

    This.square_mc to reference the movieclip.  other chronologies, there are also pointers to reference the movieclip

  • The surface provides a xbox profile name if you do not already have one? I can't understand where mine came from.

    In the application of games on the surface, it uses a profile name I don't recognize. I can't know if one of my children entered or if the surface/Microsoft/xbox has provided a default profile name.

    Check here, good forum contact

    http://support.Xbox.com/en-us/apps/Windows-8/Windows-8-FAQ

  • MC library at the onRollOver stage loading

    I do not know what commands to use to get there, but I would like to be able to temporarily replace (essentially "swap symbol") an MC on the stage ( stage_mc) with a same size library ( libary_mc) MC on a MC ( rollover_mc).

    I used orders loadMovie or loadClip to pull in the .swf files from the server or even images .jpg of the library, but for some reason that I can't ActionScript refer simply to a MC that is located in the library.

    I change rollover_mc to a button and insert the library_mc on the framework "Over", but rollover_mc is animated and I library_mc stay stationary.

    It even will not be enough to charge me library_mc ON stage_mc if replacement or Exchange outside isn't an option.

    Any suggestions?

    Use the movieclips attachMovie() method.

  • The addition of new widgets in the library of Muse

    Hello

    I would use multiple widgets of the Muse Gallery for my sites.

    http://Muse.Adobe.com/Widget-Manager

    I downloaded, but how to I incorporate into the site? I just want different photo and video galleries.

    I thought I should add new widgets in the library of Muse, but I don't know how to do this.

    How one does a Widget of Muse, which does not exist in the pre-filled library?

    Thank you

    Muse, you cannot add widgets personalized to the library at the moment. To use a widget, you have downloaded you must open the .muse, select the widget and copy/paste to your project. Then you can modify it according to your needs.

    Francesco

  • Addition of the movieclips on the stage

    I have 2 clips in the library exported as a category d1 and d2, I want to add to the scene by using something like the code below.

    This does not work, but you can understand what I want to do. What is the correct syntax?
    Thank you!

    You want something like this:

    for (var i = 1; i)< 3;="">
    var classDefintion: Class = getDefinitionByName ("d" + i) as class;
    var instance = new classDefintion();
    instance.x = 40 * i;
    addChild (instance);
    }

    --
    Dave-
    www.offroadfire.com
    Developer leader
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.Adobe.com/communities/experts/

  • Unable to choose "iCloud library" after the restoration of Mac

    Hello everyone, this is my first time, ask a question here.

    I have a MacBook Pro with a library of 57 214 (317 GB) photos stored on an external hard drive. I recently downloaded all these photos to iCloud library (it took 5 days!) but just yesterday, I had to do a clean OS install. Since then, I tried to implement the pictures once again.

    My library on the hard drive is set as the system library, but when I select 'iCloud photo library' with the option ' download originals of this Mac ", it selects, then begins to download, it cancels the. If I try to select it again, the same thing happens.

    Two minutes later...

    Can someone tell what I can do? Should I remove the pictures from the cloud and try again?

    The problem may be that the free storage is not enough to download all original icloud in addition to the pictures already in your library.

    It might be easier to download the library of iCloud to an empty library instead of download the. library again.

    Do you have plans in your photo library, you need to save or invested a lot of work by naming the faces?

    Otherwise, move your existing photo library to an external drive as a backup copy, then remove the library of your internal drive.

    • Launch of Photos with the options key held down to bring up the library Chooser Panel.
    • Select this option to create a new library.
    • Make this new library your system photo library and activate iCloud.  Your photos and albums will begin to download. It will be faster than the download. Once again and the merger of the two libraries.

    But the download will not restore the named faces and not projects. IF you keep the original library to access your projects and have a reference for the faces that he will have to restore.

Maybe you are looking for

  • Problems with the sound function and scrolling on the touchpad on my Satellite A500/026

    Hello I just brought a new laptop A500/026 and when I play music from my ipod I get a little static pop sound at regular intervals during the song... this happens on all my music. I accidentally scroll horizontally through my touhpad and my screen mi

  • Installation stopped with App '?

    "El Capitan" running I tried to install some apps on the app store. It seems so, interrupted the installation and I find myself with a "?" as a symbol for applications that will not run. The app store shows that it is installed and I must be able to

  • ODS-D55U help

    Hello I use this unit for a few months now and seems to be going pretty well. However, I came across a stumbling. I am trying to save this work to a little more than 1 files to. I have a 1 TB drive and he does not want to start the copy. I get an err

  • Programmatically determine the version of LabVIEW for a VI/control

    Hi all Given the path to control of VI / I want to get the version in which it is the last record. Is it possible to do? I do this to identify all of its dependencies - programmatically by adding to a project and getting his list of dependencies by u

  • Hi, my Aspire E15 completely off when the charger is out. Does not start without power cord

    I have an Aspire e15 start ES1-512-C5YW which I brought last Monday and it was all fine until yesterday whn the power cord came out pf the socket and wull no longer work on battery. I have two acer power cords and it happens with both of them, but th