A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Want background to appear on HitTest

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    2

    Want background to appear on HitTest

    Hey. I just have a quick problem. Everything is working fine, but I just need help with something. Basically this code just drags objects and then puts them inside of another object if it hits it when dropped.
    I want the background to be hidden to begin with.
    How can I get, when 3-4 boxes are all in the correct place, for the background to appear stating the player a winner?
    Code:
    
    Mover.onPress = function()
    {
    	Mover.startDrag();
    };
    Mover.onRelease = function(Onrelease)
    {
    	if(Mover._droptarget=="/Base") 
    	{
    		// align Sprite3
    		Mover._x = Base._x + (Base._width-Mover._width)/2-15;
    		Mover._y = Base._y + (Base._height-Mover._height)/2-7;
    	};
    	if(Mover._droptarget=="/Base2") 
    	{
    		// align Sprite3
    		Mover._x = Base2._x + (Base2._width-Mover._width)/2-15;
    		Mover._y = Base2._y + (Base2._height-Mover._height)/2-7;
    	};
    	if(Mover._droptarget=="/Base3") 
    	{
    		// align Sprite3
    		Mover._x = Base3._x + (Base3._width-Mover._width)/2-15;
    		Mover._y = Base3._y + (Base3._height-Mover._height)/2-7;
    	};
    	if(Mover._droptarget=="/Base4") 
    	{
    		// align Sprite3
    		Mover._x = Base4._x + (Base4._width-Mover._width)/2-15;
    		Mover._y = Base4._y + (Base4._height-Mover._height)/2-7;
    	};
    	if(Mover._droptarget=="/Base5") 
    	{
    		// align Sprite3
    		Mover._x = Base5._x + (Base5._width-Mover._width)/2-15;
    		Mover._y = Base5._y + (Base5._height-Mover._height)/2-7;
    	};
    	Mover.stopDrag();
    };
    //////////////////////////////////////////////////MOVER2
    Mover2.onPress = function()
    {
    	Mover2.startDrag();
    };
    Mover2.onRelease = function()
    {
    	if(Mover2._droptarget=="/Base") 
    	{
    		// align Sprite3
    		Mover2._x = Base._x + (Base._width-Mover2._width)/2-15;
    		Mover2._y = Base._y + (Base._height-Mover2._height)/2-7;
    	};
    	if(Mover2._droptarget=="/Base2") 
    	{
    		// align Sprite3
    		Mover2._x = Base2._x + (Base2._width-Mover2._width)/2-15;
    		Mover2._y = Base2._y + (Base2._height-Mover2._height)/2-7;
    	};
    	if(Mover2._droptarget=="/Base3") 
    	{
    		// align Sprite3
    		Mover2._x = Base3._x + (Base3._width-Mover2._width)/2-15;
    		Mover2._y = Base3._y + (Base3._height-Mover2._height)/2-7;
    	};
    	if(Mover2._droptarget=="/Base4") 
    	{
    		// align Sprite3
    		Mover2._x = Base4._x + (Base4._width-Mover2._width)/2-15;
    		Mover2._y = Base4._y + (Base4._height-Mover2._height)/2-7;
    	};
    	if(Mover2._droptarget=="/Base5") 
    	{
    		// align Sprite3
    		Mover2._x = Base5._x + (Base5._width-Mover2._width)/2-15;
    		Mover2._y = Base5._y + (Base5._height-Mover2._height)/2-7;
    	};	
    	Mover2.stopDrag();
    };
    ///Different Mover
    Mover3.onPress = function()
    {
    	Mover3.startDrag();
    };
    Mover3.onRelease = function()
    {
    	if(Mover3._droptarget=="/Base") 
    	{
    		// align Sprite3
    		Mover3._x = Base._x + (Base._width-Mover3._width)/2-15;
    		Mover3._y = Base._y + (Base._height-Mover3._height)/2-7;
    	};
    	if(Mover3._droptarget=="/Base2") 
    	{
    		// align Sprite3
    		Mover3._x = Base2._x + (Base2._width-Mover3._width)/2-15;
    		Mover3._y = Base2._y + (Base2._height-Mover3._height)/2-7;
    	};
    	if(Mover3._droptarget=="/Base3") 
    	{
    		// align Sprite3
    		Mover3._x = Base3._x + (Base3._width-Mover3._width)/2-15;
    		Mover3._y = Base3._y + (Base3._height-Mover3._height)/2-7;
    	};
    	if(Mover3._droptarget=="/Base4") 
    	{
    		// align Sprite3
    		Mover3._x = Base4._x + (Base4._width-Mover3._width)/2-15;
    		Mover3._y = Base4._y + (Base4._height-Mover3._height)/2-7;
    	};
    	if(Mover3._droptarget=="/Base5") 
    	{
    		// align Sprite3
    		Mover3._x = Base5._x + (Base5._width-Mover3._width)/2-15;
    		Mover3._y = Base5._y + (Base5._height-Mover3._height)/2-7;
    	};
    	Mover3.stopDrag();
    };
    ///Different Mover
    Mover4.onPress = function()
    {
    	Mover4.startDrag();
    };
    Mover4.onRelease = function()
    {
    	if(Mover4._droptarget=="/Base") 
    	{
    		// align Sprite3
    		Mover4._x = Base._x + (Base._width-Mover4._width)/2-15;
    		Mover4._y = Base._y + (Base._height-Mover4._height)/2-7;
    	};
    	if(Mover4._droptarget=="/Base2") 
    	{
    		// align Sprite3
    		Mover4._x = Base2._x + (Base2._width-Mover4._width)/2-15;
    		Mover4._y = Base2._y + (Base2._height-Mover4._height)/2-7;
    	};
    	if(Mover4._droptarget=="/Base3") 
    	{
    		// align Sprite3
    		Mover4._x = Base3._x + (Base3._width-Mover4._width)/2-15;
    		Mover4._y = Base3._y + (Base3._height-Mover4._height)/2-7;
    	};
    	if(Mover4._droptarget=="/Base4") 
    	{
    		// align Sprite3
    		Mover4._x = Base4._x + (Base4._width-Mover4._width)/2-15;
    		Mover4._y = Base4._y + (Base4._height-Mover4._height)/2-7;
    	};
    	if(Mover4._droptarget=="/Base5") 
    	{
    		// align Sprite3
    		Mover4._x = Base5._x + (Base5._width-Mover4._width)/2-15;
    		Mover4._y = Base5._y + (Base5._height-Mover4._height)/2-7;
    	};
    	
    	Mover4.stopDrag();
    };
    ///Different Mover
    Mover5.onPress = function()
    {
    	Mover5.startDrag();
    };
    Mover5.onRelease = function()
    {
    	if(Mover5._droptarget=="/Base") 
    	{
    		// align Sprite3
    		Mover5._x = Base._x + (Base._width-Mover5._width)/2-15;
    		Mover5._y = Base._y + (Base._height-Mover5._height)/2-7;
    	};
    	if(Mover5._droptarget=="/Base2") 
    	{
    		// align Sprite3
    		Mover5._x = Base2._x + (Base2._width-Mover5._width)/2-15;
    		Mover5._y = Base2._y + (Base2._height-Mover5._height)/2-7;
    	};
    	if(Mover5._droptarget=="/Base3") 
    	{
    		// align Sprite3
    		Mover5._x = Base3._x + (Base3._width-Mover5._width)/2-15;
    		Mover5._y = Base3._y + (Base3._height-Mover5._height)/2-7;
    	};
    	if(Mover5._droptarget=="/Base4") 
    	{
    		// align Sprite3
    		Mover5._x = Base4._x + (Base4._width-Mover5._width)/2-15;
    		Mover5._y = Base4._y + (Base4._height-Mover5._height)/2-7;
    	};
    	if(Mover5._droptarget=="/Base5") 
    	{
    		// align Sprite3
    		Mover5._x = Base5._x + (Base5._width-Mover5._width)/2-15;
    		Mover5._y = Base5._y + (Base5._height-Mover5._height)/2-7;
    	};
    	Mover5.stopDrag();
    };
    
    ///////////////////////NEW BASE///////////////////////////////////////////////////////////
    stop();
    
    function ()
    {
    if (Mover.hitTest(Base)) {
        _root.river._visible = false;
        } 
    }

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hello, what is the correct place for the boxes (winning formula), or even just put fla up to mess with

    my site: http://www.fgps.com/keith

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