dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: drag and drop with user feedback

  1. #1
    Junior Member
    Join Date
    Jan 2005
    Posts
    2

    drag and drop with user feedback

    I created a drag and drop game where users drop sections on a map and instantly receive feedback if they are correct or incorrect. I've got the correct feedback working correctly but I cannot figure out the incorrect part as it is below nothing happens. Any help is greatly appreciated.

    stop();

    _global.counter=1;
    _global.totalquestions=10;

    Slogan1="Question 1";
    Slogan2="Question 2";
    Slogan3="Question 3";
    Slogan4="Question 4";
    Slogan5="Question 5";
    Slogan6="Question 6";
    Slogan7="Question 7";
    Slogan8="Question 8";
    Slogan9="Question 9";

    Answer1="Box_A";
    Answer2="Box_B";
    Answer3="Box_C";
    Answer4="Box_D";
    Answer5="Box_E";
    Answer6="Box_F";
    Answer7="Box_G";
    Answer8="Box_H";
    Answer9="Box_I";



    function init(){
    _root.slogan.text=Slogan1;
    _global.answer=Answer1;
    _global.counter++;
    }

    function checkAnswer(guess){
    trace(guess+" "+_global.answer);
    if (guess==_global.answer){
    _root.slogan.text=eval("Slogan"+_global.counter);
    _global.answer=eval("Answer"+_global.counter);
    _global.counter++;

    //_root.result.text="You Are Correct";
    feedback("correct");
    eval("_root." + guess)._alpha=70;
    eval("_root." + guess).active=0;
    if (_global.counter > _global.totalquestions){
    _root.complete.text="Quiz Complete";
    _root.slogan.text="Quiz Complete";
    }

    }else{
    //_root.result.text="You Are Wrong";
    trace("incorrect");
    feedback("incorrect");
    }
    }

    init();

    function feedback (response){
    _root.correct._visible=0;
    _root.incorrect._visible=0;
    clearInterval (_global.feedTime);

    if (response=="correct")
    {_root.correct._visible=1;
    }else{
    trace("incorrect and code is working")
    _root.incorrect._visible=1;
    }
    _global.feedTime=setInterval (clearFeed, 1000, response);

    }

    function clearFeed(response){
    eval("_root."+response)._visible=0;
    clearInterval (_global.feedTime);
    }

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,784
    Hi,

    Attach your *.fla so we can see how you call the fuctions from the drag and drop and we dont have to try and mimic your file.

  3. #3
    Junior Member
    Join Date
    Jan 2005
    Posts
    2

    fla file

    Here is the .fla


    Quote Originally Posted by fruitbeard View Post
    Hi,

    Attach your *.fla so we can see how you call the fuctions from the drag and drop and we dont have to try and mimic your file.
    Attached Files Attached Files

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,784
    Hi,

    Upon opening your file there were errors immediately, have a look at this file to learn about drag and drop with eval() then maybe start your project again as it seems very confused

  5. #5
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,784
    Hi,

    I have put this on my site for you to use and inspect, please say when/if you download it, I will remove it after one week or when you have the files. whichever is sooner.

    Tha should get you well on the way to changing everything.

    Good luck
    http://fruitbeard.net/dd.zip

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center