巧妙运用Flash MX 2004制作“拖曳配对题”(2) | |
---|---|
http://www.sina.com.cn 2004年05月26日 11:31 赛迪网--中国电脑教育报 | |
文/周建峰 _root.jiaoche.stopDrag();//鼠标松开,“轿车”停止拖动 if (_root.car.hitTest(_root.jiaoche)) { _root.jiaoche._x = x0; _root.jiaoche._y = y0; //当jiaoche影片碰到了car影片后,jiaoche影片自动到达car影片的位置 _root.jiaoche.stopDrag(); _root.fankui = "回答正确,继续努力!"; //当括号中的car影片与轿车碰撞后,反馈正确结果 } else { _root.jiaoche._x = x1; _root.jiaoche._y = y1; //当jiaoche影片没有到达car影片位置时,jiaoche影片返回原始位置。 _root.fankui = "回答错误,再来一次!"; } }//上面的语句是对轿车进行拖动并且反馈出配对结果。 _root.mao.onPress=function(){ _root.mao.startDrag(); x0 = _root.cat._x; y0 = _root.cat._y; x1 = _root.mao._x; y1 = _root.mao._y; } _root.mao.onRelease=function(){ _root.mao.stopDrag(); if (_root.cat.hitTest(_root.mao)) { _root.mao._x = x0; _root.mao._y = y0; _root.mao.stopDrag();
|