Attach XML playlist

I'm creating xml player. xml process and playing single video is fine. i stuck at multiple videos playing. give me any solution please..?
i have 3 buttons, if i click button_1 play first video, or if i click button_3 play 3rd video.
how to attach videoURL = playlist files.
var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("video_list.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void
          myXML = new XML(e.target.data);
          trace(myXML.Video[0]);
button_1.addEventListener(MouseEvent.CLICK, btn1Click);
button_2.addEventListener(MouseEvent.CLICK, btn2Click);
function btn1Click(e:MouseEvent):void
          ns.play(myXML.Video[0]);
function btn2Click(e:MouseEvent):void
          ns.play(myXML.Video[1]);
var videoURL:String;
//var videoURL:String = "http://www.helpexamples.com/flash/video/cuepoints.flv";
var nConnection:NetConnection;
var ns:NetStream;
var video:Video = new Video();
nConnection = new NetConnection();
nConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
nConnection.connect(null);
function netStatusHandler(event:NetStatusEvent):void
          switch (event.info.code)
                    case "NetConnection.Connect.Success" :
                              connectStream();
                              break;
                    case "NetStream.Play.Stop" :
                              break;
                    default :
function connectStream():void
          ns = new NetStream(nConnection);
          ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
          vidDisplay.attachNetStream(ns);
          ns.play(videoURL);
XML
<?xml version="1.0" encoding="utf-8"?>
<Playlist>
<Video Title="Chapter 1">media/video_1.flv</Video>
<Video Title="Chapter 2">media/video_2.flv</Video>
</Playlist>

everything should work as long as you wait for xml loading to complete before clicking your buttons.  you can disable those buttons when you app starts and enable them in processXML.
var videoURL:String;
var myXML:XML;
var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("video_list.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void
button_1.enabled=true;
button_2.enabled=true;
          myXML = new XML(e.target.data);
          trace(myXML.Video[0]);
button_1.addEventListener(MouseEvent.CLICK, btn1Click);
button_2.addEventListener(MouseEvent.CLICK, btn2Click);
button_1.enabled=false;
button_2.enabled=false;
function btn1Click(e:MouseEvent):void
videoURL=myXML.Video[0];
          ns.play(myXML.Video[0]);
function btn2Click(e:MouseEvent):void
videoURL=myXML.Video[1];
          ns.play(myXML.Video[1]);
var nConnection:NetConnection = new NetConnection();
nConnection.connect(null);
var ns:NetStream = new NetStream(nConnection);
ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
var video:Video = new Video();
video.attachNetStream(ns);
addChild(video);
function netStatusHandler(event:NetStatusEvent):void { 
// you have no useful code here
play_btn.addEventListener(MouseEvent.CLICK, playClicked);
pause_btn.addEventListener(MouseEvent.CLICK, pauseClicked);
play_btn.visible = false;
var videoPaused:Boolean = false;
function playClicked(e:MouseEvent):void{
          if(!videoPaused)
                    ns.play(videoURL);
          else
                    ns.resume();
  play_btn.visible = false;
function pauseClicked(e:MouseEvent):void
          ns.pause();
  play_btn.visible = true;
          videoPaused = true;

Similar Messages

  • Making xml playlist to play swf files inside one swf

    Hi,
    I have made an swf file and xml playlist.
    I want to include swf filepaths in xml playlist so i would be able to choose from my the list, which file i want to play.
    My list-component reads data from the xml, but i cannot get the swf files open there.
    I will attach my .fla file so you understand what i'm talking about.
    the .fla:
    http://www.mediafire.com/file/m24dz0gmzwz/Untitled-1.fla
    xml file:
    http://www.mediafire.com/file/gdyzzymy5mn/swfList.xml
    would you guys look at my files? i know i can play .flv files but i want to know how to play swf files inside another swf. The swf files should be loaded to  by the xml list.

    Hi
    we want to give some clarifications
    As per our requirement we need to play same swf file ( about
    5 in number) always.
    These swf files are kept in some folder and during run time
    we need to play these swf files inside our Mac / windows
    application using flash player.
    we don't need to play any swf file, but the same swf files
    we need a api / sdk to implement this
    Any help will be very well appreciated
    Sudesh

  • Running a live stream from an XML playlist

    I have just successfully installed Adobe FMS on my server.
    I would now like to know how to program a script to run a continuous live stream, of MP4 videos, from an XML playlist.
    Can anyone tell me how to do this? ...or provide me a good tutorial? (I am a complete newbie to ActionScript.)
    Thanks in advance...

    application.allowDebug = true;
    application.onAppStart = function(){
    this.userID =0;
    this.playObj = new Object();
    this.timObj = new Object();
    this.passCli = new Object();
    this.couObj = new Object();
    this.couObj.count = 1;
    application.so0 = SharedObject.get("so",false);
    this.dates = new Object;
    this.dates.dat0 = new Date().valueOf()+"a";
    this.dates.dat1 = new Date().valueOf()+"b";
    this.dates.dat2 = new Date().valueOf()+"c";
    this.dates.dat3 = new Date().valueOf()+"d";
    this.myStream = new Object;
    this.myStream.st = Stream.get (this.dates.dat0.toString());
    this.myStream.st1 = Stream.get (this.dates.dat1.toString());
    this.myStream.st2 = Stream.get (this.dates.dat2.toString());
    this.myStream.st3 = Stream.get (this.dates.dat3.toString());
    this.int0
    this.int1
    this.int2
    this.int3
    this.int4
    this.lock0=0;
    this.lock1=0;
    this.lock2=0;
    this.lock3=0;
    this.lock4=0;
    listen();
    function listen(){
    clearInterval(application.int3);
    application.int0 = setInterval(time,1000,application.myStream.st);
    application.myStream.st.onStatus = function(info){
    if(info.code == "NetStream.Play.Stop"&&application.lock0==0){
      trace("code0"+info.code);
      clearInterval(application.int0);
      application.timObj.tim = 0;
      application.int1 = setInterval(time,1000,application.myStream.st1);
      application.couObj.count = 2;
      playcurr(application.passCli.cli);
      switchStream(application.so0);
      listen1(application.myStream.st1);
      application.lock0=1;
      function listen1(mystreamst1){
      mystreamst1.onStatus = function(info){
    if(info.code == "NetStream.Play.Stop"&&application.lock1==0){
      trace("code1"+info.code);
      mystreamst1 = null;
      clearInterval(application.int1);
      application.timObj.tim = 0;
      application.int2 = setInterval(time,1000,application.myStream.st2);
      application.couObj.count = 3;
      playcurr(application.passCli.cli);
      switchStream(application.so0);
      listen2(application.myStream.st2);
      application.lock1=1
      function listen2 (mystream2){
    mystream2.onStatus = function(info){
    trace("code2"+info.code);
    if(info.code == "NetStream.Play.Stop"&&application.lock2==0){
      clearInterval(application.int2);
      application.mystream2 = null;
      application.timObj.tim = 0;
      //application.int3 = setInterval(time,1000,application.myStream.st3);
      application.couObj.count = 4;
      playcurr(application.passCli.cli);
      switchStream(application.so0);
         application.lock2=1;
      listen3(application.myStream.st3);
      function listen3(mystream3){
    mystream3.onStatus = function(info){
    trace("code3"+info.code);
    if(info.code == "NetStream.Play.Stop"&&application.lock3==0){
      trace("yes yes yes yes yes yes");
      clearInterval(application.int3);
      application.couObj.count = 1;
      mystream3 = null;
      application.timObj.tim = 0;
      //application.int4 = setInterval(time,1000,application.myStream.st);
      playcurr(application.passCli.cli);
      switchStream(application.so0);
      application.lock0=0;
      application.lock1=0;
      application.lock2=0;
      application.lock3=0;
    application.dates.dat0 = new Date().valueOf()+"e";
    application.dates.dat1 = new Date().valueOf()+"f";
    application.dates.dat2 = new Date().valueOf()+"g";
    application.dates.dat3 = new Date().valueOf()+"h";
    application.myStream.st = Stream.get (application.dates.dat0.toString());
    application.myStream.st1 = Stream.get (application.dates.dat1.toString());
    application.myStream.st2 = Stream.get (application.dates.dat2.toString());
    application.myStream.st3 = Stream.get (application.dates.dat3.toString());
    application.myStream.st.play(application.playObj.vid[0],0,-1,0);
    application.myStream.st1.play(application.playObj.vid[1],0,-1,0);
    application.myStream.st2.play(application.playObj.vid[2],0,-1,0);
    application.myStream.st3.play(application.playObj.vid[3],0,-1,0);
    listen();
    ///here next
    application.onConnect = function(client){
    application.acceptConnection(client);
    application.passCli.cli = client;
    client.call("setUserID",null,this.userID);
    this.userID++;
    if(application.clients.length == 1 ){
    videoArray = new Array();
    var playlist = new XML();
    playlist.ignoreWhite = true;
    //parse xml play list for individual elements
    playlist.onLoad = function( success ) {
    if(playlist.loaded == true) {
    if (playlist.firstChild.hasChildNodes()) {
    for (var aNode = playlist.firstChild.firstChild; aNode != null; aNode=aNode.nextSibling) {
    if (aNode.nodeType == 1) {
    //create array from parsed xml elements.
    videoArray[aNode.attributes.id] = aNode.attributes.name ;
    //pass array out of onload function
    application.playObj.vid = videoArray;
    application.myStream.st.play(application.playObj.vid[0],0,-1,0);
    application.myStream.st1.play(application.playObj.vid[1],0,-1,0);
    application.myStream.st2.play(application.playObj.vid[2],0,-1,0);
    application.myStream.st3.play(application.playObj.vid[3],0,-1,0);
    pass0(videoArray);
    //play first video on playlist
    playlist.load("http://www.privatechatnow.com/fmsuser/playlist.xml");
    }//end onetime if statement
    function pass0(videoArray){
      //receive array
      //play intial video
      if(application.clients.length == 1){
    // application.playObj.vid=videoArray;
    playcurr(application.passCli.cli);
    for (var key in application.playObj){
    trace(key + ": " + application.playObj[key]);
       //put currently playing videio into object
      //isolate playlist switching loop for each connected client
      //listen to currently playing stream with onStatus
      //change to next video in playlist
      //use onStatus and current duration and seek to scrub to cuurently playin video each time a user connects.
      //continue untill playlist is played then loop back to first video in playlist.
        //onConnect play currently playing video
    if (application.clients.length >1){
    playcurr(application.passCli.cli);
    //message client with currently play flv
    //message client when flv changes
    //message client with metadata
    application.onPublish = function(clientObject, streamObject){
    trace("Stream name :: "+streamObject.name);
    function switchStream(so0){
    if(application.couObj.count == 1){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[0].length;
        nextlen = application.playObj.vid[1].length;
    so0.send("playSecond",application.playObj.vid[0],clength,currlen,nextlen);
    if(application.couObj.count == 2){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[1].length;
    nextlen = application.playObj.vid[2].length;
        so0.send("playSecond",application.playObj.vid[1],clength,currlen,nextlen);
    if(application.couObj.count == 3){
    clength = application.timObj.tim-3;
    currlen = application.playObj.vid[2].length;
      nextlen = application.playObj.vid[3].length;
        so0.send("playSecond",application.playObj.vid[2],clength,currlen,nextlen);
    if(application.couObj.count == 4){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[3].length;
      nextlen = application.playObj.vid[0].length;
        so0.send("playSecond",application.playObj.vid[3],clength,currlen,nextlen);
    function playcurr(client){
    trace("count = "+application.couObj.count.toString());
    if(application.couObj.count ==1){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[0].length;
      nextlen = application.playObj.vid[1].length;
        client.call("playZero",null,application.playObj.vid[0],clength,currlen,nextlen); 
    if(application.couObj.count ==2){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[1].length;
      nextlen = application.playObj.vid[2].length;
        client.call("playZero",null,application.playObj.vid[1],clength,currlen,nextlen); 
    if(application.couObj.count ==3){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[2].length;
      nextlen = application.playObj.vid[3].length;
        client.call("playZero",null,application.playObj.vid[2],clength,currlen,nextlen); 
    if(application.couObj.count ==4){
        clength = application.timObj.tim-3;
    currlen = application.playObj.vid[3].length;
      nextlen = application.playObj.vid[0].length;
        client.call("playZero",null,application.playObj.vid[3],clength,currlen,nextlen); 
    application.onDisconnect = function(oldclient){
    if(application.clients.length ==0){
    this.userID--;
    function time(myStream){
    application.timObj.tim = myStream.time;

  • Need help embedding a mp3 player swf with xml playlist

    Im a noob to Flash (started tuesday, haha) and so far everything is coming along just fine, but i need to put music in the swf. I have a button set up that slides a swf mp3 player in from the side but i dont know how to make the playlist work with it.
    The player is from this site:
    http://www.bezzmedia.com/swfspot/samples/flash8/Mp3_Player_with_XML_Playlist
    Using the xml playlist with html is simple enough, but im not sure how to use it with Flash Catalyst. Is there an easy way to do this?
    My original plan was to have a text list of the songs with a play button next to each one, then when you click on the play button it would set the state of any other songs to Stopped so you can just pick what song to play and if another song was playing it would stop. Im not sure how to do this either (like i said, i started learning this week), so i just tried embedding someone else's (ugly) mp3 player.
    Anyway, if anyone knows a relatively easy way to have a playlist in my swf please let me know. Thanks!

    If I understand you correctly, you've imported a SWF into Catalyst using Import Artwork on the File menu. When your app runs, you want to pass that swf a parameter that tells it what URL to read a data file from. The SWF is not one that you've created, rather, you got it from some web site.
    This is not something that you can do in Catalyst. However it should be possible to do in Flash Builder. I found an article discussing several ways to do it, at http://www.actionscript.org/forums/showthread.php3?t=175951. One idea is the following code snippet
    <fx:Script>
        <![CDATA[
        import flash.events.*;
        private function setVars(event):void
            event.target.content.yyyyyy = "zzzzzz";
        ]]>
    </fx:Script>
    <mx:Image source="xxxxx" complete="setVars(event)" />
    where "xxxxx" is the path of the SWF (you can put it somewhere in your Flash Builder project, or reference it via an URL), and yyyyy is the name of the parameter that the SWF expects, and zzzzzz is the path to the data file. The <Image> tag is what Catalyst created when you imported the SWF. (btw.the Image and SWFLoader tags are almost identical).
    I hope this gives you enough info to make progress.

  • Submit Form as XML / Rename attached XML file

    Hello,
    I am using the followig script to submit a form:
    var Mailto = "[email protected]";
    var mySubject = "This is the subject";
    var myMessage  = "Please find attached my file.";
    var Mail = "mailto:" + Mailto + "?Subject=" + mySubject + "&Body=" + myMessage;
    event.target.submitForm({
    cURL: Mail,
    bEmpty: true,
    cSubmitAs: "XML"
    Unfortunately I cannot change the name of the attached XML file. It is automatically the PDF filename.
    Has anybody an idea how to change the attachement name?
    Many thanks.
    Regards,
    ra_be

    The attachment filename will always be the name of the PDF. The only way to change is to save the PDF under a different name before you email it.
    Paul

  • Attaching xml document to SOAP body

    Hi,
    i have two question.
    Q1: Is it allowed to attach xml document (org.w3c.dom.Document) to SOAP body when sending request to web service.( I have implemented web service to accept attached xml document.)
    Q2: If it is allowed, how thoes the WSDL look like.
    Thanx,
    Alan.

    Hi,
    I am facing the same issue., I want to transform the xml proxy request to SOAP requesting that the business service expects.
    Did you manage to solve the issue, if so, can you please share your solution?
    Thanks

  • Random Play with XML Playlist

    I created a custom flv player and loaded a xml playlist. I
    would like to the play the videos randomly. could anyone help me
    with my script.
    the following is my current action script:
    var nc:NetConnection = new NetConnection();
    nc.connect(null);
    var ns:NetStream = new NetStream(nc);
    ns.setBufferTime(30);
    ns.onStatus = function(info) {
    if(info.code == "NetStream.Buffer.Full") {
    bufferClip._visible = false;
    if(info.code == "NetStream.Buffer.Empty") {
    bufferClip._visible = true;
    if(info.code == "NetStream.Buffer.Stop") {
    ns.seek(0);
    theVideo.attachVideo(ns);
    rewindButton.onRelease = function() {
    ns.seek(0);
    playButton.onRelease = function() {
    ns.pause();
    var videoInterval = setInterval(videoStatus,100);
    var amountLoaded:Number;
    var duration:Number;
    ns["onMetaData"] = function(obj) {
    duration = obj.duration;
    function videoStatus(){
    amountLoaded = ns.bytesLoaded / ns.bytesTotal;
    loader.loadbar._width = amountLoaded * 200;
    loader.scrub._x = ns.time / duration * 200;
    var scrubInterval;
    loader.scrub.onPress = function() {
    clearInterval(videoInterval);
    scrubInterval = setInterval(scrubit,10);
    this.startDrag(false,-5.3,this._y,193.3,this._y);
    loader.scrub.onRelease = loader.scrub.onReleaseOutside =
    function() {
    clearInterval(scrubInterval);
    videoInterval = setInterval(videoStatus,100);
    this.stopDrag();
    function scrubit() {
    ns.seek(Match.floor((loader.scrub._x/200)*duration));
    var theMenu:ContextMenu = new ContextMenu();
    theMenu.hideBuiltInItems();
    _root.menu = theMenu;
    var i1:ContextMenuItem = new ContextMenuItem("::::
    VideoControls ::::",trace);
    theMenu.customItems[0] = i1;
    var i2:ContextMenuItem = new ContextMenuItem("Play / Pause
    Video",pauseIt,true);
    theMenu.customItems[1] = i2;
    var i3:ContextMenuItem = new ContextMenuItem("Replay
    Video",replayIt);
    theMenu.customItems[2] = i3;
    var i4:ContextMenuItem = new ContextMenuItem("Copyright 2006
    VideoLightTV.com",trace,true);
    theMenu.customItems[3] = i4;
    function pauseIt() {
    ns.pause();
    function replayIt() {
    ns.seek(0);
    var vlist:XML = new XML();
    vlist.ignoreWhite = true;
    vlist.onLoad = function() {
    var videos:Array = this.firstChild.childNodes;
    for(i=0;i<videos.length;i++) {
    videoList.addItem(videos
    .attributes.url,videos.attributes.url);
    ns.play(videoList.getItemAt(0).data);
    videoList.selectedIndex = 0;
    var vidList:Object = new Object();
    vidList.change = function() {
    ns.play(videoList.getItemAt(videoList.selectedIndex).data);
    videoList.addEventListener("change",vidList);
    vlist.load("videos.xml");

    Try something like this:
    vidList.change = function() {
    var nextVideo =Math.floor(Math.random()/videos.length);
    ns.play(videoList.getItemAt(nextVideo).data);

  • Global Volume Slider (from library) to control drag and drop xml playlist

    hi there,
    have spent some time doing tutorial and looking online but can't seem to get a volume slider functioning.
    the scenario is :
    3 circles which can be dragged over a target (one for each circle)
    When the circle is placed on its target it loads its respective xml playlist into 4 buttons (play, pause, forward, back)
    I want to be able to create some kind of function to control the volume, either using a slider or a rotary dial, whichever is easiest!
    any help greatly appreciated!

    Be sure you include the SoundTransform class...
    import flash.media.SoundTransform;
    Create a SoundTransform object
    ...named 'st' (I like short names). Create this AFTER the creation of your soundChannel object...
    var st:SoundTransform = channel.soundTransform;
    st.volume = 1;//This sets the volume to 100%
    channel.soundTransform = st;//This associates your SoundChannel object with your SoundChannel object
    Then, for simple testing of this
    ...create some new button...
    halfVol_btn.addEventListener(MouseEvent.CLICK, doHalfVolume);
    function doHalfVolume(e:MouseEvent):void{
       st.volume = .5;//This sets the volume to 50%
    So, now you have a half-baked volume control. Nothing exciting, but this gets you acquainted with the volume part of what you want. You have created, and have access to, the st.volume property to set the volume to whatever you want, from 0 to 1.
    Next, I'd suggest that you practice the creation of your own slider. Search online for tutorials on it, like I mention above (as a Flash programmer, this is something I, and you, end up doing - searching - dozens of times a week at times). In the end, the position of your knob/button/control in the slider is a %: What % is the location of the knob on the total width/height of the slider. This % is what you send to the st.volume property.
    http://www.lmgtfy.com/?q=create+volume+slider+as3
    As an alternative to create your own slider, you can also use the Flash "Slider" component:
    http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/controls/Slider.html
    ...but this, too, requires some getting-up-to-speed with using it.
    Good luck. If you want some actual code examples - you'll find plenty online :-)

  • Help needed to load different xml playlists by clicking button

    Hi there,
    I have a series of buttons, when i double click a button i want to load a new xml file
    I have some functioning code, but when i click on more than one button per run of the application, it will only use the first xml that was clicked / loaded.
    Does anyone have any suggestions I would be really grateful
    Thanks!
    // Music player populated via XML formatted data with associated .mp3 audio files
    // songs to play structured as an XMLList class
    // displays artist and song title in the interface
    cover.visible = false;
    cover2.visible = false;
    // song list base on an XMLList class
    var songList:XMLList;
    // total number of songs in list
    var songsTotal:Number;
    // sound class variable
    var sound:Sound;
    // sound channnel variable to play, pause and stop the sound
    var soundChannel:SoundChannel;
    // holds a reference to the current song playing
    var currentSong:Number = 0;
    // variable to store the song position when paused
    var songPosition:Number;
    // flag to check if current song is paused
    var songPaused:Boolean;
    //  loader for XML via a URL
    var XMLLoader:URLLoader = new URLLoader();
    // various buttons to control songs via the interface
    next_btn.addEventListener(MouseEvent.CLICK, onNext);
    prev_btn.addEventListener(MouseEvent.CLICK, onPrev);
    pause_btn.addEventListener(MouseEvent.CLICK, onPause);
    play_btn.addEventListener(MouseEvent.CLICK, onPlay);
    album1.doubleClickEnabled=true;
    album2.doubleClickEnabled=true;
    album1.addEventListener(MouseEvent.DOUBLE_CLICK, loadalbum1);
    album2.addEventListener(MouseEvent.DOUBLE_CLICK, loadalbum2);
    // check the data has loaded correctly
    XMLLoader.addEventListener(Event.COMPLETE, processXML);
    // this function processes the XML data
    function processXML(e:Event):void {
    // create an XML playlist structure
    var anXMLplayList:XML = new XML(e.target.data);
    // associate the playlist songs with the internal song list
    songList = anXMLplayList.SONG;
    // set the total songs to those found in the XML data
    songsTotal = songList.length();
    // remove the eventlistener and restore variables
    XMLLoader.removeEventListener(Event.COMPLETE, processXML);
    XMLLoader = null;
    // this function starts the first song in the list
    // when the play_btn is pressed via the onPlay function
    function playSong(aSong:Number):void {
    // variables for the Title, Artist and associated song in the song list
    var aTitle = songList[aSong].@TITLE;
    var anArtist = songList[aSong].@ARTIST;
    var aURL = songList[aSong].@URL;
    // populate the interface with the current song data
    title_txt.text = aTitle;
    artist_txt.text = anArtist;
    // check to see if the sound channel is active
    if (soundChannel) {
      soundChannel.stop();
      soundChannel.removeEventListener(Event.SOUND_COMPLETE, onNext);
    // create a new sound object
    sound = new Sound();
    // load the sound from the URL song data
    sound.load(new URLRequest(aURL));
    // activate the sound channel via the play method
    soundChannel = sound.play();
    // when the current songh completes - play the next song via the onNext function
    soundChannel.addEventListener(Event.SOUND_COMPLETE, onNext);
    // this function plays the next song in the list
    function onNext(e:Event):void {
    // increment the current song
    currentSong++;
    // reset the current song if no more to play
    if (currentSong>=songsTotal) {
      currentSong=0;
    // else play the current song via the playSong method
    playSong(currentSong);
    // this function plays the previous song in the song list
    function onPrev(e:MouseEvent):void {
    currentSong--;
    if (currentSong<0) {
      currentSong = songsTotal-1;
    playSong(currentSong);
    // this function pauses the current song playing and sets the boolean flag
    // accordingly
    function onPause(e:MouseEvent):void {
    if (soundChannel) {
      songPosition = soundChannel.position;
      soundChannel.stop();
      songPaused=true;
    // this function plays the current song or restarts a paused song
    function onPlay(e:MouseEvent):void {
    if (songPaused) {
      soundChannel = sound.play(songPosition);
      songPaused=false;
    } else if (!soundChannel) {
      playSong(currentSong);
    function loadalbum1(e:Event):void {
    cover.visible = true;
    cover2.visible = false;
    // load the XML formated playlist
    XMLLoader.load(new URLRequest("playlist1.xml"));
    function loadalbum2(e:Event):void {
    cover2.visible = true;
    cover.visible = false;
    // load the XML formated playlist
    XMLLoader.load(new URLRequest("playlist2.xml"));

    You should try to limit the code you post to what is relevant to the problem... it is hard to track things down, especially when your code is not formatted properly with indentations.
    I didn't search farther than finding that you remove the event listener for the URLLoader...
    XMLLoader.removeEventListener(Event.COMPLETE, processXML);
    so if you remove it after you load the first file and do not restore one for it, then chances are you don't "processXML" any more than the first file you load

  • Can this be done? XML playlist

    What I want is to create a player that can handle SWFs and
    FLVs or just FLVs, that load from a XML playlist.
    Now I have seen the tutorial (Creating a Dynamic Playlist for
    Progressive Flash Video) url:
    http://www.adobe.com/devnet/flash/articles/prog_download.html
    In that tutorial you have to click to play the next movie,
    but I want it to play swf1 or flv1 then 2 then 3 and so on
    automatically, then loop and play them again. But I can't find a
    tutorial for this anywhere?
    Any ideas, I need a detailed tutorial or a working example
    FLA
    I ask this, because people have sent me bits of code that
    means nothing to me? as I don't understand bits of AS, I need a FLA
    or a step by step tutorial.
    Many thanks

    as I don't understand bits of AS,
    Ahh, the problem! When you get to more specific applications
    of actionscript, and flash, you need to get comfortable at least
    piecing together what you know. I'd spend a good deal of time on
    kirupa.com, or any site like that, where admins create tutorials
    often.
    In theory what you'll do is build the normal player, powered
    by your own xml, then swap out the onRelease event handlers for a
    custom "when the .swf / .flv is done" handler.
    Let me know if you get anywhere with that. I'll be happy to
    walk you through it.

  • Problems with FMS2 streaming flv through xml playlist

    I've been testing for the first time FMS2 and has been quite
    a pain to make it work, I've been able to stream a single flv file
    but now that I've tried to stream multiple flv using a xml playlist
    (using the same example provided in
    http://www.adobe.com/devnet/flash/articles/video_player.html)
    and it wont work.
    I have IIS and FMS2 in the same computer.
    In the example provided by Adobe was an error in
    VideoSource.as in line originally was:
    my_FLVPlybk.contentPath = nav.attributes.url + "/_definst_/"
    + stream.attributes.name+".flv";
    And had to change "/_definst_/" to "_definst_/" to make it
    work, since path are:
    rtmp://localhost/videsource/_definst_/fish.flv for example
    and not:
    rtmp://localhost/videsource//_definst_/fish.flv
    Once that was solved and tested it works locally (in the same
    machine where the server is installed) but when testing from
    another computer it doesn't stream any videos.
    All the files are place the way it supposed to be in:
    \applications\videosource\streams\_definst_ (here are the
    videos)
    \applications\videosource (here is the main.asc)
    Then in IIS:
    \Inetpub\wwwroot\playlist (playlist-demo-1.xml,
    VideoThumb.as, VideoSource.as, VideoSource2.html, VideoSource2.swf,
    SteelExternalAll.swf).
    When tested local with
    http://localhost/playlist/VideoSource2.html
    or
    http://localhost/playlist/VideoSource2.swf
    works, but
    when trying from another computer in the same network or
    outside with
    http://my_server/playlist/VideoSource2.html
    wont stream like I said before.
    In the single flv stream (without xml playlist) I seem to be
    able to stream, just made a .fla with a FLVPlayback component
    pointing to: rtmp://localhost/test/_definst_/test.flv
    And trying
    http://my_server/test.html
    works fine.
    I've done the following:
    1. Added a MIME type to IIS for .flv and .swf
    2. Vhost.xml is open for all networks
    (<Allow>All</Allow>)
    3. Change the Global Security Settings for the Flash Player
    to access the .flv on the IIS server.
    4. No firewalls activated (for testing purposes).
    And it works with the single .flv stream but not with the
    xml playlist and I've run out of ideas or what to do, so I'm in
    need of anyone who can help me out and give me some insight.
    Thanks in advance.

    Sounds like a Flash Player security issue because you are
    running from a desktop. One of the items that can be different
    between Test Movie and a published test is security and any
    internet protocol. Flash Security errors fail silently.
    Look at
    NetConnection.connect
    method for the security warnings and references.
    If you plan to deploy from a web server, test there and it
    will likely work.

  • FLV & SWF player with XML Playlist

    What I want is to create a player that can handle SWFs and
    FLVs or just FLVs, that load from a XML playlist.
    Now I have seen the tutorial (Creating a Dynamic Playlist for
    Progressive Flash Video) url:
    http://www.adobe.com/devnet/flash/articles/prog_download.html
    But this populates a list that you have to click to play the
    next movie, but I want it to play swf1 or flv1 then 2 then 3 and so
    on, then loop. But I can't find a tutorial for this anywhere?
    Any ideas, I need a detailed tutorial or a working example?

    I recently made something like that, but then my project
    consultor, made me change to use only flv files.
    The project is going to be an internal tv channel for a
    university, here in Portugal. First I thought of mixing SWF and
    FLV's together, but then it required that someone that used the
    system, knew how to program SWF's, because you need to change a
    flag (variable) at the end of the playback of the SWF. This change
    of flag status indicates that this SWF is over and pass to the next
    entry of the playlist. Without this, I think that you would never
    know when to go to next entry. so, the code resembled a little like
    this:
    if ((_root.percen_tx.text == "100%") || (_global.over == 1
    && _global.tipo[_global.num]=="1")) {
    _global.over = 0;
    _root.percen_tx.text = "";
    if (_global.num == (_global.filmes.length-1)) {
    _global.num = 0;
    switch (_global.tipo[_global.num]) {
    case "1" :
    loadMovie(_global.filmes[_global.num], _root.swf_cont);
    _root.descr_tx.text = "";
    _root.percen_tx.text = "";
    break;
    case "0" :
    _root.contentor.my_FLVPlybk.contentPath =
    _global.filmes[_global.num];
    _root.descr_tx.text = _global.descr[_global.num];
    break;
    } else {
    _global.num += 1;
    _root.percen_tx.text = "";
    switch (_global.tipo[_global.num]) {
    case "1" :
    _global.over=0;
    loadMovie(_global.filmes[_global.num], _root.swf_cont);
    _root.descr_tx.text = "";
    _root.percen_tx.text = "";
    break;
    case "0" :
    _root.contentor.my_FLVPlybk.contentPath =
    _global.filmes[_global.num];
    _root.descr_tx.text = _global.descr[_global.num];
    break;
    A brief explanantion:
    _global.over -> 0 (not over); 1 (is over)
    _global.tipo -> value that comes from an xml, and
    indicates if this playlist entry is a SWF or a FLV (they go to
    different MC's);
    _root.percen_tx -> Indicates the percentage of the FLV
    file that was already read. "100%" is over
    This is not the most efficient way to do it, because you can
    use listeners and so on, but at the time I abbandoned this, at this
    stage. Now it's only FLV, and only a few lines of code.
    You can see the project at www.ipvctv.com
    Hope it helped a bit.

  • Xml playlist livestream

    Hi all
    I have created an xml playlist to play a live stream first, and I have a 2nd playlist item, which is an on demand video, which I want to start playing should the live stream dropout.
    At the moment if the livestream stops the player just tries to rebuffer it and won't move onto the 2nd playlist item. Does anyone know how I can get the playlist to start playing the on demand video?
    The idea is to provide some back up so if there is a problem the viewer still gets some content. Ideally I would want to loop the playlist some how so that after the second playlist item finishes the livestream is tried again.
    Any help with this would be greatly appreciated.
    Thanks

    Hi I dont know what exactly you mean by XML Playlist.But let me try to give simple example which might help you. Say you are playing a live stream and suddenly the live stream stops so you want to switch to on-demand video. This is very simple to achieve - What you have to do is define NetStream.onStatus handler and track various status messages in order to perform certain actions. In this case when liveStream stops, client should get "NetStream.Play.UnPublishNotify" indicating that live stream has stopped so it can issue play for on-demand video. When on-demand video is stopped, you can reissue play for live stream. But its better you also use NetStream.time property to check if its increasing to be sure that live stream is indeed playing - because when you issue play for live stream and there is none getting published at server , you will get NetStream.Play.Start and it will continue to wait for someone to publish stream by that name on the server. Hope this answers your question - do let me know if you have any more queries.

  • Converting WinAmp (M3U) Playlists Into iTunes (XML) Playlists

    Hi. I was wondering if someone could help me out with suggestions on converting my old WinAmp (.m3u) playlists into usable iTunes (.xml) playlists?
    I have Windows XP Pro (with the latest Windows updates), and a brand new iPod 160 Gig Classic.
    I have used WinAmp as my media player for the longest time. The reason that I haven't created playlists in iTunes is because:
    It took me years to customize these Winamp playlists exactly how I want them (you know how that is).
    iTunes is a huge program that tends to takes up too many system resources on my PC. I have an older PC, and don't have the time or money to invest in a new system, copy files, set it up, etc.
    iTunes somehow modifies an mp3 whenever it is played in iTunes ( I can see that it has been modified in the "Date Modified" column, where my mp3 files are located).
    Historically - up until the last year or so, iTunes has not had too much of a problem faithfully importing my Winamp playlists into iTunes (to be transferred onto my iPod).
    So, I just got off the phone with Apple Technical Support, Tier 2.  I told him that I had the latest version of iTunes (version 10), installed yesterday.
    I successfully imported my 90 Gigs of mp3's into the  iTunes "Music Library" without a problem.
    The problem arose today when I tried to import one of my WinAmp (.m3u) playlists into iTunes, so that I could copy the playlist over onto my iPod. I've done this dozens of times. I've already tried uninstalling and then reinstalling iTunes.
    Like I said, I really want to keep these playlists it took a long time to customize the occurrence and frequency of favorite mp3's into those playlists.
    The technician said that the latest release of iTunes won't work with Winamp (m3u) playlists.  I asked him if he thought it would work again if I downloaded an older version of iTunes. He said that with the new iPod Classic that I have, it will not work with older versions of iTunes (I have no idea why), so that's out. He suggested Googling an "m3u to xml file converter."
    I checked on Google and saw a lot of programs that will convert xml files to m3u file format (for reasons unknown to me), but I haven't had any luck online finding a file converter that will faithfully convert my WinAmp (.m3u) playlists TO iTunes (.xml) playlists to use instead, and make iTunes run smoother. Any suggestions?*
    * Keep in mind that I'd really prefer to convert my m3u playlists, rather than create all new iTunes playlists from scratch.
    Thanks.

    solgar wrote:
    Tried the plug-in with Apple Technical Support. This WinAmp plug-in unfortunately does absolutely nothing.
    I went back an read some of the comments and it sounds like it only works with older versions of WinAmp.
    Try this http://www.topdownloads.net/software/m3u-to-xml-xspf-converter_2_39472.html
    or this python script http://users.musicbrainz.org/~matt/xspf/m3u2xspf
    or http://www.softpedia.com/get/Multimedia/Audio/Audio-Convertors/M3UtoXSPF.shtml
    Not sure this one will work since it is looking like the latest iTunes no longer supports m3u file sbut worth a try see http://www.burroak.on.ca/m3u2itunes.html

  • Attaching XML tags to paragraphs (CS2/VB)

    Hi everybody,
    I need to build an Indesign document from several Word documents, attach XML tags to those document parts and also to retain Word's paragraph styles.
    I use temporary textframes and copy & paste to put the Word stuff together into one large textframe. Works fine so far. Paragraph styles remain intact:
    InDesign.XMLElement xch = root.XMLElements.Add("XML_" + Convert.ToString(cnt), "");
    InDesign.InsertionPoint ip = (InDesign.InsertionPoint)txt.InsertionPoints.LastItem();
    ip.Select(InDesign.idSelectionOptions.idReplaceWith);
    id4.app.Paste();
    But as soon as I call Markup() to add the XML tag to this part of the document, all paragraph style information gets lost:
    ip.Markup(xch);
    This is most certainly some kind of RTFM error, but since there's no really detailed documentation for scripting (at least I couldn't find one yet - hints are welcome), I'm stuck.
    Thanks a lot.
    Hans

    Hi Hans,
    The InDesign CS2 Scripting Guide and Scripting Reference PDFs are on your InDesign CS2 installation CDs.
    Many things in scripting did not change between CS2 and CS3--and there are more XML examples in the CS3 version of the Guide (though you should note that CS2 does not have the XML rules feature at all). You can find the InDesign CS3 Scripting Guide: VBScript at:
    http://www.adobe.com/products/indesign/xml_scripting.html
    (you'll need to click the Scripting Resources tab to get to the relevant page)
    The Markup.vbs example script (a fragment is shown on page 119 of the Guide; you can find the full script in the associated Zip archive of scripts) shows you the general approach to marking up page items or text. The basic form is:
    Rem Where "myXMLElement" is a reference to an XML element
    Rem and "myText" is a reference to a text object...
    myXMLElement.markup myText
    Here's a more complete script (VBScript form):
    Rem MarkupText.vbs
    Rem An InDesign CS2/CS3 VBScript
    Rem
    main
    Function main()
    Rem Use "InDesign.Application.CS2" to target CS2
    Set myInDesign = CreateObject("InDesign.Application.CS3")
    mySetup myInDesign
    mySnippet myInDesign
    End Function
    Rem mySetup function creates an example document.
    Function mySetup(myInDesign)
    Set myDocument = myInDesign.Documents.Add
    Rem Create some paragraph styles.
    Set myBodyText = myDocument.ParagraphStyles.Add
    myBodyText.Name = "BodyText"
    Set myHeading = myDocument.ParagraphStyles.Add
    myHeading.Name = "Heading"
    myHeading.PointSize = 24
    Rem Add XML elements
    Set myRootXMLElement = myDocument.XMLElements.Item(1)
    Set myXMLTag = myDocument.XMLTags.Add("xml_element")
    Set myXMLElementA = myRootXMLElement.XMLElements.Add(myXMLTag)
    Rem Create a text frame
    Set myTextFrame = myDocument.Pages.Item(1).TextFrames.Add
    myTextFrame.GeometricBounds = myGetBounds(myDocument,myDocument.Pages.Item(1))
    myString = "This is the first paragraph in a text frame." & vbCr
    myString = myString & "This is the second paragraph in a text frame." & vbCr
      myString = myString & "This is the third paragraph in a text frame." & vbCr
      myString = myString & "This is the fourth paragraph in a text frame." & vbCr
    myTextFrame.Contents = myString
    Rem Use ApplyParagraphStyle in CS3.
    myTextFrame.Texts.Item(1).ApplyStyle myBodyText
    myTextFrame.Paragraphs.Item(1).ApplyStyle myHeading
    End Function
    Rem mySnippet shows how to use the XMLElement.Markup method.
    Function mySnippet(myInDesign)
    Set myDocument = myInDesign.Documents.Item(1)
    Rem Have to associate the Root XML element with the story
    Rem before associating child elements.
    myDocument.XMLElements.Item(1).Markup myDocument.Pages.Item(1).TextFrames.Item(1)
    Rem Now we can associate XML elements with individual paragraphs.
    Set myXMLElement = myDocument.XMLElements.Item(1).XMLElements.Item(1)
    Set myText = myDocument.Pages.Item(1).TextFrames.Item(1).Paragraphs.Item(1)
    myXMLElement.Markup myText
    End Function
    Rem Utility function for getting the bounds of the "live" area
    Rem (the area inside the page margins) of a page.
    Function myGetBounds(myDocument, myPage)
    myPageWidth = myDocument.DocumentPreferences.PageWidth
    myPageHeight = myDocument.DocumentPreferences.PageHeight
    Rem Page.Side is a CS3 property. In CS2, use:
    Rem If myPage.DocumentOffset Mod 2 = 0 Then
    If myPage.Side = idPageSideOptions.idLeftHand Then
      myX2 = myPage.MarginPreferences.Left
      myX1 = myPage.MarginPreferences.Right
    Else
      myX1 = myPage.MarginPreferences.Left
      myX2 = myPage.MarginPreferences.Right
    End If
    myY1 = myPage.MarginPreferences.Top
    myX2 = myPageWidth - myX2
    myY2 = myPageHeight - myPage.MarginPreferences.Bottom
    myGetBounds = Array(myY1, myX1, myY2, myX2)
    End Function
    As to style information getting lost--it probably has to do with your Tag to Style/Style to Tag mapping. The above script demonstrates that it is possible to mark up text without losing the style.
    You might also consider using tag to style or style to tag mapping after pasting the text from Word.
    Hope this helps!
    Thanks,
    Ole

Maybe you are looking for

  • ITunes locks up my Start Menu

    Has anyone ever run into this? I have iTunes on three machines - my home PC, my work PC, and a laptop. I use an external hard drive to hold my library and all audio files so I can listen to whatever I want any time. The last week or so, on my work PC

  • Problem in Adding in Document Object Table.

    I want to Add/Update the data in the Documentobject table and DocumentLineobject table through my own SRF. Please guide me how should i proceed.

  • My computer crashed and I lost my itunes library. How can I restore it from my iPod?

    My computer crashed and I lost my itunes library. How can I transfer my music from my ipod back to my computer? (I did not back up my entire itunes library.)

  • Limit Item Process MM-SUS scenario

    Hello Team, I want to understand the limit item process in MM-SUS scenario. What are the process steps and document created as per system. Kindly share any refrence document related to this process.As i need to implement this process for my client. R

  • Send a mouse click?

    Does anyone know how to generate a mouse click with lingo? I need a 'genuine' mouse event - not sendsprite(x,#mouseup) Cheers