Jump to content

Actionscript - dropping a box

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
shibbythestoner

shibbythestoner

    Programmer

  • Members
  • PipPipPipPip
  • 135 posts
Hello all.
In a flash file, I have a box which you can drag across the top and when you click it it duplicates itself. However, the code which is supposed to make this box fall until it hits the "floor" (a movie clip spanning across the bottom of the platform), does not operate, leaving the box suspended in mid-air. Syntax check says no errors, so I was wondering if anyone here could help me out? Here's the code:
function drop(b){
    b.onEnterFrame=function(){
        _root[b]._y-=20;
        if(_root[b].hitTest(_root["floor"])){
            _root[b].play();
            removeMovieClip(_root[b]);
        }
    }
}
startDrag(box,true,20,30,530,20);
_global.i=-1;
_root["box"].onPress=function(){
    _global.i++;
    duplicateMovieClip(box,("dbox"+i),i);
    drop(("dbox"+i));
}

Posted Image

#2
Lop

Lop

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,172 posts
I've never seen that type of code before. That is Flash?

#3
shibbythestoner

shibbythestoner

    Programmer

  • Members
  • PipPipPipPip
  • 135 posts
It's Flash Actionscript, Lop:
ActionScript - Wikipedia, the free encyclopedia
Posted Image

#4
shibbythestoner

shibbythestoner

    Programmer

  • Members
  • PipPipPipPip
  • 135 posts
Well never mind, I've messed about a lot more with similar coding since I started this thread and that has worked out fine, so I guess the probem solved itself.
Posted Image