Problem with drag and drop


hi! i'm having problem getting code working, want drag , drop 2 things onto things dissapear moves onto new page, first item works second item wont dissapear , remains stuck cursor. heres code i'd greatful of help.

 

import flash.events.mouseevent;

import fl.motion.motionevent;

 

stop();

 

back6_btn.addeventlistener(mouseevent.click, onback6click)

 

function onback6click(event:mouseevent):void{

    gotoandplay("bedroom2");

}

    forward6_btn.addeventlistener(mouseevent.click, onforward6click)

 

function onforward6click(event:mouseevent):void{

    gotoandplay('brother bit');

}

 

 

var ingran:number=0;

 

 

gin.addeventlistener(mouseevent.mouse_down, dragon);

tonic.addeventlistener(mouseevent.mouse_down, dragon);

 

function dragon(event:mouseevent):void {

    event.target.startdrag(false);

}

{

    stage.addeventlistener(mouseevent.mouse_up, dragoff);

    }

 

function dragoff(event:mouseevent):void {

    event.target.stopdrag();

    if (event.target.droptarget!=null&&event.target.droptarget.parent==gran) {

        event.target.visible=false;

        ingran++;

    }

    stage.removeeventlistener(mouseevent.mouse_up, dragoff);

}

 

 

 

function checkpage(e:event):void {

    if (ingran==2) {

        gotoandplay("bedroom1");

    }

}

try:

 

 

import flash.events.mouseevent;

import fl.motion.motionevent;

 

stop();

 

back6_btn.addeventlistener(mouseevent.click, onback6click)

 

function onback6click(event:mouseevent):void{

    gotoandplay("bedroom2");

}

    forward6_btn.addeventlistener(mouseevent.click, onforward6click)

 

function onforward6click(event:mouseevent):void{

    gotoandplay('brother bit');

}

 

 

var ingran:number=0;

 

 

gin.addeventlistener(mouseevent.mouse_down, dragon);

tonic.addeventlistener(mouseevent.mouse_down, dragon);

 

function dragon(event:mouseevent):void {

event.currenttarget.parent.addchild(event.currenttarget);

    event.target.startdrag(false);

}

{

    stage.addeventlistener(mouseevent.mouse_up, dragoff);

    }

 

function dragoff(event:mouseevent):void {

    event.target.stopdrag();

    if (event.target.droptarget!=null&&event.target.droptarget.parent==gran) {

        event.target.visible=false;

        ingran++;

    }

    stage.removeeventlistener(mouseevent.mouse_up, dragoff);

}

 

 

 

function checkpage(e:event):void {

    if (ingran==2) {

        gotoandplay("bedroom1");

    }

}



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account