Problem with Click listener on the Sprite instances

Hi all

I am a beginner in Flash and ActionScript 3.0 platform. I don't know how and where post such queries/problems. So far, here, I posted a simple questions only. I feel that the complex problem I ever worked until now.

Come to my request, I am dynamically load an image on stage. When I click on the loaded image, I'm drawing of a circle/rectangle [which is of type Sprite] pixel-exact location on the image and doing these circles/rectangles (Sprite_objects) visible itself. In this way, I would add as many Sprites_objects, until I keep clicking on the same image present on the stage.

My application code (which displays the colorful red rectangles when you click on the image) is as follows:

/ * If you copy the code into your actionsPanel directly, then make sure "image1.jpg" file * is present next to the .fla file. Since he gets support iff it is present in the same directory. * / var myContainer:MovieClip = new MovieClip(); var temp_x:int, temp_y:int; A dynamic image loading and adding listeners... var urlReq:URLRequest = new URLRequest ("image1.jpg"); var loader: Loader = new Loader(); Loader.Load (urlReq); myContainer.addChild (loader); loader.contentLoaderInfo.addEventListener (Event.COMPLETE, imgLoaded); addChild (myContainer); function imgLoaded(event:Event):void {(loader.x = 50; / /(stage.stageWidth-pictLdr.width) / 2;}      Loader.y = 50; (/ /(stage.stageHeight-pictLdr.height) / 2; } //Adding red rectangle (type Sprite) in a container. var redBoxContainer:Sprite = new Sprite(); addChild (redBoxContainer);    Event listener when clicking on the image myContainer.addEventListener (MouseEvent.MOUSE_DOWN, setNewPosition); function setNewPosition (event: MouseEvent): void {temp_x = event.localX;      temp_y = Event.localY;           trace ("children of the redboxcontainer =" + redBoxContainer.numChildren);     var redRect:Sprite = new Sprite();     redRect.graphics.beginFill (0xff0000);     redRect.graphics.drawRect (event.localX, event.localY + 47, 7, 7 + 47);     redBoxContainer.addChild (redRect);        trace ("redRect.visible:" + redRect.visible);            redRect.addEventListener (MouseEvent.CLICK, onRedContainer);      function onRedContainer(e:MouseEvent):void {trace ("event listener for red container");      } }

I think that you feel the code is simple. I'm at that level about Flash development [i.e., newbie].

Now my requirement is as follows:

If I click on these created Sprites_objects on the image, then the clicked in last/latestly Sprites_object must be read/represented by highlighted [i.e., it is visible must be made of different like adding border of Sprites_object (or) by changing the size of clicked Sprites_object etc.,] among the other existing circles/rectangles on the image. So, at once, only one Sprite_object need to be highlighted.

For example, if I placed 10 circles/rectangles on the loaded image by successively clicking 10 times on different parts of the same image. Assume that, first of all, I click on 5th Sprite_object, then it should get highlighted. Then after that, if I click again on the 2nd Sprite_object, now, 5th Sprite_object (previously clicked) must be off highlighted and 2nd must get highlighted. In this way, it must continue.

I think you understood my requirement with the example above. If you have any doubts, I am always ready to explain. I ask you people to spend feww minutes of your valuable time to fill the solution in response to my post.

Thanks in advance...

I'm waiting for your answers...

Srihari.Ch

Try:

/ * If you copy the code into your actionsPanel directly, then make sure "image1.jpg" file
* is present next to the .fla file. Since he gets support iff it is present in the same directory.
*/
var myContainer:MovieClip = new MovieClip();
var temp_x:int, temp_y:int;

var prevRedRect:Sprite;
var gf: GlowFilter = new GlowFilter();

A dynamic image loading and adding listeners...
var urlReq:URLRequest = new URLRequest ("image1.jpg");
var loader: Loader = new Loader();
Loader.Load (urlReq);
myContainer.addChild (loader);
loader.contentLoaderInfo.addEventListener (Event.COMPLETE, imgLoaded);
addChild (myContainer);
function imgLoaded(event:Event):void {}
Loader.x = 50; (/ /(stage.stageWidth-pictLdr.width) / 2;
Loader.y = 50; (/ /(stage.stageHeight-pictLdr.height) / 2;
}
Add red rectangle (type Sprite) in a container.
var redBoxContainer:Sprite = new Sprite();
addChild (redBoxContainer);

Event listener when we click on the image
myContainer.addEventListener (MouseEvent.MOUSE_DOWN, setNewPosition);
function setNewPosition(event:MouseEvent):void {}
temp_x = Event.localX;
temp_y = Event.localY;
trace ("children of the redboxcontainer =" + redBoxContainer.numChildren);
var redRect:Sprite = new Sprite();
redRect.graphics.beginFill (0xff0000);
redRect.graphics.drawRect (event.localX, event.localY + 47, 7, 7 + 47);
redBoxContainer.addChild (redRect);
trace ("redRect.visible:" + redRect.visible);
redRect.addEventListener (MouseEvent.CLICK, onRedContainer);
function onRedContainer(e:MouseEvent):void {}
       {if(prevRedRect!=null)}
prevRedRect.filters = null;
}
prevRedRect = Sprite (e.currentTarget);
e.currentTarget.filters = [gf];

trace ("event listener for red container");
}
}

