Skip to content

Commit

Permalink
Added project files
Browse files Browse the repository at this point in the history
  • Loading branch information
brentkirby committed Oct 5, 2010
0 parents commit e8f885a
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
*.fla
audio_player.fla
video_player.fla
Empty file added README
Empty file.
51 changes: 51 additions & 0 deletions com/kurbmedia/AudioPlayer.as
@@ -0,0 +1,51 @@
package com.kurbmedia{

import flash.display.MovieClip;
import flash.display.Sprite;

import com.kurbmedia.events.AudioEvent;
import com.kurbmedia.configs.AudioConfig;

public class AudioPlayer extends MovieClip{

private var player_base:Sprite;
public var player_data:Object;

private var _config:AudioConfig;

public function AudioPlayer(){

_config = new AudioConfig(stage, MovieClip(root));
addEventListener(AudioEvent.RENDER_COMPLETE, _config.render_complete);

player_data = {
'backgroundColor':0xFFFFFF,
'autoPlay':true,
'borderRadius':'10',
'file':undefined
};

if(root.loaderInfo.parameters.configure != undefined){
for(var i in root.loaderInfo.parameters.configure) player_data[i] = root.loaderInfo.parameters.configure[i];
}

player_base = new Sprite();
player_base.x = player_base.y = 0;

if(player_data.strokeColor != undefined) player_base.graphics.lineStyle(1, uint(player_data.strokeColor));
player_base.graphics.beginFill(uint(player_data.backgroundColor));

if(player_data.borderRadius != undefined){
player_base.graphics.drawRoundRect(0,0, stage.stageWidth, stage.stageHeight, player_data.borderRadius);
}else{
player_base.graphics.drawRect(0,0, stage.stageWidth, stage.stageHeight);
}

player_base.graphics.endFill();
addChild(player_base);

}

}

}
63 changes: 63 additions & 0 deletions com/kurbmedia/configs/AudioConfig.as
@@ -0,0 +1,63 @@
package com.kurbmedia.configs{

import com.kurbmedia.events.AudioEvent;

public class AudioConfig{

private var __stage;
private var __root;

// You shouldn't need to change this function. This provides a way to access both the stage
// and the root of the movie.

public function AudioConfig(stage_instance, root_instance){
__stage = stage_instance;
__root = root_instance;
}

// This function is called when the stage is finished drawing all elements based on the passed configuration.

public function render_complete(e:AudioEvent){

}

// This function is called when the audio initially starts playing, or any time audio
// starts or is re-started from the beginning.

public function audio_start(e:AudioEvent){

}

// This function is called any time the audio is paused.

public function audio_paused(e:AudioEvent){

}

// This function is called any time the audio is un-paused.

public function audio_unpaused(e:AudioEvent){

}

// This function is called any time the audio is explicitly stopped (not paused).

public function audio_stopped(e:AudioEvent){

}

// This function is called any time the audio is muted.

public function audio_mute(e:AudioEvent){

}

// This function is called any time the audio is un-muted.

public function audio_unmute(e:AudioEvent){

}

}

}
13 changes: 13 additions & 0 deletions com/kurbmedia/events/AudioEvent.as
@@ -0,0 +1,13 @@
package com.kurbmedia.events{

import com.kurbmedia.events.PlayerEvent;

public class AudioEvent extends PlayerEvent{

public function AudioEvent(val:String, obj = null){
object = obj;
super(val, true, false);
}
}

}
17 changes: 17 additions & 0 deletions com/kurbmedia/events/PlayerEvent.as
@@ -0,0 +1,17 @@
package com.kurbmedia.events{

import flash.events.Event;

public class PlayerEvent extends Event{

public static const RENDER_COMPLETE:String = "PlayerEvent.RENDER_COMPLETE";

public var object:*;

public function PlannerEvent(val:String, obj = null){
object = obj;
super(val, true, false);
}
}

}

0 comments on commit e8f885a

Please sign in to comment.