Monday, May 15, 2017

Graduation Video, Drag& Drop, Yearbook

DO NOW:
Upload photos and videos for Monday meeting. Share with me (Jdusza@ocvts.org) for $60

OBJECTIVES:
Reset button and drop sound demo
EXAMPLE  HIT SOUND
Video importing and editing demo
Yearbook Page discussion

Code to copy/paste into actions:
stop();
//Coding for potato head demo. The names of the objects can easily be changed to a,b,c...etc. :)

var orig1X:Number=item1.x;
var orig1Y:Number=item1.y;

var myBoing:boing  = new boing ();

item1.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);
item1.addEventListener (MouseEvent.MOUSE_UP, itemRelease);


function dragTheObject(event:MouseEvent):void {
var item:MovieClip=MovieClip(event.target);
item.startDrag();
var topPos:uint=this.numChildren-1;
this.setChildIndex(item, topPos);
}

function itemRelease(event:MouseEvent):void {
var thisItem:MovieClip=MovieClip(event.target);
thisItem.stopDrag();
myBoing.play();
};

function reset(event:MouseEvent):void {
     item1.x=orig1X;
     item1.y=orig1Y;

}
           
item1.buttonMode = true;


reset_btn.addEventListener(MouseEvent.CLICK, reset);
reset_btn.buttonMode = true;

1 comment:

  1. stop();

    /* Click to Go to Scene and Play
    Clicking on the specified symbol instance plays the movie from the specified scene and frame.

    Instructions:
    1. Replace "Scene 3" with the name of the scene you would like play.
    2. Replace 1 with the frame number you would like the movie to play from in the specified scene.
    */
    var orig1X:Number=item1.x;
    var orig1Y:Number=item1.y;

    var orig2X:Number=item2.x;
    var orig2Y:Number=item2.y;

    var orig3X:Number=item3.x;
    var orig3Y:Number=item3.y;

    var orig4X:Number=item4.x;
    var orig4Y:Number=item4.y;

    var myBoing:boing = new boing ();

    item1.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);
    item1.addEventListener (MouseEvent.MOUSE_UP, itemRelease);
    item2.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);
    item2.addEventListener (MouseEvent.MOUSE_UP, itemRelease);
    item3.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);
    item3.addEventListener (MouseEvent.MOUSE_UP, itemRelease);
    item4.addEventListener(MouseEvent.MOUSE_DOWN, dragTheObject);
    item4.addEventListener (MouseEvent.MOUSE_UP, itemRelease);


    function dragTheObject(event:MouseEvent):void {
    var item:MovieClip=MovieClip(event.target);
    item.startDrag();
    var topPos:uint=this.numChildren-1;
    this.setChildIndex(item, topPos);
    }

    function itemRelease(event:MouseEvent):void {
    var thisItem:MovieClip=MovieClip(event.target);
    thisItem.stopDrag();
    myBoing.play();
    };

    function reset(event:MouseEvent):void {
    item1.x=orig1X;
    item1.y=orig1Y;
    item2.x=orig2X;
    item2.y=orig2Y;
    item3.x=orig3X;
    item3.y=orig3Y;
    item4.x=orig4X;
    item4.y=orig4Y;
    }

    item1.buttonMode = true;
    item2.buttonMode = true;
    item3.buttonMode = true;
    item4.buttonMode = true;

    reset_btn.addEventListener(MouseEvent.CLICK, reset);
    reset_btn.buttonMode = true;

    ReplyDelete