Go Back   kirupaForum > Flash > ActionScript 1.0/2.0

Reply
 
Thread Tools Display Modes
Old 11-12-2009, 03:46 PM   #1
eimbert
Registered User
Help with flash player displaying title artist

Hi I need some help with a code for my flash player. It displays the artist and the song on one line. I would like it to be displayed separately .
Artist
Song
. Since there are four lines on the code for displaying song information, I could just replace one line in the code “URL” and have it replaced with the song item. If there is someone that could take a look at the code and assist me I will really appreciate it .

Thanks
Eliott



var nc:NetConnection = null;
var nsPlay:NetStream = null;
var metaDataValues:Array = new Array();

function initialize()
{
_root.connect.streamStr.text = "http://71.?????????????/";
_root.connect.connectStr.text = "rtmp://71????????????/restream/";
_root.connect.connectButton.onPress = _root.doConnect;
_root.connect.connectButton2.onPress = _root.doConnect;
//enablePlayControls(false);

metaDataValues["title"] = "";
metaDataValues["genre"] = "";
metaDataValues["name"] = "";
metaDataValues["url"] = "";

doConnect();

trace(System.capabilities.version);
}

function updateMetaData()
{
var metaStr = "";
var colortitulo = "#d00005";
var colortexto = "#0033CA";
if (metaDataValues["title"] != "")
metaStr += "<b><font size='13' color='"+colortitulo+"'>Canción: </font></b><font color='"+colortexto+"'>"+metaDataValues["title"]+"</font>\n";
var texto="";
texto+= metaDataValues["title"];
texto1.text =texto;
if (metaDataValues["genre"] != "")
metaStr += "<b><font size='13' color='"+colortitulo+"'>Genero: </font></b><font color='"+colortexto+"'>"+metaDataValues["genre"]+"</font>\n";
if (metaDataValues["name"] != "")
metaStr += "<b><font size='13' color='"+colortitulo+"'>Emisora: </font></b><font color='"+colortexto+"'>"+metaDataValues["name"]+"</font>\n";
if (metaDataValues["url"] != "")
metaStr += "<b><font size='13' color='"+colortitulo+"'>URL: </font></b><font color='"+colortexto+"'>"+metaDataValues["url"]+"</font>\n";
metaDataText.text = metaStr;
texto1.html = true;
texto1.htmlText = metaStr;

}

function doConnect()
{
// connect to the Wowza Media Server
if (nc == null)
{
// create a connection to the wowza media server
nc = new NetConnection();

// get status information from the NetConnection object
nc.onStatus = function(infoObject)
{
trace("nc: "+infoObject.code+" ("+infoObject.description+")");
if (infoObject.code == "NetConnection.Connect.Success")
playShoutcast();
}

nc.connect(_root.connect.connectStr.text);

enablePlayControls(true);
}
else
{
if (nsPlay != null)
{
nsPlay.attachVideo(null);
nsPlay.attachAudio(null);
}
nsPlay = null;

nc.close();
nc = null;

metaDataValues["title"] = "";
metaDataValues["genre"] = "";
metaDataValues["name"] = "";
metaDataValues["url"] = "";
updateMetaData();

enablePlayControls(false);

}
}

function enablePlayControls(isEnable:Boolean)
{
}

function playShoutcast()
{
// create a new NetStream object for video playback
nsPlay = new NetStream(nc);

// trace the NetStream status information
nsPlay.onStatus = function(infoObject)
{
trace("nsPlay: "+infoObject.code+" ("+infoObject.description+")");
}

nsPlay.onHeaderData = function(infoObject:Object)
{
trace("onHeaderData");

// print debug information about the metaData
for (var propName:String in infoObject)
{
trace(" "+propName + " = " + infoObject[propName]);
}
if (infoObject["icy-genre"] != undefined)
metaDataValues["genre"] = infoObject["icy-genre"];
if (infoObject["icy-name"] != undefined)
metaDataValues["name"] = infoObject["icy-name"];
updateMetaData();
}

nsPlay.onMetaData = function(infoObject:Object)
{
trace("onMetaData");

// print debug information about the metaData
for (var propName:String in infoObject)
{
trace(" "+propName + " = " + infoObject[propName]);
}
if (infoObject["StreamTitle"] != undefined)
metaDataValues["title"] = infoObject["StreamTitle"];
if (infoObject["StreamUrl"] != undefined)
metaDataValues["url"] = infoObject["StreamUrl"];
updateMetaData();
}

// set the buffer time to zero since it is chat
nsPlay.setBufferTime(10);

// subscribe to the named stream
nsPlay.play(_root.connect.streamStr.text);

// attach to the stream
soundRemote.attachAudio(nsPlay);
}

Stage.align = "TL";
Stage.scaleMode = "noScale";
_global.style.setStyle("backgroundColor","0xFFCC00 ");
initialize();
eimbert is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:15 PM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com