извините за недоразумения в моей программе, я здесь новичок, и я также новичок в использовании flash.вот пример вывода, который я использовал в своем коде
! [пример вывода (http://i1114.photobucket.com/albums/k532/deadmaster2903/sample.jpg)
), а вот код, который я использовал:
var objectoriginalX:Number;
var objectoriginalY:Number;
var score:Number = 0;
var count:Number = 30;
var myTimer:Timer = new Timer(1000,count);
myTimer.addEventListener(TimerEvent.TIMER, countdown);
myTimer.start();
if (myText_txt.text == "0")
{
myText_txt.text ="Times Up!";
}
function countdown(event:TimerEvent):void
{
myText_txt.text = String((count)-myTimer.currentCount);
}
//fall
fallapple_mc.buttonMode = true;
fallapple_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
fallapple_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
fallchicory_mc.buttonMode = true;
fallchicory_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
fallchicory_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
fallchilipeppers_mc.buttonMode = true;
fallchilipeppers_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
fallchilipeppers_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
fallchinesecabbage_mc.buttonMode = true;
fallchinesecabbage_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
fallchinesecabbage_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
fallcranberries_mc.buttonMode = true;
fallcranberries_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
fallcranberries_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
fallcucumber_mc.buttonMode = true;
fallcucumber_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
fallcucumber_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
falldates_mc.buttonMode = true;
falldates_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
falldates_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
fallgrapes_mc.buttonMode = true;
fallgrapes_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
fallgrapes_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
fallleaflettuce_mc.buttonMode = true;
fallleaflettuce_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
fallleaflettuce_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
fallnuts_mc.buttonMode = true;
fallnuts_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
fallnuts_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
fallpersimmon_mc.buttonMode = true;
fallpersimmon_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
fallpersimmon_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
fallpomegranates_mc.buttonMode = true;
fallpomegranates_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
fallpomegranates_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
//spring
springasparagus_mc.buttonMode = true;
springasparagus_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
springasparagus_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
springbasil_mc.buttonMode = true;
springbasil_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
springbasil_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
springbeans_mc.buttonMode = true;
springbeans_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
springbeans_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
springbeets_mc.buttonMode = true;
springbeets_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
springbeets_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
springberries_mc.buttonMode = true;
springberries_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
springberries_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
springiceberg_mc.buttonMode = true;
springiceberg_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
springiceberg_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
springmango_mc.buttonMode = true;
springmango_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
springmango_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
springpapaya_mc.buttonMode = true;
springpapaya_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
springpapaya_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
springpeas_mc.buttonMode = true;
springpeas_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
springpeas_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
springradish_mc.buttonMode = true;
springradish_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
springradish_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
springrhubarb_mc.buttonMode = true;
springrhubarb_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
springrhubarb_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
springshallots_mc.buttonMode = true;
springshallots_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
springshallots_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
//summer
summerapricot_mc.buttonMode = true;
summerapricot_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
summerapricot_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
summerbellpepper_mc.buttonMode = true;
summerbellpepper_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
summerbellpepper_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
summerbrocolli_mc.buttonMode = true;
summerbrocolli_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
summerbrocolli_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
summercherries_mc.buttonMode = true;
summercherries_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
summercherries_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
summercorn_mc.buttonMode = true;
summercorn_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
summercorn_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
summerfigs_mc.buttonMode = true;
summerfigs_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
summerfigs_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
summerokra_mc.buttonMode = true;
summerokra_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
summerokra_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
summerpeaches_mc.buttonMode = true;
summerpeaches_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
summerpeaches_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
summerplum_mc.buttonMode = true;
summerplum_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
summerplum_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
summersquash_mc.buttonMode = true;
summersquash_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
summersquash_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
summertomato_mc.buttonMode = true;
summertomato_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
summertomato_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
summerwatermelon_mc.buttonMode = true;
summerwatermelon_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
summerwatermelon_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
//winter
winteravocado_mc.buttonMode = true;
winteravocado_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
winteravocado_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
winterbrusselsprouts_mc.buttonMode = true;
winterbrusselsprouts_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
winterbrusselsprouts_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
wintercabbage_mc.buttonMode = true;
wintercabbage_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
wintercabbage_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
wintercauliflower_mc.buttonMode = true;
wintercauliflower_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
wintercauliflower_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
winterceleryroots_mc.buttonMode = true;
winterceleryroots_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
winterceleryroots_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
winterfennel_mc.buttonMode = true;
winterfennel_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
winterfennel_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
wintergrapefruit_mc.buttonMode = true;
wintergrapefruit_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
wintergrapefruit_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
wintermandarin_mc.buttonMode = true;
wintermandarin_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
wintermandarin_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
wintermushrooms_mc.buttonMode = true;
wintermushrooms_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
wintermushrooms_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
winterpears_mc.buttonMode = true;
winterpears_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
winterpears_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
winterspinach_mc.buttonMode = true;
winterspinach_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
winterspinach_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
wintersquash_mc.buttonMode = true;
wintersquash_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
wintersquash_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject);
function pickupObject(event:MouseEvent):void
{
event.target.startDrag(true);
event.target.parent.addChild(event.target);
objectoriginalX = event.target.x;
objectoriginalY = event.target.y;
response_txt.text = " ";
}
function dropObject(event:MouseEvent):void
{
event.target.stopDrag();
var matchingTargetName:String = "target" + event.target.name;
var matchingTarget:DisplayObject = getChildByName(matchingTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == matchingTarget)
{
event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
event.target.removeEventListener(MouseEvent.MOUSE_UP, dropObject);
event.target.buttonMode = false;
event.target.x = matchingTarget.x;
event.target.y = matchingTarget.y;
response_txt.text = "You did it!";
score++;
scoreField.text = String(score);
}
else
{
event.target.x = objectoriginalX;
event.target.y = objectoriginalY;
response_txt.text = "Try again";
}
};
Итак, из того, что я сказал ранее, если вы могли видеть серые коробки и были названы с указанным типом, то это ящик собаки / кошки, о котором я говорил ранее, а изображения выше - это те виды, о которых я говорил
Таким образом, проблема заключалась в том, что, как вы могли видеть на изображении, овощи цикория помещены под падением (где оно принадлежит) во 2-й коробке, из ссылки на код, которую я видел, они делают это такway.
OBJECT , который является элементом, равным только 1 CONTAINER , который является коробкой
, я продолжал искать пути, которые позволят1 изображение, если перетащить его в указанные типы групп, будет правильным (даже если вы поместите его в 1-й блок, изображение автоматически будет во 2-м блоке, если группа истинна)
также,я заметил, что мой таймер не работает, и текст, который заявляетявляется ли ответ истинным или ложным, производит неправильный или неполный вывод.если вы видите ou i it , то, что я имею в виду, должно быть , вы сделали это
спасибо за тех, кто ответит.я все еще ищу решения, но я не могу найти ту же проблему, что у меня