


Actionscript3 implementation code for detecting collision of two movie clip components
This article introduces how as3 detects the collision of two components.
The following code has been tested by me and is available.
First put two movie clips mc1 and mc2 in the scene
Put the following code in the as panel:
mc1.addEventListener(Event.ENTER_FRAME,MCMoveEvent); mc2.gotoAndStop(1); var bmd1 = new BitmapData(mc1.width, mc1.height, true, 0); bmd1.draw(mc1); var bmd2 = new BitmapData(mc2.width, mc2.height, true, 0); bmd2.draw(mc2); function MCMoveEvent(e:Event):void{ mc1.x-=0.5; if(bmd1.hitTest(new Point(mc1.x-1, mc1.y), 0x55, bmd2, new Point(mc2.x, mc2.y))){ mc2.gotoAndStop(2); mc1.removeEventListener(Event.ENTER_FRAME,MCMoveEvent); }else{ mc2.gotoAndStop(1); } }
Through the above code, you can see that actionscript collision is mainly implemented by the hitTest function. You can write collision in the if condition Business logic operation after success.
This article is provided by PHP Chinese website,
Article address: http://www.php.cn/java-article-377122.html
Come to PHP to learn programming Chinese website www.php.cn
The above is the detailed content of Actionscript3 implementation code for detecting collision of two movie clip components. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Enter the editing function on the editing page, select and split the video and export it. Applicable model of the tutorial: iPhone13 System: iOS15.3 version: Cutout 8.2.1 Analysis 1 First enter the cutout homepage and click on the top to start creating. 2After selecting the video to be edited, click Add in the lower right corner. 3After entering the editing page, click Clip in the lower left corner. 4After selecting the video progress, click Split. 5Click Delete at the bottom of the page to delete some of the videos you just selected. 6Finally, click Export in the upper right corner of the page to save. Supplement: What are the functions of video clipping? 1 The functions of video clipping include: cutting, speed change, reverse playback, canvas, transition, stickers, fonts, voice to subtitles, Douyin music collection, music library, voice changing, picture adjustment, and filters , beauty,

Python and Youpaiyun interface docking tutorial: Implement audio merging and editing Introduction: Audio processing is widely used in the modern digital era, and Youpaiyun provides a powerful audio processing interface to facilitate developers to implement audio in their own projects Merge and edit. This article will introduce how to use Python to connect with Youpai Cloud interface to realize the functions of audio merging and editing. Preparations Before we begin, we need to do some preparations. First, make sure you have installed the Python development environment and related third-party libraries

So you want to become a savvy clip maker and you've chosen Clipchamp as your starting ramp? You made a very good choice because this tech giant's video editor is very easy to use. You probably know that Microsoft bought video editing software and added it to Windows 11 soon, so learning how to use it will definitely come in handy. We recently explored Clipchamp's feature panel and reviewed how to use the software to edit videos, so you know the basics. Now, it's time to learn how to properly trim your video so you're ready for the production process you've been working on. How to trim videos using Clipchamp? Trim is something you can do in Cl

How to transcode and edit multimedia files on Kirin OS? With the development of the digital age, the use of multimedia files has become an indispensable part of our daily lives. However, multimedia files come in various formats and sizes, and sometimes we need to transcode and edit them to suit different needs. As an open source operating system, Kirin operating system provides a wealth of tools and libraries, making the transcoding and editing of multimedia files easier and more efficient. This article will introduce how to create multimedia files on Kirin operating system

How to Shorten Videos on iPhone Using the Photos App If you just want to trim a video to leave a shorter continuous portion of the original video, you can do this directly in the Photos app on your iPhone. This allows you to quickly change the start and end points of your video. To shorten a video in the Photos app on iPhone: Open the video you want to shorten in the Photos app. Click Edit in the upper right corner of the screen. You'll see the video's timeline at the bottom of the screen. To change the starting point of your video, click and hold the button at the left end of the timeline. Drag the slider to the desired position. To position the starting point more precisely, move the slider roughly to where you want it, then stop moving your finger but keep it pressed on the screen. The timeline will now zoom in, allowing you to

With the rise of Chinese video platforms, more and more creators are getting involved in film and television editing. So, how to achieve the originality of film and television editing in Chinese videos? This article will answer that question for you and provide some tips for increasing your playback volume. 1. How to make film and television editing in China Video so that it is original? 1. Unique selection of materials: Choose unpopular or classic movie and TV series clips, and avoid editing popular dramas to reduce duplication with others. 2. Creative editing: Through innovative editing techniques, such as seamless editing, time reversal, etc., it brings a sense of freshness to the audience. 3. Personalized explanation: Add your own opinions and interpretations to make the work have personal characteristics. 4. Well-produced: During the editing process, pay attention to picture quality, sound effects processing, etc. to improve the overall quality of the work. 5. Prominent theme:

At the Apple iPhone 15 conference, Apple stated that the iPhone 15 Pro’s A17 Pro chip will shoot videos “in a new dimension.” Video recording is available for Apple Vision Pro's Space Movies, a feature that will be launched later this year. Users can capture precious moments in 3D and relive memories in front of their eyes through the device when Apple Vision Pro is launched in the United States early next year. For those who haven't noticed, "Spatial Video" is Apple's proprietary name for 3D video. iPhone 15 Pro is able to natively record spatial videos through its main and ultra-wide-angle lens sensors, with results similar to stereoscopic videos. Users can use Apple’s “empty space” to be launched early next year

How to edit songs in Kugou Music? In Kugou Music, you can directly edit songs, but most users don’t know how to edit songs in Kugou Music. Next is the graphic tutorial on how to edit songs in Kugou Music that the editor brings to users. , interested users come and take a look! Kugou Music usage tutorial: How to edit songs with Kugou Music 1. First open Kugou Music, click on the three horizontal lines in the upper right corner, and select the [Ringtones] service; 2. Then enter the ringtone page and select [Crop] 】;3. Finally, select the required music part to edit and use it.
