Place objects with the mouse in Flash CS4

Hi all

I played a bit more with Flash and down on something that I would like to learn more about.

I tried to do:

A scene. When I click on the left button of the mouse on the stage an object (from the library [chart]) will take place exactly where the mouse is located.

I didn't really know how to approach the issue, but try anyway.

This is my code:

stage.addEventListener(MouseEvent.MOUSE_DOWN, addApple);

Function addApple(event:MouseEvent):void{
          //I dont know what to put here to place an object(apple) from the libery
          //onto the stage where the mouse is.
};

My question is:

should what code I add to this code?

And or y at - there better ways to do it?

~ Thank you for your help in advance.

The object you want to duplicate must be a movieClip or button object that is in the library of the film and has the "Export for Actionscript" option set.  When you set this option, Flash will create a class name for this object. This is the name that you want to use in the code.

var libObject:Apple_mc = new Apple_mc()

libObject is the name of the variable that will contain the new instance of the object, you can use any name you like for this part. Apple_mc must match the class name of the original object that is in the library.

Tags: Adobe Animate

Similar Questions

  • 15 r007TX 15 HP laptop: HP laptop screen stays black with the mouse cursor flashing

    Hello

    Here I am facing probhlem. my laptop is started but screen stays black and a slider is binking on that...

    I just perform a clean boot and once I restarted my laptop and then I faced this problem...

    Please help me...

    I have laptop HP 15 15-r007TX with windows8.1 64 bit having 4 GB RAM with i5 4 genration processor with dedicated 2 GB and 1 TB of hard disk graphics card...

    Please help me...

    Thankss...

    Hi @Shawnfrost,

    Welcome to the HP Forums!

    This is a great place to find answers and information!

    You have the best experience in the HP forum, I would like to draw your attention to the Guide of the HP Forums Learn how Post and more

    I understand that when you start your laptop, you get a blank screen with a blinking cursor.

    Here is a link to help overcome this problem.

    Computers laptops HP - computer won't start (Windows 8)

    It can also help.   Laptops HP - computer will not start and the lights blink or the computer will beep.

    If you enjoy my guarantor please click on button below congratulations to say thank you.

    If it solves your problem, please click the solution in order to allow other people to find this information.

    Best of luck and have a great weekend!

  • Direct selection or the powered hand tool will not move object with the mouse! Frustrated!

    Since this recent update, I was not using my mouse to move an image, text, etc. I use CC2014 on my Mac, not working not Yosemite.

    I have already tried:

    Clicking on some keys when opening Indesign so it will clear preferences - did not work.

    Restarted my computer - will run for a few minutes then stops

    InDesign uninstalled and reinstalled - nothing

    Uninstalled full CC suite and ran CC cleaner - removed all instances of the Adobe folder on my mac, removed trash, restarted the computer, and reinstalled - there is nothing, same problem.

    I am really frustrated because I really don't want to use my arrow keys to move the items. All the solutions to get rid of this annoying problem?

    Thank you in advance!

    Try disabling Pushbullet.

  • All my objects in Indesign are locked. I can move objects with the help of the arrow keys on my keyboard, but not with the mouse. I must have done an order by mistake. Any suggestions?

    All my objects in Indesign are locked. I can move objects with the help of the arrow keys on my keyboard, but not with the mouse. I must have done an order by mistake. Any suggestions?

    Thanks for your help. I work again InDesign brokedown and after a reboot, everything works perfectly fine.

  • Does anyone know why illustrator did several objects when I click and drag? No key keyboard shortcuts; only with the mouse.

    When I make a square for example, click and drag with the mouse, it makes duplicate objects until I release the mouse click. How can I disable this feature? Thank you.

    Danopoly,

    How can I disable this feature?

    By unstucking the Tilde (~) key.
  • When I select a single object in a layer and try to move it with the mouse, everything goes with...

    I had this problem where I can't use the tool move with the mouse properly. I'll go and select an item on a layer and then try to move it with the mouse (move tool). I did this before and still do all the time on Photoshop on my other machines. However, on my laptop it will not work. I take the only object I want to go and the second I move, is by default moving each layer in my folder. The only way to get around is to use the arrows, but which becomes laborious and frustrating.

    Any ideas?

    Maybe you have enabled automatic selection? There is a checkbox for it just at the top of the interface.

  • What happened to the feature to get around on the artboard by pressing the space bar and dragging with the mouse?

    What happened to the feature to get around on the artboard by pressing the space bar and dragging with the mouse?

    cwalker,

    If it does not, it may be time for the list:

    Sometimes, (some) things may fail or stop working for no apparent reason. When (other) possible reasons/remedies do not work, it is perhaps a kind corruption (temporary or permanent), or even preference settings which disturbs, which can be cured with something on the following list put in place in order to provide a catch-all solution for otherwise intractable cases. It starts with a few easy suggestions and safe) 1 and 2) for cases less serious and goes two ways 3) and 4) to reset the default preferences (easily but irreversibly and more laboriously but more completely and also reversible), then follows a list 5) various other possibilities, and it ends with a complete reinstallation 6). If no other suggestion doesn't work, or if no other suggestion appears, you can start on the list and decide how to go or who can apply.

    The following is a general list of things, try when

    (A) the question is not in a specific file,

    (B) you have a printer installed, connected and turned on if it's a physical printer (you can use Adobe PDF/Acrobat Distiller as a printer by default without the need to have a printer on, of course you will need to specify when you really need print on paper), and

    (C) It is not caused by problems with opening a file from external media (see below).

    You tried/made some of them already; 1 and 2) are easier for temporary strangenesses and 3) and 4) specifically may be corrupted/inconvenient preferences); ((5) is a list in itself and 6) is the last resort.

    If possible / there is, you must record a current work first, of course.

    (1) close Illy and open again.

    (2) restart the computer (you can make up at least 5 times);

    (3) close Illy and press Ctrl + Alt + Shift / Cmd + Option + shift during startup (easy, but irreversible);

    4) move the folder (follow the link with this name) with closed Illy (more tedious but also more thorough and reversible), for CS3 - CC you can find the file here:

    https://helpx.Adobe.com/Illustrator/KB/preference-file-location-Illustrator.html

    5 look through and try the relevant among the other options (click on the link with that name, item 7) is a list of the usual suspects among other applications which can disturb and confuse Illy, point 15) applies to the maybe CS5, CS6 and CC);

    Even worse, you can:

    6 (A) uninstall (check the box to delete the preferences, if any), B) run the cleanup tool (if you have CS3/CS4/CS5/CS6/CC) and C) reinstall. It is important to use this step three way: otherwise, things may persist.

    http://www.Adobe.com/support/contact/cscleanertool.html

  • character controlled with the mouse problem

    I would like to make a game in which the character is controlled with the mouse exactly like this game: http://flashdo.com/item/asteroid-wave-game/1053/full_screen_preview

    I guess that the author simply used the code snippet that changes the cursor to an object. However, this causes a game to break the question; If the user makes the cursor off the screen flash and then come back somewhere else, the spacecraft will Warp to that location. Full screen, because the user cannot make the cursor off the screen, this problem does not occur.

    The code snippet using drag-and - déposer, when cursor the user comes out of the screen, the object did follow the borders of the screen Flash. However, given that the user has to hold the left button of the mouse and the cursor does not disappear, it is not very useful.

    Is there a way to control the character exactly as the game above, but when the cursor leaves the screen, make the character well follow the borders of the screen Flash like the drag and drop code snippet don't?

    Also, is there a way to make the box where the character can move smaller than the scene?

    Thank you very much.

    If you check the startDrag function, you will see that it provides the inclusion of the two arguments.

    startDrag (lockCenter:Boolean = false, limit:Rectangle = null):void

    The first is to have the cursor centered on the object or not, and the second is where you can specify a rectangle which limits the area of traffic allowing drag.  What to do in smaller just step specify a rectangle for your needs.

  • AS2 help, moving object to the mouse, click.

    Here is the code that I have, I know that these are the basic elements of wihc I need to use it, they work individually, but together they are not

    on {(press)
    this.startDrag ();
    }

    on (release) {}
    stopDrag();
    }
    }

    This += ._y this ._ymouse/4;
    This ._x += this ._xmouse/4;


    So what I try to do is to get the object to move more slowly than the mouse, but finish moving all over the place where I let go the click. So far, I can get the object to be moved with the mouse without clicking and dragging at a slow speed, but I can't get the drag to work at a slower speed, he moves as soon as the mouse moves. Can someone help me? Very much appreciated.

    {this.onMouseDown = function ()}

    {this.onEnterFrame = function ()}

    YourObject._x =. 5 * yourobject._x +. 5 * _xmouse;

    YourObject._y =. 5 * yourobject._y +. 5 * _ymouse;

    If (Math.ABS(YourObject._x-_xmouse)<><>

    delete this.onEnterFrame;

    }

    }

    }

  • Dragging points in the chart with the mouse

    Hello

    I would like to ask if any Graph control NOR for .net enables drag and shift the points on the graph with the mouse.

    Here's the simple example to describe what I'm thinking:

    If there is no such functionality, can be implemented and if it cannot, in such a way?

    a.h.

    Hello

    It seems that you may be heading in a different direction, but I thought I would offer my 2 cents.  One possibility would be to update the point in the data table based on the position of the mouse in the MouseMove callback and replot then data.  Although it may not fully satisfy all your needs, below is a simple example of how to proceed.  If all goes well, it may be of some use to you.

    partial class Form1: Form
    {
    xData private Double [] = {2, 4, 7, 8, 5, 4, 2};
    Private Double [] yData = {5, 8, 9, 6, 3, 2, 5};

    private int pointIndex;

    public Form1()
    {
    InitializeComponent();
    }

    private void Form1_Load (object sender, EventArgs e)
    {
    scatterGraph1.PlotXY (xData, yData);
    }

    Private Sub scatterGraph1_MouseDown (ByVal sender As Object, MouseEventArgs e)
    {
    xPoint double;
    Double yPoint;

    scatterPlot1.InverseMapDataPoint (scatterGraph1.Bounds, Object, out xPoint, out yPoint);
    This XYCursor is transparent in color and it is
    SnapMode has the NearestPoint value
    xyCursor1.MoveCursor (xPoint, yPoint);
    Cursor.Current = Cursors.Hand;
    }

    private void scatterGraph1_AfterMoveCursor (object sender, NationalInstruments.UI.AfterMoveXYCursorEventArgs e)
    {
    pointIndex = xyCursor1.GetCurrentIndex ();
    }

    Private Sub scatterGraph1_MouseMove (ByVal sender As Object, MouseEventArgs e)
    {
    xPoint double;
    Double yPoint;

    If (get_Cursor is Cursors.Hand)
    {
    scatterPlot1.InverseMapDataPoint (scatterGraph1.Bounds, Object, out xPoint, out yPoint);
    xData [pointIndex] = xPoint;
    yData [pointIndex] = yPoint;
    scatterGraph1.PlotXY (xData, yData);
    }
    }

    Private Sub scatterGraph1_MouseUp (ByVal sender As Object, MouseEventArgs e)
    {
    Cursor.Current = Cursors.Default;
    }
    }

    NickB

    National Instruments

  • Learn to draw with the mouse on Html 5 canvas inside the browser (using createJs).

    Hello world
    In Flash AS2/3, we can draw with the mouse in the browser (of course within the Flash Player). How can we do that in DC Flash Canvas using CreateJs (the result should be in canvas not in flash player). Something like this http://www.codicode.com/art/how_to_draw_on_a_html5_canvas_with_a_mouse.aspx
    Thanks in advance

    Here's the code if anyone is interested.

    form of var oldX, oldY, size, color;

    form is new createjs. Shape();

    stage.on ("stagemousemove", function (evt) {}

    If {(oldX)

    shape.graphics.beginStroke (color)

    .setStrokeStyle (size, "round")

    .moveTo (oldX, oldY)

    .lineTo (evt.stageX, evt.stageY);

    internship. Update();

    }

    oldX = evt.stageX;

    oldY = evt.stageY;

    internship. Update();

    })

    stage.on ("stagemouseup", function (event) {}

    color = createjs. Graphics.getRGB (50, 100, 150, 1);

    });

    stage.on ("stagemousedown", function (event) {}

    color = createjs. Graphics.getRGB (50, 100, 150, 1);

    size = 4;

    });

    stage.on ("stagemouseup", function (event) {}

    Color = "";

    });

    stage.addChild (shape);

    internship. Update();

  • Can not enter master password from the keyboard, but can copy with the mouse.

    I use gentoo and installation using portage. Firefox-31, 7 is fine, but firefox-36, firefox firefox-37-38 are cannot enter Masterpassword key, now I use firefox - 38.0.5,.
    When you create the user on this web site, password is can not enter key, so I copy with the mouse.
    I check if a new version is announced for portage (gentoo), check, but once firefox-36 can not enter password to key, even they seem.

    Note that Firefox uses its own storage of password (logins.json and key3db) and not the keychain Linux (hippocampus) application.

  • I can't get the tabs to work, opening with the mouse, cannot be closed only in groups that market

    I was obliged to upgrade of hate, has lost most of my applications, cannot get tabs to work, cannot change the tabs with the mouse, cannot close the tabs,
    UNLESS I go to the tab and then group I have a button close the tab or change the tabs but that is a huge pain. Yes, I opened
    tabs mix more and ticked all the boxes, closed, reopened, restarted nothing works

    Well, don't ask me why, but I logged in today and everything works
    don't know why or how but tabs suddenly works, so if anyone has this problem I don't know how to tell you to fix said WVREDNECK

    I was obliged to upgrade of hate, has lost most of my applications, cannot get tabs to work, cannot change the tabs with the mouse, cannot close the tabs,
    UNLESS I go to the tab and then group I have a button close the tab or change the tabs but that is a huge pain. Yes, I opened
    tabs mix more and ticked all the boxes, closed, reopened, restarted nothing works

  • How to scroll through the tabs with the mouse wheel?

    I used to be able to scroll the selection of tabs when the tab bar is filled using my wheel mouse (like the arrows on each side navigation), but recently it changes the tab I look as if I physically clicked on this subject.

    I'd appreciate help on how to make it work as he did.

    That should still work if you hover over with the mouse, the tab bar.

    Make the scroll buttons on the tab bar work?

    You have maximized the window of Firefox?

    Start Firefox in Safe Mode to check if one of the extensions (Firefox/tools > Modules > Extensions) or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox/tools > Modules > appearance).

    • Do NOT click on the reset button on the startup window Mode without failure.
  • Scrolling with the mouse on the pages to create black and white, lines

    When scrolling with the mouse, periodically the entire screen turns into black and white lines. Page sometimes together, sometimes just from ads pictures/side. If you continue to scroll disappear but you need to scroll to where the lines have begun, it's hard to explain, I took 1 picture of the problem but will have more photos that I can, I love how Firefox works on my computer, it has always been the best browser for my needs. I recently bought a new desktop computer, but he did so also, so I deleted and tried to launch the Explorer and Google and I don't like, so I hope that we can settle this problem.

    I don't know if it solved the problem, but he didn't precisely these days. Thank you

Maybe you are looking for

  • How can I find a missing file

    How can I find a missing file for microsoft office 2010 which has been installed on the pc when I bought it. the file is: C:\ProgramData\Microsoft\OEMOffice14\0Starter\en-US\WelcomeDocument.dotx

  • Help! Can consulted malware, what should I do?

    Hi all I tried to access my site work HR, but I must have mistyped the address of the site. Received a scary pop-up with beep sound. He warned me that my computer can be broken and call a 1-800 # to solve the problem. He also warned not not to turn o

  • BlackBerry BlackBerry Protect for BB Q10 Q10

    Dear all! How to install BlackBerry Protect in my BB Q10? Help, please! Kind regards! Nikolai

  • BlackBerry Smartphones import Contacts

    I would add 150 Blackberry users who do not have a desktop computers.  Only, they will send an email receipt with their phones Blackberry 8520.  Because I can not import Outlook Web Access contact, how can I import contacts with Blackberry Web Deskto

  • Request for linear interpolation

    HelloI have a table whose weekly instant cumulative value like this:value of type date2015-10-0112015-10-0882015 10-1522I want to make a query that returns data for each unique value date in the interval:date value REM2015-10-0112015-10-022interpolat