flash on 2010-3-15 衝突したときのイベントの練習 hacker_kirif.. forked:4favorite:3lines:41license : MIT License modified : 2010-03-15 16:56:07 Embed Tweet package { /* 衝突したときのイベントの練習 */ import flash.display.Sprite; import flash.display.MovieClip; import com.actionsnippet.qbox.*; import Box2D.Common.Math.*; import flash.events.Event; import flash.media.Video; public class FlashTest extends MovieClip { private var con:QuickContacts; private var boxA:QuickObject; private var boxB:QuickObject; private var sim:QuickBox2D; public function FlashTest() { // write as3 code here.. sim=new QuickBox2D(this); sim.createStageWalls(); boxA=sim.addBox({x:3,y:3,width:2,height:2,fillColor:0xff0000}); boxB=sim.addBox({x:3,y:6,width:2,height:2,fillColor:0x00ff00}); sim.start(); sim.mouseDrag(); //接触判定のためのQuickContactを作成 con=sim.addContactListener(); con.addEventListener(QuickContacts.ADD,onAdd); con.addEventListener(QuickContacts.REMOVE,onRemove); } private function onRemove(e:Event):void{ if(con.isCurrentContact(boxA,boxB)){ boxA.userData.width=20; boxA.userData.height=20; boxB.userData.width=20; boxB.userData.height=20; } } private function onAdd(e:Event):void{ if(con.isCurrentContact(boxA,boxB)){ boxA.userData.width=10; boxA.userData.height=10; boxB.userData.width=10; boxB.userData.height=10; } } } } Code Fullscreen Preview Fullscreen hamabeshonen.. osamX twotree height width addEventListener MovieClip Event sort new page view favorite forked pv33 forked from: flash on 2010-3-1.. Luis.Rodriguez forked:0 favorite:0lines:41 (diff:5) pv945 Cube creator - Box2D Pelisalinet forked:1 favorite:0lines:41 (diff:53) tag: 3d, box2d, creator cube, event example, height, stage width, x, y, pv0 forked from: flash on 2010-3-1.. _perfect forked:0 favorite:0lines:41 (diff:24) pv0 forked from: flash on 2010-3-1.. eiei19 forked:0 favorite:0lines:41 (diff:1)