lesson five - adobe animate cc hit test
Автор: CSU Electronic Art
Загружено: 2017-03-09
Просмотров: 4889
when you drag and drop, you can trigger an event to happen using the hitTestObject
Table of Contents:
1. How to add a movie clip to react to draggable object 1:30
2. How to make a movie clip transparent 2:55
3. How to add code to have hat to react to head 4:00
4. What is "trace"? 5:20
5. What is the output window? Where do you see it 6:00
[THE CODE IS AS FOLLOWS]
redHat.addEventListener(MouseEvent.MOUSE_DOWN, startMove);
function startMove(evt:MouseEvent):void {
redHat.startDrag();
}
redHat.addEventListener(MouseEvent.MOUSE_UP, stopMove);
function stopMove(event:MouseEvent):void {
redHat.stopDrag();
if (redHat.hitTestObject(topOfHead))
{
trace("The hat fits!");
}
else
{
trace("That's not where the hat goes!");
}
}
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: