Archive for the 'Reyco1 Framework' Category

New "services” package added to the Reyco1 AS3 Tools with an easy to use YouTube api!

Reynaldo February 18th, 2008

Hi all:

There has been a new “services” package added and along with it a very simple to use YouTube api. Simultaneously, the PayPalCart class has been renamed to PayPal and has been moved to this new package as well.

The new YouTube api is very simple to use. All you need is a YouTube developer key which you can get at YouTube and 2 proxy php/aspx files which are provided within the YouTube sample folder. Here’s a small example:

This movie requires Flash Player 9

Here’s the source:

import com.reyco1.services.YouTube;
import com.reyco1.events.YouTubeEvent;
import flash.events.Event;

var objYouTube:YouTube = new YouTube();
var objparameters:Object = new Object();
var flvPlayer:Video = this.player;
var netConnection:NetConnection = new NetConnection();
netConnection.connect(null);
var netStream:NetStream = new NetStream(netConnection);

objparameters.key = "your api key goes here";
objparameters.proxy = "http://www.yourdomain.com/services/YouTube/proxyRequest.php";
objparameters.video_proxy = "http://www.yourdomain.com/services/YouTube/getVideoId.php";
objYouTube.setup(objparameters);

objYouTube.addEventListener(YouTubeEvent.REQUEST_COMPLETE, requestCompleteHandler);
objYouTube.addEventListener(YouTubeEvent.FLV_REQUEST_COMPLETE, flvRequestCompleteHandler);
videoList.addEventListener(Event.CHANGE, onChangeHandler)
searchBtn.addEventListener(MouseEvent.CLICK, searchHandler);

function searchHandler($event:MouseEvent):void
{
	objYouTube.getVideos({tag:tagText.text});
}

function requestCompleteHandler($event:YouTubeEvent):void
{
	var data:XMLList = $event.params.data;

	videoList.labelField = "title";
	videoList.removeAll();
	for each (var video in data) {
		videoList.addItem(video);
	}
}

function flvRequestCompleteHandler($event:YouTubeEvent):void
{
	netConnection.connect(null);
	netStream = new NetStream(netConnection);
	netStream.bufferTime = 5;
	netStream.client = {onMetaData:onMetaHandler};
	flvPlayer.attachNetStream(netStream);
	netStream.play($event.params.path);
}

function onMetaHandler(data:Object) {
	var duration:Number = Number(data.duration);
}

function onChangeHandler($event:Event):void
{
	netStream.close();
	var selectedItemData:XML = videoList.selectedItem as XML;
	objYouTube.requestFLV(selectedItemData.id);
}

Click on the “Reyco1 AS3 Toolset” tab for instructions on documentation and and sub version.

Tags: , , , ,

AudioCuePoint class now baked into SoundManager!

Reynaldo February 15th, 2008

Hi All:

The AudioCuePoint class is now intergrated into the SoundManager class making it that much easier to use. Now you can directly add cue points to your mp3 files directly from the SoundManager instance! Here is a sample MP3 player with code:

Sample:

This movie requires Flash Player 9

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import com.reyco1.audio.SoundManager;
import com.reyco1.events.SoundEvent;
import com.reyco1.util.DateUtil;
import flash.events.MouseEvent;
 
var sm:SoundManager = new SoundManager();
var myMP3:String = "Bachata";
 
sm.addToQueue(myMP3, "http://www.reynaldocolumna.com/blog/stuff/bachata.mp3");
 
sm.addEventListener(SoundEvent.LOAD_PROGRESS, loadProgressHanlder);
sm.addEventListener(SoundEvent.ALL_SOUNDS_LOADED, soundsLoadedHanlder);
sm.addEventListener(SoundEvent.SOUND_PROGRESS, positionHandler);
sm.addEventListener(SoundEvent.CUE_POINT, cuePointHandler);
 
sm.loadSounds();
 
this.playBtn.enabled = false;
this.stopBtn.enabled = false;
 
function loadProgressHanlder($event:SoundEvent):void
{
	statusTxt.htmlText = "Loading "+$event.params.currentFileIndex+" of "+$event.params.totalFiles+", "+$event.params.percent+"%"
}
 
function soundsLoadedHanlder($event:SoundEvent):void
{
	statusTxt.text = "Press play."; 
 
	sm.addCuePoint(myMP3, {name:"pnt1", time:5});
	sm.addCuePoint(myMP3, {name:"pnt2", time:10});
 
	pBar.mode = "manual";
	pBar.maximum = sm.getDuration(myMP3);
	pBar.minimum = 0;
 
	this.playBtn.enabled = true;
	this.stopBtn.enabled = true;
 
	this.stopBtn.addEventListener(MouseEvent.CLICK, stopSound);
	this.playBtn.addEventListener(MouseEvent.CLICK, playSound);
}
 
