A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: onFD in Mediaplayer

  1. #1
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    onFD in Mediaplayer

    Wilburt this one is for you.

    I'm trying to make use of the FD data and to test the function I tried this in the load.as file

    onFD(fd){
    _root.txt1.text=fd.length;
    }

    but I get undefinded, the fd is displayed in the normal fd display.

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    While we're at it how about the onID3 function?

    The event fires but I cannot figure out how to access the id3 tag. I want to expand the a mediaplayer skin with some custom buttons and display extended id3 tags in a window and also make some movements based on fd data.

  3. #3
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    if I do this in timeline
    Code:
    mediaplayer1.onID3(){
    	_root.txt1.text=this
    	}
    I get _level0 which is NOT what I expect Shouldn't that be the mediaplayer and if so how do I reference the id3 tag, shouldn't it be mediaplayer1.?song?.id3 where ?song? is the internal name of the sound object?

  4. #4
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    Try this
    Code:
    mediaplayer1.onID3 = function(){
     _root.txt1.text = this.id3.artist;
    }
    
    mediaplayer1.onFD = function(a){
     _root.txt2.text = a.length;
    }

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    duh thanks

  6. #6
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    I remember that I was not able to use the in command to loop through the properties of an object, we discussed this some time ago in relation to id3 tags. There must be a work around for this...

  7. #7
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Here's a test using onFD, the speaker and the display are driven by onFd, also extended ID3 information using onID3

    http://www.bretlanius.com/flash/lab/playertest2.html
    Last edited by blanius; 05-02-2007 at 02:48 PM.

  8. #8
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    Nice work Bret

    I don't know if you already figured out how to loop through all id3 properties.
    Here's an example in case you didn't.
    Code:
    mediaplayer1.onID3 = function(){
     var o = this.id3;
     var p;
     for (p in o) {
      _root.txt1.text += 'property:' + p + ' value:'+o[p]+'\n';
     }
    }

  9. #9
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    Quote Originally Posted by blanius
    Here's a test using onFD, the speaker and the display are driven by onFd, also extended ID3 information using onID3

    http://www.bretlanius.com/flash/lab/playertest2.html
    Can you explain this a little more in general? I remember you was trying to do this a few months ago.
    Any programming language is at its best before it is implemented and used.

  10. #10
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Thanks Wilburt, that is what I was talking about. I couldn't get it to work but will try again with your code.

    Tmoore Mediaplayer object has there functions already. onFd and onID3 I'm just playing around with using them.

    Code:
    mediaplayer1.setExternalPlaylist("playlist.txt")
    mediaplayer1.onPlay=function(){
    	_root.txt2.text="";
    	mc3.mc1._xscale=mc3.mc1._yscale=0
    	mc3.mc2._xscale=mc3.mc2._yscale=0
    	mc3.mc3._xscale=mc3.mc3._yscale=0
    	mc3.mc4._xscale=mc3.mc4._yscale=0
    	mc3.mc5._xscale=mc3.mc5._yscale=0
    	mc3.mc6._xscale=mc3.mc6._yscale=0
    	mc3.mc7._xscale=mc3.mc7._yscale=0
    	mc3.mc8._xscale=mc3.mc8._yscale=0
    	mc3.mc9._xscale=mc3.mc9._yscale=0
    	}
    mediaplayer1.onFD = function(a){
    	_root.txt1.text = a[5];
    	speaker.grill._xscale=95+a[5]
    	speaker.grill._yscale=95+a[5]
    	mc3.mc1._xscale=mc3.mc1._yscale=25*a[1]
    	mc3.mc2._xscale=mc3.mc2._yscale=25*a[2]
    	mc3.mc3._xscale=mc3.mc3._yscale=25*a[3]
    	mc3.mc4._xscale=mc3.mc4._yscale=25*a[4]
    	mc3.mc5._xscale=mc3.mc5._yscale=25*a[5]
    	mc3.mc6._xscale=mc3.mc6._yscale=25*a[6]
    	mc3.mc7._xscale=mc3.mc7._yscale=25*a[7]
    	mc3.mc8._xscale=mc3.mc8._yscale=25*a[8]
    	mc3.mc9._xscale=mc3.mc9._yscale=25*a[9]
    }
    
    
    mediaplayer1.onID3 = function(){
    
     var o = this.id3;
     var p;
     for (p in o) {
      _root.txt2.text +=p + ':'+o[p]+'\n';
     }
    
     
    }
    The Display is just a MC with 9 clips in it with a single shape on each.
    The speaker is a two layer clip and I scale the background one a little based on the value of a FD

  11. #11
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    This is how swf-tools worked. I remember this. If the volume was tied into the FD's, then they could respond to the music output. But thats getting too "tweeeked"
    Any programming language is at its best before it is implemented and used.

  12. #12
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    If a song has id3 v1 and v2 tags you get both. Any ideas on not seeing the duplicated tags?

  13. #13
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    Quote Originally Posted by blanius
    If a song has id3 v1 and v2 tags you get both. Any ideas on not seeing the duplicated tags?
    Besides filtering when you loop through all properties I see no option.
    The id3 object is the same as from the sound class and it doesn't have a function to only get the v1 or v2 tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center