Why is the hitTest function works only with attachmovie?

Hello.

I need help. I can't get the hitTest to work for my script below.

I tested using movieclips created on stage at design-time and collided during execution. hitTest, works very well in this situation.

But if I use the attachmovie command and create a movie on stage during the performance, the video cannot hitTest with other clips. The hitTest just doesn't work.

Please help me by recommending changes. I don't know what to do. It is not that difficult.

Thank you.

-Aslan

""""""""""""""""""""

The script below is essentially to create instances of enemymc, and he will fall vertically, hitting a movieclip target_mc which is set at design time. Please help, out of ideas.

"""""""""""""""""""""

var enemyTime:Number = 0;

var enemyLimit:Number = 20;

onEnterFrame = Function)

{

enemyTime ++;

trace (enemyTime);

if(enemyTime == enemyLimit)

{

var enID: Number = Math.Random ();

enemy_mc = _root.attachMovie ('enemymc', 'en' + enID, _root.getNextHighestDepth ());

["fr" + enID] _root ._x = int (Math.random () * Stage.width);

_root ["fr" + enID] ._y = - 5;

_root ["fr" + enID] .onEnterFrame = function()

{

var chk:Boolean = false;

var currMov:MovieClip;

ce ._y += 5 ;

currMov = this;

if (this.hitTest (_root.target_mc, true))

{

trace ("the enemy detected a success.");

}

if (this ._y > (Stage.height - 10))

{

this.removeMovieClip ();

}

}

enemyTime = 0;

}

}

If you have two targets mc then they must have different instance names and you must hitTest for each of them.

If (this.) HitTest (target_mc1) | this.hitTest (target_mc2))
{
trace ("the enemy detected a success.");
}

And if you need to deal with them in different ways depending on who gets the success, just use two separate tests.

As far as why my way and not your way, I have to be honest and say that I spent time trying to get your way to work and by trial and error, I ended up with, that's what you see.  I thought that the biggest change took place (which means he started work) when I changed the hitTest to not include the "true" setting, which I think is applicable to the use of corrdinates, and not an object.  But when I started your code and changed only this line, it still does not work, so something else in my revised code also applies.

I didn't like using the random calculation for falling objects, which may have been part of the problem.  That will produce a fractional value with a point decimal, and names of the instance with dots in them are probably an accident waiting to happen (ex: en0.27365514)

If you want to know what changes were absolutely necessary for its work, start with your code and the hitTest change first and then see what must be done to get things working properly.  I was tempted, but I had other things I wanted to do, so I got what I got the job.

Tags: Adobe Animate

Similar Questions

  • Why is my 4K display works only with Mac OS on a mac pro?

    I have a Mac Pro (Darth Vader trash) 2013 edition.  I installed today to MacOS of OS 11.11 El Capitan.

    My monitor AOC 4K (U2879VF) no longer works.  Using a miniDisplay port to display port is to connect to the MacPro.  It worked very well with El Capitan.

    Any thoughts?

    My MP 2013 works very well with Sierra with my Dell UP2414Q via mini displayport > cable displayport

    Have yo reinstalled the cable ends?

    Next:

    -Try to reset memory NVRAM/PRAM and SMC

    MacIntel: Reset of the controller (SMC) system management

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

    Subject of memory NVRAM and PRAM

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

    -Try to start safe mode

    OS x: what is Safe Boot, Safe Mode?

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

  • Palm Desktop 6.2.2. and the search function works only in Windows 7

    Palm Desktop search function does not not in Windows 7 64 bit. Help, please.

    I was able to solve this problem by disabling the compatibility mode and setting the application runs under the administrative name.

  • problem with the custom download works only with IE 8

    All,

    Ive created a button to download custom content of the interactive report using the url of normal reference below but it doesn't work in IE8 which is the solution to this? also, it gives no error when you click on the button that the download popup (save/open) crashes.

    my settings should be correct under button url value f? p = & APP_ID.: & APP_PAGE_ID.: & SESSION. : CSV:

    This works fine in firefox and chrome, but not in Internet Explorer.

    Apex 4.1.1

    Try to use a branch of the page which is subordinate to that special touch. Send the page by using the key and the definition of the request for connection to the CSV format.

    Denes Kubicek

    -------------------------------------------------------------------

    -------------------------------------------------------------------

  • Elastic data functionality works only with ReadWriteBackingMap

    The following exception is observed
    2011-08-25 16:36:15.315/5.282 Oracle Coherence GE 3.7.0.0 <D4> (thread=DistributedCache:HibernateReadWriteDistributedCache, member=3): Asking member 1 for 128 primary partitions
    Exception in thread "Main Thread" (Wrapped: Failed request execution for HibernateReadWriteDistributedCache service on Member(Id=3, Timestamp=2011-08-25 16:36:12.577, Address=172.31.0.112:8090, MachineId=45936, Location=process:25120, Role=ModelTestTest)) java.lang.IllegalStateException: Partition 58 does not exist at PartitionSplittingBackingMap{Name=model.entities.Klant,Partitions=[]}; key=Binary(length=6, value=0x0D3A019A9701)
            at com.tangosol.util.Base.ensureRuntimeException(Base.java:288)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.tagException(Grid.CDB:36)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onPutRequest(PartitionedCache.CDB:61)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$PutRequest.run(PartitionedCache.CDB:1)
            at com.tangosol.coherence.component.util.DaemonPool$WrapperTask.run(DaemonPool.CDB:1)
            at com.tangosol.coherence.component.util.DaemonPool$WrapperTask.run(DaemonPool.CDB:32)
            at com.tangosol.coherence.component.util.DaemonPool$Daemon.onNotify(DaemonPool.CDB:63)
            at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
            at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.IllegalStateException: Partition 58 does not exist at PartitionSplittingBackingMap{Name=model.entities.Klant,Partitions=[]}; key=Binary(length=6, value=0x0D3A019A9701)
            at com.tangosol.net.partition.PartitionSplittingBackingMap.reportMissingPartition(PartitionSplittingBackingMap.java:566)
            at com.tangosol.net.partition.PartitionSplittingBackingMap.put(PartitionSplittingBackingMap.java:118)
            at com.tangosol.util.WrapperObservableMap.put(WrapperObservableMap.java:132)
            at com.tangosol.net.partition.ObservableSplittingBackingMap.put(ObservableSplittingBackingMap.java:78)
            at com.tangosol.net.cache.ReadWriteBackingMap.putInternal(ReadWriteBackingMap.java:1292)
            at com.tangosol.net.cache.ReadWriteBackingMap.put(ReadWriteBackingMap.java:744)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$Storage.postPut(PartitionedCache.CDB:66)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$Storage.put(PartitionedCache.CDB:17)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onPutRequest(PartitionedCache.CDB:37)
            ... 6 more
    It's the same bet in place, such as presented here: Oracle coherence GE 3.7.0.0 < error > - did not apply the delta
    with the exception that PortableObject has been replaced by ExternalizableLite.

    The ramjournal scheme is used within the internal-cache-schema element (http://download.oracle.com/docs/cd/E18686_01/coh.37/e18677/appendix_cacheconfig.htm#BHCIEAAD)
            <distributed-scheme>
                <scheme-name>hibernate-read-write-distributed</scheme-name>
                <service-name>HibernateReadWriteDistributedCache</service-name>
                <thread-count>5</thread-count>
                <backup-count>1</backup-count>
                <backup-count-after-writebehind>0</backup-count-after-writebehind>
                <backing-map-scheme>
                    <read-write-backing-map-scheme>
                        <scheme-ref>hibernate-read-write-backing-map</scheme-ref>
                    </read-write-backing-map-scheme>
                </backing-map-scheme>
                <autostart>true</autostart>
            </distributed-scheme>
            <read-write-backing-map-scheme>
                <scheme-name>hibernate-read-write-backing-map</scheme-name>
                <internal-cache-scheme>
                    <ramjournal-scheme/>
                </internal-cache-scheme>
                <cachestore-scheme>
                    <class-scheme>
                        <class-name>com.tangosol.coherence.hibernate.HibernateCacheStore</class-name>
                        <init-params>
                            <init-param>
                                <param-type>String</param-type>
                                <param-value>{cache-name}</param-value>
                            </init-param>
                        </init-params>
                    </class-scheme>
                </cachestore-scheme>
                <write-delay>{write-delay 10s}</write-delay>
                <write-batch-factor>{write-batch-factor 0.75}</write-batch-factor>
                <write-requeue-threshold>{write-requeue-threshold 128}</write-requeue-threshold>
                <refresh-ahead-factor>{refresh-ahead-factor 0.75}</refresh-ahead-factor>
            </read-write-backing-map-scheme>
    The file tangosol-coherence - override.xml is as follows:
    <coherence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns="http://xmlns.oracle.com/coherence/coherence-operational-config"
               xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-operational-config coherence-operational-config.xsd">
        <cluster-config>
            <journaling-config>
                <ramjournal-manager>
                    <maximum-value-size>16KB</maximum-value-size>
                    <maximum-size system-property="tangosol.coherence.ramjournal.size">25%</maximum-size>
                </ramjournal-manager>
                <flashjournal-manager>
                    <maximum-value-size>64KB</maximum-value-size>
                    <maximum-file-size>2048KB</maximum-file-size>
                    <block-size>256KB</block-size>
                    <maximum-pool-size>16MB</maximum-pool-size>
                    <directory>/home/oracle/temp/journaling</directory>
                    <async-limit>16MB</async-limit>
                </flashjournal-manager>
            </journaling-config>
        </cluster-config>
    </coherence>
    When a near-cache configuration is the problem is not respected
    2011-08-25 16:45:59.275/3.892 Oracle Coherence GE 3.7.0.0 <Info> (thread=DistributedCache:DistributedRAMJournal, member=2): Journal Resource Manager: The RamJournal is configured to use  a maximum of 268435456 bytes.
    with the configuration of the cache close to the search as follows:
            <near-scheme>
                <scheme-name>near-journal</scheme-name>
                <front-scheme>
                    <local-scheme>
                        <high-units>{front-size-limit 0}</high-units>
                        <expiry-delay>{front-expiry-delay 1m}</expiry-delay>
                    </local-scheme>
                </front-scheme>
                <back-scheme>
                    <distributed-scheme>
                        <scheme-ref>distributed-journal</scheme-ref>
                    </distributed-scheme>
                </back-scheme>
                <autostart>true</autostart>
            </near-scheme>
            <distributed-scheme>
                <scheme-name>distributed-journal</scheme-name>
                <service-name>DistributedRAMJournal</service-name>
                <thread-count>5</thread-count>
                <backup-count>1</backup-count>
                <backing-map-scheme>
                    <ramjournal-scheme/>
                </backing-map-scheme>
                <autostart>true</autostart>
            </distributed-scheme>
    Can someone explain what is happening in the case of the ReadWriteBackingMap? Or is the wrong configuration?

    Hi René,.

    You encounter a known bug. We have an opening to question (COH-5063) JIRA on this problem.

    -Luk

  • The Recycle Bin works only with Windows 7!

    Delete all what I get now deleted instead of going in the trash. How can I fix it?

    Right-click on your Recycle Bin Dektop icon and select Properties. Place the cursor on the drive and uncheck the box in front of «do not move files to the RecycleBin...» ", click apply and then click OK. Hope this helps, Gerry Cornell

  • Lightroom works only with reduced funktionality. Develop module is not available.  Adobe can not find the license associated with my Adobe why identification code? Every month I pay an amount for PS and LR...

    After the upgrade to Windows 10 Lightroom works only with reduced funktionality. Develop module is not available.  Adobe can not find the license associated with my Adobe why identification code? I bought the license more than 1 year ago. Every month I pay an amount for PS and LR, and for the past 4 months I can't work. Russian support team cannot solve this problem and sent me here.

    Thank you! I reset my password, the problem was in it.

  • RoboForm does not work with your new browser. It is very fustrating and works only with Windows Explorer. I need to reinstall the old FIREFOX program?

    RoboForm does not work with your new browser. It is very fustrating and works only with Windows Explorer. I need to reinstall the old FIREFOX program?

    RoboForm has already released a version with support for the latest version of Firefox. See http://www.roboform.com/support/news. Try upgrading to the latest version of Roboform.

  • CS6 Production Premium supports AMD graphics cards? Specifically over-pants M6100. If so, all the features work with the M6100, or are there features that work only with nVidia video cards?

    CS6 Production Premium supports AMD graphics cards? Specifically over-pants M6100. If so, all the features work with the M6100, or are there features that work only with nVidia video cards?

    CS6 does support OpenCL and OpenGL?

    Are all features that CS6 supports for NVidia Cuda available for the M6100 OpenCL?

    Bill supposed to first Pro CC (not CS6) response. Windows of Premiere Pro CS6 version does not support OpenCL for accelerating GPU of MPE. Therefore, there is no "opencl_supported_cards.txt" file in the folder of Premiere Pro, and the code to OpenCL is disabled permanently in all versions of Windows from Premiere Pro CS6. So, for your over-pants M6100 Premiere Pro CS6 will be permanently locked to only software MPE mode. (Acceleration GPU of MSES in the Windows of Premiere Pro CS6 version is limited to the CUDA only, which means that only NVIDIA for GPU - no AMD over-pants or GPU Radeon support CUDA at all.)

  • I have the code for an Adobe Creative Cloud, it is alphanumeric, but the registry works only with numeric codes ¿where I can use my code?

    Hi, I have a problem with code for my Adobe Creative cloud, it is alphanumeric, but the registry works only with numeric codes ¿where I can use my code? is a subscription to creative cloud of throughout the year.

    Probably you have a redemption code... especially if you did not purchase directly from Adobe

    Redemption Code http://helpx.adobe.com/x-productkb/global/redemption-code-help.html

    -or https://forums.adobe.com/thread/1572504

  • This calculator works only with round numbers

    I need help,

    This calculator works only with the numbers series, but is this 1.9 * 6 the result is 11.399999999999999 instead of 11.4

    Ware is the problem, can it be resolved?

    Theanks in advace.

    <? XML version = "1.0" encoding = "utf-8"? >

    < mx:Application ' xmlns:mx = ' http://www.Adobe.com/2006/MXML "layout =" " vertical " >

    < mx:Script >

    <! [CDATA]

    private function getTotal():Sub

    {

    var myInt:int = parseInt (input.text);

    var myFloat:Number = parseFloat (input.text);

    var myNumber:Number = new Number (Input.Text);

    var myInt2:int = parseInt (input2.text);

    var myFloat2:Number = parseFloat (input2.text);

    var myNumber2:Number = new Number (INPUT2. (Text);

    total. Data = (myNumber) * (myNumber2);

    }

    []] >

    < / mx:Script >

    < mx:TextInput id=" entry " />

    < mx:TextInput id=" INPUT2 " />

    < mx:TextInput id=" total " />

    < mx:Button " label = ' Button "click ="getTotal ();" />

    < / mx:Application >

    Welcome to the joys of IEEE 754 floating-point arithmetic. For more fun, try ".1 + 1 - 1»

    The simplest answer is probably to limit your result with Number.toFixed (). The answer is not so easy is to write your own class BigDecimal (in Java).

    --
    Maciek Sakrejda
    Truviso, Inc..
    www.truviso.com
    Truviso recruiting: http://www.truviso.com/company-careers.php?i=87

  • The AirPod are compatible only with iphone 7? Or we can use it with more than 6 s... or any android device?

    The AirPod are compatible only with iphone 7? Or we can use it with more than 6 s... or any android device?

    Here are the tech specs: http://www.apple.com/shop/product/MMEF2AM/A/airpods

    They are bluetooth devices, so they work with the iPhone 5 or more.

    See you soon,.

    GB

  • Windows 7 works only with canon MX 340

    Canon MX 340 printer works only with windows 7.

    Canon MX 340 printer works only with windows 7.

    You mean the Canon PIXMA MX340?

    You have the following drivers installed? :
    http://www.USA.Canon.com/nw3s/CanonUSA/DownloadContents/English/0100461601EN.htm
    (As of 10/23/12)

  • External speakers work only with powerpoint.

    External speakers work only with powerpoint. DVD, internet, music files, are not. They worked for the first few weeks.

    I have a HP dv7-6c27cl with intel core i5 and Windows 7.

    When I have the system check it, it finds no problem.  Apparently, I have the latest drivers. The fact that the speakers work with powerpoint, which is confusing.

    When I play a video file or music, I get an error message: "Windows Media Player has encountered a problem while playing the file."

    The headset works for internet but not DVD.

    I've installed Weatherbug a week ago and had to uninstall other garbage that come with it. I think that's when the problem started.

    Well, I set myself just now. I did a system restore to a point before that I installed Weatherbug, and now everything's fine.

  • DeskJet 722C works only with Windows 7

    OK, so I applied the DJ_Patch as described. (See http://h30434.www3.hp.com/t5/Printer-All-in-One-Software-and/Deskjet-710-720-810-820-100-Series-prin... ) I have Windows 7, 64-bit and a HP Deskjet 722 C printer.  Tried to print the test page, but received the error from the printer.  Tried to add a printer, you are looking for the 722C, but it is not on the list, even tried to do Windows Update to search for my printer.   Tried to restart, which did not work or the other.  Still get error printer.  I appreciate any other suggestions.  BTW, the printer is connected via a USB to parallel port cable.

    My HP Deskjet 722C now works!  I spent several hours trying different things only to find out it was the cable use to connect the printer to our new computer.  He is there not a lot of info on the package of cable but if you watched closely he said it worked only with Win XP, me and Vista.  Who would have thought that the cable wasn't working with some BONE... me!  Once we went and bought a new cable ($40, Ouch!), we were running a few minutes.  I don't know that a cheaper cable is available online.

    I wanted to post this in the hope of saving someone money, time and frustration on the other.

Maybe you are looking for