function playSound($event:MouseEvent):void
{
	if(sm.isPaused(myMP3)){
		sm.play(myMP3);
		sm.getChannel(myMP3).addEventListener(SoundEvent.SOUND_COMPLETE, stopSound);
		playBtn.label = "Pause";
	} else{
		sm.pause(myMP3);
		playBtn.label = "Play";
		statusTxt.text = "Paused at "+DateUtil.secToFormattedTime(sm.getPosition(myMP3))+".";
	}
}
 
function stopSound($event:*):void
{
	resetApp();
}
 
function resetApp():void
{
	sm.stop(myMP3);
	sm.getChannel(myMP3).removeEventListener(SoundEvent.SOUND_COMPLETE, stopSound);
        sm.resetCuePoints(myMP3);
	statusTxt.text = "Press play.";
	playBtn.label = "Play";
	pBar.value = 0;
}
 
function positionHandler($event:SoundEvent):void
{
	pBar.value = $event.params.position
	statusTxt.htmlText = "<strong>"+$event.params.name+"</strong> playing at "+DateUtil.secToFormattedTime($event.params.position)+" of "+DateUtil.secToFormattedTime($event.params.duration)+" seconds. Percentage : "+$event.params.percentage+"%";
}
 
function cuePointHandler($event:SoundEvent):void
{
	cueTxt.text = "cueOwner: "+$event.params.owner+", cueName: "+$event.params.name+", cueTime: "+$event.params.time;
}

You can get the code from the Reyco1 AS3 Tools samples folder.

New Audio package added to the Reyco1 AS3 Toolset

Reynaldo February 15th, 2008

Hi all:

I have added a new class package to the Reyco1 AS3 Tools which includes a SoundManager and an AudioCuePoint class both with their corresponding events classes: SoundEvent and AudioCuePointEvent. The SoundManager allows you to easily load and control a single or multiple mp3 files from either the library or externally. While the AudioCuePoint class allows you to dynamically add cue points to your audio files.

mp3Player

All files and samples are hosted at google code. You can grab then here: http://reyco1.googlecode.com/svn/trunk

Happy coding!!

Tags: , , , , ,

New "Reyco1 AS3 Tools” class - CuePointManager and CuePointEvent

Reynaldo February 7th, 2008

Hi fellow flashers and flashettes!

There has been a new pair of classes added to the tool set. The CuePointManager and the CuePointEvent. The CuePointManager class allows you to add, move, remove and handle cue points easily for your flv files dynamically. Here’s an example:

This movie requires Flash Player 9

Here’s the code for this example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import com.reyco1.manager.CuePointManager;
import com.reyco1.events.CuePointEvent;
 
my_FLVPlybk.source = "http://www.reynaldocolumna.com/blog/stuff/absinthe.flv";
 
var cpm:CuePointManager = new CuePointManager(my_FLVPlybk);
 
cpm.addCuePoint({name:"pnt1", time:2});
cpm.addCuePoint({name:"pnt2", time:5});
cpm.addCuePoint({name:"pnt3", time:10});
 
cpm.addEventListener(CuePointEvent.CUE_POINT, cpHandler);
 
function cpHandler($event:CuePointEvent):void
{
	output.text += "cue point name: "+$event.params.name+", time: "+Math.round($event.params.time)+"\n";
}

This and other classes can be found in the Reyco1 AS3 Tools.

"Reyco1 Framework” renamed to “Reyco1 AS3 Tools”

Reynaldo February 5th, 2008

Hi all:

As I kept adding more and more utilities and managers to the now-known-as Reyco1 AS3 Tools, I noticed that it was taking the direction of a collection of tools and utilities and not an actual framework. Don’t get me wrong though, I am still developing the “Reyco1 Framework”.

The new Reyco1 Framework will be released sometime mid March and will be a two part project: A Website Development Framework and a Desktop Development Framework (coded around AIR ofcourse). In the meantime, more and more tools, utilities, managers and mini api’s will be added to the Reyco1 AS3 Tools on a constant basis. Please refer to this post for information on documentation and download.

Next »

  • Friends

  • Props

  • Donations

  • website counter
  • Archives

  • Feedburner

  • Saavn