Thursday, August 12, 2010

Playing and Muting an Audio File in Flash with Actionscript 3.0

var audioLink01:URLRequest = new URLRequest("DanceOfTheMist.mp3");
var sound01:Sound = new Sound();
var soundChannel01:SoundChannel;
var soundPausedPos:int;
var soundIsPlaying:Boolean;

this.loaderInfo.addEventListener(Event.COMPLETE, init);

function init(e:Event) {
//trace("The init function has run");
sound01.load(audioLink01);
mute_mc.addEventListener(MouseEvent.CLICK, muteSounds);
play_mc.addEventListener(MouseEvent.CLICK, playSounds);

}

function playSounds(e:MouseEvent) {
if(soundIsPlaying == true) {

}else{
soundChannel01 = sound01.play(soundPausedPos);
soundIsPlaying = true;
soundChannel01.addEventListener(Event.SOUND_COMPLETE, updateSoundStatus);
}
}

function muteSounds(e:MouseEvent) {
soundPausedPos = soundChannel01.position;
soundChannel01.stop();
soundIsPlaying = false;
}
function updateSoundStatus(e:Event) {
soundIsPlaying = false;
}

Friday, July 30, 2010

Observe–Understand–Innovate

Observe–Understand–Innovate
This is my method of approaching any learning situation. Far to many people are content to merely copy and replicate what they see around them but to truly be creative you must actually strive to improve what we work on.

Saturday, July 24, 2010

Cool After Effects Tip

The beginning and end of the work area bar can be moved either with the cursor by clicking and dragging the and markers or using the keyboard. Pressing the “b” key on the keyboard moves the beginning of the work area bar to the current position of the playhead while pressing the “n” key on the keyboard moves the end of the bar to the playhead's current position.

Thursday, April 22, 2010

3D rotation based on Mouse Position

var defRot:Number = 35;

stage.addEventListener(MouseEvent.MOUSE_MOVE, updateRot);

function updateRot(myEvent:MouseEvent):void {
if(mouseX > 300){
if(imageGallery_mc.rotationY >= defRot){
imageGallery_mc.rotationY = defRot;
}else{
imageGallery_mc.rotationY+= .5;
}
}
if(mouseX < 300){
if(imageGallery_mc.rotationY <= -defRot){
imageGallery_mc.rotationY = -defRot;
}else{
imageGallery_mc.rotationY-= .5;
}
}
if(mouseY > 240){
if(imageGallery_mc.rotationX >= defRot){
imageGallery_mc.rotationX = defRot;
}else{
imageGallery_mc.rotationX+= .5;
}
}
if(mouseY < 240){
if(imageGallery_mc.rotationX <= -defRot){
imageGallery_mc.rotationX = -defRot;
}else{
imageGallery_mc.rotationX-= .5;
}
}
}