Tags: Adobe Animate

Similar Questions

  • Problems with click options on the pinned taskbar programs

    Hi all

    Today, I met a strange problem with my taskbar of Windows 8. If I try to right click on one of my pinned programs in the taskbar, then select one of the options (for example right click on FireFox and select open a new private window), my laptop stops briefly and background become purple. After a few seconds the bottom will return to normal, and I'll be able to click again on programs. A left click on programs still allows me to access it. Anyone had experience with this issue? Thank you.

    Thank you! [The problem seemed to be with a recent update because the system restore fixed everything, but if it happens again, I'll be sure to try this first:]

  • Problem with player search - only the First Instance is highlighted

    I use WIN 8.1 with Adobe Acrobat Reader DC [15.10.200056.167417 'updated 12/18/15"indicated in the program properties] as my default PDF reader.

    Until recently, I was able to do a search of words/texts of .pdfs using CTRL-F, who showed me every instance highlight of this word.  I would simply hit 'find' several times.  These days, only the first occurrence of the word is highlighted.  Along the right margin are yellow "tics" that, in my opinion, indicate the existence of other occurrences.

    If something has changed in the drive?  Some can tell me how to regain the ability that I hope

    mikec2222 wrote:

    Bernd - Do I understand you though, when you search for "" this document, you can find a second occurrence of "the" highlighted by pressing 'find' or 'next' or 'enter' again?  If this is true, my copy of AA CD player must be faulty.  I can't wait to see your response.

    It's true.

  • Problems with clicking and scrolling when you are using the mouse in IE

    Separated from this thread.

    Original title:

    Problems with clicking and scrolling when you are using the mouse

    I have the same problem.  My touchscreen responds but my touchpad and mouse are unable to save a click in IE.  I need to reboot to rectify.  It seems to be more common when the laptop comes out of fashion 'sleep'.   I tried all the steps above, everything is up-to-date.

    Hello Fred,.

    Thanks for the reply.

    I appreciate your efforts to resolve the issue.

    I would suggest trying the following methods and check if it helps.

    Method 1:
    Run the hardware and devices Troubleshooter and check. Please follow these steps:

    a. press Windows + W keys, type Troubleshooting in the search box and press on Enter.
    b. click on 'show all' and then click 'hardware and devices'.
    c. click 'Next' and then follow the on-screen instructions.

    If this does not help, then use method 2.

    Method 2:
    Start your computer in safe mode and check the number.
    Refer to this article:
    Start settings for Windows (including safe mode)
    http://Windows.Microsoft.com/en-us/Windows-8/Windows-startup-settings-including-safe-mode

    I hope this information helps.

    Please let us know if you need more help.

    Thank you

  • Since Acrobat Reader downloaded DC I can't sign my PDF documents. It does not give me the option more and yes I am connected. On the old version, I got no problem with clicking on "signature" and draw the area where I needed my signature, put passw

    Since Acrobat Reader downloaded DC I can't sign my PDF documents. It does not give me the option more and yes I am connected. On the old version, I got no problem with clicking on "signature" and draw the area where I needed my signature, put the password and "POOF" my signature would be there. With this new version, it won't do that or give me the option. The online help is useless. I need to explain to me how connect you as I used too?

    Hi nicholass35183848,

    I assumed that you had a digital signature created in your player application of old and whenever you use to fill out a pdf with a signature field signed you it. But in order to draw and then sign you must use Acrobat Pro DC no DC drive.

    Thank you

    Abhishek

  • Listener (and the database instance) does not start automatically: ORA-12514: TNS:listener does not currently of service requested in connect descriptor

    Hi all... I am a newbie with oracle database.,.

    I have the problem of monitoring:

    I installed Oracle Database 11 g R2 XE on my CentOS 6.5 guest operating system.

    I changed the host name in my CentOS so (where installed oracle 11g R2 XE) after the installation was completed successfully.

    Installation-) before and during the hostname is localhost.

    (-) After the installation, I changed the host name in VMCentOS

    From the moment where I changed the host name, nothing starts automatically. In particular, the listener and the database instance does not start automatically.

    When I start the listener manually and I try to connect to the instance of database with SQLPLUS I get this error:

    ORA-12514: TNS:listener is not currently of service requested in connect descriptor

    I think that the problem is due host name changed because I have to test and debug the object, re-installed a machine virtual operating system CentOS, re-installed oracle database 11 g and I do not have this problem. The database instance and the listener starts automatically!

    Can someone tell me if, maybe, the problem is with the host has changed? ... and why?

    P.S.: After changing the hostname I also modified the listener.ora and the tnsnames.ora by changing the HOST with the correct host name.

    Hello

    It seems that you don't install Oracle Database Express Edition (XE). If you post this question in the wrong forum.

    When you install EA or there is no script that starts the database at startup.

    If you wish, you can create by yourself. For example search for instructions to Google how to create script.

    Kind regards

    Jari

  • my computer will not install itunes 10.5, it tells me "Setup has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2330.

    original title: Itunes problem

    my computer will not install itunes 10.5, it tells me "Setup has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2330. "What should I do?

    Contact the manufacturer (Apple) of the application (iTunes) you are having problems with.

    Uninstall all previous versions, try to download (re-record not running) and then do a right click on it and RUN AS ADMINISTRATOR.

    (Vista 32-bit or 64-bit)?

  • Bridge does not open? Initially the 8.1 Win & problem had started. Have now earn 10 & still a problem with not to open the bridge?

    Bridge does not open? Initially the 8.1 Win & problem had started. Have now earn 10 & still a problem with not to open the bridge?

    Hi Matthew,

    If you use Bridge CC, update to the latest version 6.2. Adobe Bridge CC 6.2 version now available! Adobe content corner

    1. Please, do a right-click on the bridge on the desktop icon and select "Run as Administrator".
    2. If this does not help, reset the Bridge preferences and then try it.

    Steps: -.

    Start Adobe Bridge, and immediately press Ctrl + Alt + Shift (Windows) or command + Option + shift (Mac OS down) until the dialogue box reset settings appears.

    Select all three options - reset preferences, reset Standard Workspaces and all miniature Purge Cache - and then click OK.

    Reference: troubleshooting errors, freezes | Adobe Bridge | Windows, Mac OS

    Let us know if it works.

    Kind regards

    Assani

  • Problem with Windows Update after the new installation of Windows 7 Pro the Lenovo ThinkPad X 200

    I'm trying to do a fresh install of Windows 7 Pro on a Lenovo ThinkPad X 200. The product key is easy to find on the sticker of the ThinkPad. However, the version of Windows is hidden (for example, I can't check that my ThinkPad had originally installed Windows 7 Pro). I was able to install by using a Pro Win 7 SP1 CD ROM I bought for another installation. I used the ThinkPad I was trying to make the new facility on the product key. I was able to activate the Windows 7 Pro using the phone call and my cell phone. I checked the activation! However, I have problems with Windows update. The product key may be a different version of Windows 7. If so, why did it install and activate OK? Y at - it a fix for this problem or I have to buy a new version of Windows 7 Pro? Please note that I have not yet installed all drivers Lenovo ThinkPad as I can't seem to install correctly. Thank you!

    Since the issue is updated to Windows, it is not a product number key.

    You can reset the Windows Update components by running the Fixit on this page. But if there is malware present, she will continue to reset the connection to the update servers:

    How to reset the Windows Update components

    http://support.Microsoft.com/kb/971058

    Suggest you download and save the Fixit. Then configure the system before the clean boot by running:

    How to troubleshoot a problem by performing a clean boot in Windows Vista/Windows 7

    http://support.Microsoft.com/kb/929135

    Once the Fixit has been downloaded and the system is started in the pure State, check that the native Windows Firewall is now on if a 3rd party firewall has been used previously. Now run the Fixit and choose the default mode. Restart once it's done and see if the system can be connected to the update servers. If he can't, then rerun the Fixit and choose aggressive mode. Turn it back on when he finished the race and updates.

  • Problem with silverlight download, download the error code 2104.

    Original title: problem with Sliverlight download
    get the error code 2104. tried to uninstall and reinstall

    Hello

    Thanks for the reply.

    We are pleased to know that the problem is solved. Please do not hesitate to answer, in the case where you are facing in the future other problems with Windows. Please contact the Windows community.

  • I have problems with my application of the java language.

    I have problems with my application of the java language. It will be open only for about one second, and it won't let me write all programs, it looks like the command prompt when opening. what the * is underway and what can I do to solve this problem.

    Hey Kevin,

    The description of the problem seems a little unclear and I wish I had a better understanding before you start working on it.

    I would really appreciate if you could answer the following questions:

    1. is the specific question of the application of the Java language?

    2. did you of recent changes made to your computer before the show?

    3. you receive an error code or message?

    Please provide us with more information on the specific question to help you to fix as soon as possible.

    If the problem is specific to the Java application, then I suggest you to contact Java support from the links below:

    http://www.Java.com/en/download/support.jsp

    Java Help Center:

    http://www.Java.com/en/download/help/

    Your response is very important for us to ensure a proper resolution. Please get back to us with the information above to help you accordingly.

  • I have problem with value NULL when the use CASE statement please help this question

    I have problem with value NULL when the use CASE statement please help this question


    Table: digital_val

    SNO cl C2

    1 San1 11

    2 22 San2

    Actual result: expected to A         B

    A            B                                                                           11        22

    11 NULL

    22 NULL



    query:

    Select case when c1 = "san1" then c2,.

    case If c1 = "san2" then c2 B

    of digital_val

    I'm more curious why, when you select 2 rows, you expect a result of row?

    WITH digital_val

    AS (SELECT 1 AS 'Sno', 'San1"C1, c2 FROM DUAL 11)

    UNION ALL

    2 SELECT AS 'Sno', 'San2"C1, c2 FROM DUAL 22)

    SELECT CASE WHEN c1 is "San1" THEN END AS A c2.

    CASE WHEN c1 = "San2" THEN END AS B c2

    OF digital_val;

    With no other input, if you select 2 rows, you get 2 rows.  One of the other solutions use a max function, but is this really what you want, does not specify?

  • problem with bind variables in the SQL query view object

    Hi all

    I use JDev 11.1.2.4.0.

    I have a problem with bind variables in the SQL query view object.

    This is my original SQL

    SELECT sum(t.TIME) , t.legertype_id
    FROM LEDGER t
    WHERE t.nctuser_id = '20022' 
          AND to_char(t.insertdate,'YYYYMMDD') in ('20130930','20130929')
    group by t.legertype_id
    

    In my view .xml object query tab, I am writing this

    SELECT sum(t.TIME) , t.legertype_id
    FROM LEDGER t
    WHERE   t.nctuser_id = '20022'
        AND to_char(t.insertdate,'YYYYMMDD') in :dddd
    group by t.legertype_id
    

    Davis here is a variable of Type liaison: String, updatable and necessary.

    I try to deal with Davis as ('20130930 ', ' 20130929') hoping the view object, run as my original SQL.

    But failed. The view object retrieves 0 line after that I run.

    Why?

    Thank you! ('2original SQL0130930', '20130929') ('20130930 ', ' 20130929')

    A variable binding cannot be used as this is why you must use years table. Check decompilation binary ADF: using oracle.jbo.domain.Array with ViewCriteria to see a solution.

    Timo

  • problem with adujstments applied to the image after I click it to preview in Bridge

    I used the bridge to view my RAW images and open them in ACR for years... yesterday I downloaded a map full of images in a new folder on my computer and open as usual, bridge view.  For some reason any now when I'm in Filmstrip mode and I am interested in the large preview image, and then click on the preview of the image with the magnifying glass tool to display a small area, it seems to apply some sort of adjustment to the image.  My pictures you more light in the Center and more dark on the edges, almost like a spotlight/edge Center burn setting... and these changes are carriers through more cab when I open the image there.

    I checked to make sure that the automatic adjustment checkbox is unchecked in Bridge and ACR.  Everything in ACR seems to be to default settings.  I restarted my computer.  Don't know what to do, else, I am very frustrated!  Hoping someone here might have some ideas for me.  I'm under Bridge CS6 and PS CS6 with Camera Raw 8.1.  Thank you!

    It's so strange, because he has recently started to happen and I didn't modify parameters of any where... camera, bridge, ACR, or CS6.

    If something happens out of the blue a reset of the prefs would be an option (bridge of restart now pressed the CTRL key and choose Reset prefs in the menu).

    But here are a few observations of your screenshots:

    First, you set the option for thumbnails for 'embedded use' (you can see the Council left checker icon used for this parameter is selected). This means that the thumb of your al files show the preview jpeg generated from your DSLR camera, it is also confirmed by the black border showing around thumbs, which means that it only shows embedded. The moment that you select to display in the preview window, he begins to build a preview HQ and applies the default settings of RTAs, hence the difference between the embedded and the HQ preview.

    You can use the icon of Council right checker and select always HQ, this begins to build previews HQ for all files, takes some time, but after just as cached, you can easily scroll through all files without problem.

    Integrated thumbs (the originals of the camera) also show a beginning of vignetting. Not knowing not the quality of your goal, it seems to be a good but you use the measurement spot and full aperture at F2.8 lens and maximum zoom which could cause a bit of vignetting himself, when the ACR settings are applied a lot of contrast seems to be applied where more facts highlights vignetting and brighter.

    You should be aware that Adobe has chosen to use the default settings for each type of camera, but this does not mean that agree you with that

    There is always a way to settle in ACR by using different options such as exposure and contrast, etc by image or a series of on the same images.

    But you can also watch other tabs of the ACR settings window to create a personal preset of cab. The other with the curves icon has a few options to look at. To the point, you have a few options with different contrast settings, personally I use them, because I find a lot to fort, I put it to linear which gives it a much more neutral appearance (as said personal and I do most of my work in PS itself using adjustment layers and channel masks). If you check under the camera icon (calibration of the camera), you will find versions of various processes (2012 and especially 2010 are advised, 2012 is by default and has its advantages and disadvantages. More big difference is the way in which they handle highlights and shadows in the exposure tab).

    A second option to check is the profile of the camera itself with its different options. Here, I also checked the option neutral Adobe who seems a result of dull, but in the end he gives you the closest result of the original raw and a very good start for your personal result, just check all the other profiles one by one and select your choice. If you're happy save it as a new Camera Raw default with a proper name so you can always return to it in the presets window.

  • Problem with Mail storage on the iPhone 6.

    OK, I have a problem with my mail. That is, it uses 1.2 GB of data. I cleaned all my emails and deleted all the big files. Nothing has changed. So I deleted all e-mail accounts. Still no change. When I plug my phone in iTunes, it says there 2.49 GB free yet my phone says I only have 337 MB of free space. Yes, I tried to sync and see if that has nothing and he did not. No idea what continues?

    Try to reset your email account in this order.

    First close your Mail application completely from the window of the selector app by double clicking the Home button and drag the email preview pane up until it disappears from the display. Then go to settings > Mail, Contacts, calendar > find your e-mail provider and click on the account. On the next page, delete the account. Then perform a forced reboot. Hold down the home and Sleep/Wake buttons simultaneously for about 15-20 seconds , until the Apple logo appears. Then go to settings > mail... and to add the account.

    iTunes and iPhone storage almost never fit. The amount of iTunes is an estimate, the phone is the exact amount.

    Different amounts of 'Available' reported by iPhone and iTunes

    If the above is not enough, you may need to do a system restore. First save your device via iTunes. Also import your photos on your computer and copy all the important data. Reconstruction of the support first test and test. If this does not help, you may need to restore as a new and reconfigure from scratch as the backup may be damaged. It is important to have your photos and your saved data separately from the backup. Here are the steps for a restoration:

    https://support.Apple.com/en-us/HT201252

Maybe you are looking for

  • I have problems of Shockwave, see below, how to fix this?

    I receive the message: WARNING: Plugin does notShockwave Flash may be busy, or it may have stopped responding. You can stop the plugin now or continue to see if the plugin is complete. I can't seem to get rid of it or fix it. Help. Thank you.

  • Is that the new iOS 9.2.1 update really 2 GB?

    Reading the posts earlier on the last 9.2.1 update and see who confirms that the update must be done with iTunes and that its size is greater than 2 GB.  Is this true?  I don't have the bandwidth to handle.

  • Chromebook 14-q011sa HP: HP Chromebook 14 - Lite on IT SSD - warranty issue

    My HP Chromebook 14-q011sa has been crashing at random. A SSD test revoilé 380 + defective Chromebook has a 1 year warranty standrd but nobody knows if the SSD has a duration of the warranty as do most HDD? Model number Lite on this SSD is LSS-16L6G-

  • How can I tell what an add-on windows approved

    When I go to install "let say" antivirus program.  How can I say that it is MS Windows approved?  And not some fly by night shop, just for the money and my information?

  • HP officejet 6000: officejet e609a software

    Hi friends I'm at my wits end, I tried to install the software for the officejet 6000 E609a for two days. I continue to receive updates of pilot who want me to pay. I buy a printer of opportunity that I had loads of ink for this one and my laptop has