Hi guys im completely new to this so go easy
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Hi guys im completely new to this so go easy

  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    1

    Hi guys im completely new to this so go easy

    Hi guys basically I have to make a interactive Ebook in flash for a university project, Ive been getting along ok so far but Ive come unstuck a bit on one part. In this bit the user needs to take some gin and tonic to his grandma to progress to the next stage of the story. What I want to happen is that when they drag and drop the items on the grandma character they disappear then when both items have been placed on her it goes to the next page of the story. what is happening is the first item will disappear but the second wont thus no progression, I am not getting any errors in the compiler so I dont know whats wrong with it, could anyone please help? Heres the code


    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.dropT arget.parent==Gran) {
    event.target.visible=false;
    inGran++;
    }
    stage.removeEventListener(MouseEvent.MOUSE_UP, dragOff);
    }



    function checkPage(e:Event):void {
    if (inGran==2) {
    gotoAndPlay("Bedroom1");
    }
    }



    Thanks in advance!

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    106
    You need to call your checkPage function after you increment your inGran variable

    Code:
    if (event.target.dropTarget!=null&&event.target.dropT arget.parent==Gran) {
    event.target.visible=false;
    inGran++;
    checkPage();
    }
    I also dont see why you need to pass an event into the checkPage function.

    Does it matter which item is dropped first?

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

Poll by Flashkit.com