[Flashcoders] streaming mp3 player
Hi, i have created a mp3 player using AS 2.0 that controls the playlist using xml .Everything is working properly . My only issue is that i want the music to stream instead of waiting until the song is fully downloaded to play . This player works fine locally but in browser it creates problem when streaming from server . I have tried a lot ...have searched everywhere ...can u please tell me how to add the streaming / buffering functionality to this player (same as you see in youtube want the same streaming functionality) .. *Here's my whole code :* stop(); songtime._alpha = 0; var songs:Array = new Array(); var curtrack:Number = 0; var playingsong:Sound = new Sound(); if (_root.playlist == undefined || _root.playlist == "") { _root.playlist = "playlist.xml"; } var playlistXml:XML = new XML(); playlistXml.ignoreWhite = true; playlistXml.load(_root.playlist); playlistXml.onLoad = function() { loadSongs(); loadplaylistbox(); playpause.gotoAndStop(2); playpause.playpausebutton.onPress = function() { playpause.gotoAndStop(1); loadSong(curtrack); songtime._alpha = 100; }; if (_root.autostart == "false") { toggleplaypause(); } }; volumebar.volumeslider.startDrag(true,0,volumebar.volumeslider._y,30,volumebar.volumeslider._y); function loadSongs() { for (songIndex=0; songIndex=songdisplay.maxhscroll) { songdisplay.movingright = true; } } if (!draggingslider) { progressslider._x = (playingsong.position/playingsong.duration)*182+86; if (progressslider._x == 0) { progressslider._x = 86; } } if (draggingplaylistscroller) { updateplaylistscroll(); } if (draggingvolmeslider) { updatevolume(); } tempsongtime = ""; if (Math.floor(playingsong.position/6) == 0) { tempsongtime += "00"; } else { tempsongtime += Math.floor(playingsong.position/6); } tempsongtime += ":"; if (Math.floor((playingsong.position/1000)%60)<10) { tempsongtime += "0"; } tempsongtime += Math.floor((playingsong.position/1000)%60); tempsongtime += "/"; if (Math.floor(playingsong.duration/6) == 0) { tempsongtime += "0"; } else { tempsongtime += Math.floor(playingsong.duration/6); } tempsongtime += ":"; if (Math.floor((playingsong.duration/1000)%60)<10) { tempsongtime += "0"; } tempsongtime += Math.floor((playingsong.duration/1000)%60); songtime.text = tempsongtime; //trace(Math.floor(playingsong.position/6)); //if(Math.floor(playingsong.position/1000)%60) //songtime.text=Math.floor(playingsong.position/1000)%60+"/"+Math.floor(playingsong.duration/1000)%60; }; progressslider.onPress = function() { draggingslider = true; progressslider.startDrag(true,86,progressslider._y,263.8,progressslider._y); }; progressslider.onRelease = progressslider.onReleaseOutside=function () { progressslider.stopDrag(); playingsong.start(((progressslider._x-86)/182)*playingsong.duration/1000,0); playpause.gotoAndStop(1); playpause.playpausebutton.onPress = function() { toggleplaypause(); }; draggingslider = false; }; progressbar.onPress = function() { playingsong.start(((_xmouse-61)/182)*playingsong.duration/1000,0); playpause.gotoAndStop(1); playpause.playpausebutton.onPress = function() { toggleplaypause(); }; }; volumebar.onPress = function() { draggingvolmeslider = true; volumebar.volumeslider.startDrag(true,0,volumebar.volumeslider._y,47,volumebar.volumeslider._y); }; volumebar.onRelease = volumebar.onReleaseOutside=function () { draggingvolmeslider = false; volumebar.volumeslider.stopDrag(); updatevolume(); }; function updatevolume() { playingsong.setVolume((volumebar.volumeslider._x/47)*100); } previoussong.onPress = function() { loadprevioussong(); }; function loadprevioussong() { var loadtrack = (curtrack-1)%(songs.length); if (loadtrack<0) { loadtrack = songs.length-1; } loadSong(loadtrack); } nextsong.onPress = function() { loadnextsong(); }; function loadnextsong() { var loadtrack = (curtrack+1)%(songs.length); loadSong(loadtrack); } playlistscroller.onPress = function() { draggingplaylistscroller = true; playlistscroller.startDrag(true,317.5,85,317.5,185); }; playlistscroller.onRelease = playlistscroller.onReleaseOutside=function () { draggingplaylistscroller = false; playlistscroller.stopDrag(); }; playlistscrollup.onPress = function() { playlistscroller._y = Math.max(85, playlistscroller._y-10); updateplaylistscroll(); }; playlistscrolldown.onPress = function() { playlistscroller._y = Math.min(185, playlistscroller._y+10); updateplaylistscroll(); }; var mouseListener:Object = new Object(); mouseListener.onMouseWheel = function(delta:Number) { playlistscroller._y = Math.min(185, Math.max(85, playlist
Re: [Flashcoders] RE: Optimising file size - stripping down intrinsics...
- Original Message - From: "SJF" <[EMAIL PROTECTED]> To: Sent: Thursday, September 18, 2008 12:12 AM Subject: [Flashcoders] RE: Optimising file size - stripping down intrinsics... Paul - I once worked with a guy who was building components for a large teen-focused community site (Coca-Cola if I recall - it was a few years back now), anyway, he gave the impression that he always stripped out Flash intrinsic classes before creating a release build. To be honest, I don't know why he went through this process (it was around Flash MX time) other than I remember him saying that Macromedia had too much bloat in their intrinsics. Anyway, just thought I'd ask if this practice is still done. Cheers. Ah. Thanks for the explanation. Bizarre. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] RE: Optimising file size - stripping down intrinsics ...
Paul - I once worked with a guy who was building components for a large teen-focused community site (Coca-Cola if I recall - it was a few years back now), anyway, he gave the impression that he always stripped out Flash intrinsic classes before creating a release build. To be honest, I don't know why he went through this process (it was around Flash MX time) other than I remember him saying that Macromedia had too much bloat in their intrinsics. Anyway, just thought I'd ask if this practice is still done. Cheers. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Adding Listeners in a loop
Thanks Juan... That was so useful. Cheers On Wed, Sep 17, 2008 at 6:40 PM, Juan Pablo Califano < [EMAIL PROTECTED]> wrote: > Hi, the problem is that by the time the event fires and your inline > function > is called, R1 points to the last object created in the loop. > > However, an event object is passed to the handler function. The target > property of that object cointains a reference to the object that fired it, > so you can do something like this. > > > R1.addEventListener(MouseEvent.CLICK, function(evt:Event):void { > trace(evt.target.Label) > }); > Cheers > Juan Pablo Califano > PD: A was about to give you some heads up on using inline functions but I > bet in minutes someone else will do take care of that, anyway ;) > > > 2008/9/17 Omar Fouad <[EMAIL PROTECTED]> > > > Hi, > > I got this loop that creates some MovieClips one under another. > > for (var i:uint = 0; i < data.length; i++) { > >var R1:ResultLink = new ResultLink(data[i].CompanyName, > > data[i].CompanyId); // > >R1.addEventListener(MouseEvent.CLICK, function():void > > {trace(R1.Label)}); > >BlackBox.addChild(R1); > >//x and y here > > } > > Where ResultLink is a Class that extends MovieClip and holds The Label, > and > > The Id property from a Dataset fetched from a SQLite database and > returned > > into the array 'data'. > > > > Now when I click to each one of the created MovieClips, they trace the > last > > Label and not the corresponding label for each MovieClip Clicked. At this > > point I think that the event listener is added to the same 'instace' that > > is > > overridden everytime. > > > > How can I fix this? > > > > Thanks > > > > > > -- > > Omar M. Fouad - www.omar-fouad.net > > Cellular: (+20) 1011.88.534 > > Mail: [EMAIL PROTECTED] > > > > This e-mail and any attachment is for authorised use by the intended > > recipient(s) only. It may contain proprietary material, confidential > > information and/or be subject to legal privilege. It should not be > copied, > > disclosed to, retained or used by, any other party. If you are not an > > intended recipient then please promptly delete this e-mail and any > > attachment and all copies and inform the sender. Thank you. > > ___ > > Flashcoders mailing list > > Flashcoders@chattyfig.figleaf.com > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- Omar M. Fouad - www.omar-fouad.net Cellular: (+20) 1011.88.534 Mail: [EMAIL PROTECTED] This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] addChild multiple instances of a loader
Hi all! I'm preloading some swf's and images, and I want use some same loaded instances for some movieclips. For example, I load a file img.jpg. and on complete of it, I want add the loaded bitmap to 10 movieclips. When I addChild, all movieclips are overrided and just the last one has the loaded content. With images I can use bitmap data for copying data, but and if I load swfs or whatever? I've googled but didn't find any clear, at least for me. Can you help me pls, gurus? , Thanks so much -- Fábio Pinatti :: web.developer www.pinatti.com.br :: 19. 9184.3745 / 3342.1130 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] [crosspost] Flash community chat
In advance, I apologize for crossposting!!! Please don't answer to this crosspost, because your answer could be crosspost as well ;) A month ago, Mike Chambers from Adobe created a new chat on his server for the flash playtform community. Mike is working on a standalone AIR client for that XMPP/Jabber based chat server, but meanwhile you can access the chat as described here: http://www.mikechambers.com/blog/2008/08/14/flash-platform-community-chat-xmpp-jabber-server/ I could try to find the right words, but it's much easier to quote what Jens Brynildsen wrote on flashmagazine.com today: "Just after it's launch, the Flash Platform Chat was full of people. Mike Chambers and Ryan Stewart from Adobe were regulars and there was a flurry of Flash/Flex users from all over the world discussing everything from the weather to skinning Flex Components. The last week, things have calmed down a bit, but there's still enough users for it to be a nice place to hang out and get help if you're stuck on something. The chat is open to all and the more people dropping by, the more useful it will be for all." (http://www.flashmagazine.com/News/detail/flash_community_chat/) So if you like more synchronous communication than on the list, you might give this chat a try. ;) Matthias ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Adding Listeners in a loop
one easy way : function fn(i:uint) { var R1:ResultLink = new ResultLink(data[i].CompanyName, data[i].CompanyId); // R1.addEventListener(MouseEvent.CLICK, function():void {trace(R1.Label)}); BlackBox.addChild(R1); //x and y here } } --- On Wed, 9/17/08, Omar Fouad <[EMAIL PROTECTED]> wrote: From: Omar Fouad <[EMAIL PROTECTED]> Subject: [Flashcoders] Adding Listeners in a loop To: "Flash Coders List" Date: Wednesday, September 17, 2008, 5:47 PM Hi, I got this loop that creates some MovieClips one under another. for (var i:uint = 0; i < data.length; i++) { var R1:ResultLink = new ResultLink(data[i].CompanyName, data[i].CompanyId); // R1.addEventListener(MouseEvent.CLICK, function():void {trace(R1.Label)}); BlackBox.addChild(R1); //x and y here } Where ResultLink is a Class that extends MovieClip and holds The Label, and The Id property from a Dataset fetched from a SQLite database and returned into the array 'data'. Now when I click to each one of the created MovieClips, they trace the last Label and not the corresponding label for each MovieClip Clicked. At this point I think that the event listener is added to the same 'instace' that is overridden everytime. How can I fix this? Thanks -- Omar M. Fouad - www.omar-fouad.net Cellular: (+20) 1011.88.534 Mail: [EMAIL PROTECTED] This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Adding Listeners in a loop
Hi, the problem is that by the time the event fires and your inline function is called, R1 points to the last object created in the loop. However, an event object is passed to the handler function. The target property of that object cointains a reference to the object that fired it, so you can do something like this. R1.addEventListener(MouseEvent.CLICK, function(evt:Event):void { trace(evt.target.Label) }); Cheers Juan Pablo Califano PD: A was about to give you some heads up on using inline functions but I bet in minutes someone else will do take care of that, anyway ;) 2008/9/17 Omar Fouad <[EMAIL PROTECTED]> > Hi, > I got this loop that creates some MovieClips one under another. > for (var i:uint = 0; i < data.length; i++) { >var R1:ResultLink = new ResultLink(data[i].CompanyName, > data[i].CompanyId); // >R1.addEventListener(MouseEvent.CLICK, function():void > {trace(R1.Label)}); >BlackBox.addChild(R1); >//x and y here > } > Where ResultLink is a Class that extends MovieClip and holds The Label, and > The Id property from a Dataset fetched from a SQLite database and returned > into the array 'data'. > > Now when I click to each one of the created MovieClips, they trace the last > Label and not the corresponding label for each MovieClip Clicked. At this > point I think that the event listener is added to the same 'instace' that > is > overridden everytime. > > How can I fix this? > > Thanks > > > -- > Omar M. Fouad - www.omar-fouad.net > Cellular: (+20) 1011.88.534 > Mail: [EMAIL PROTECTED] > > This e-mail and any attachment is for authorised use by the intended > recipient(s) only. It may contain proprietary material, confidential > information and/or be subject to legal privilege. It should not be copied, > disclosed to, retained or used by, any other party. If you are not an > intended recipient then please promptly delete this e-mail and any > attachment and all copies and inform the sender. Thank you. > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Adding Listeners in a loop
one easy way : function fn(i:uint) { var R1:ResultLink = new ResultLink(data[i].CompanyName, data[i].CompanyId); // R1.addEventListener(MouseEvent.CLICK, function():void {trace(R1.Label)}); BlackBox.addChild(R1); //x and y here } } for (var i:uint = 0; i < data.length; i++) { fn(i); } --- On Wed, 9/17/08, Omar Fouad <[EMAIL PROTECTED]> wrote: From: Omar Fouad <[EMAIL PROTECTED]> Subject: [Flashcoders] Adding Listeners in a loop To: "Flash Coders List" Date: Wednesday, September 17, 2008, 5:47 PM Hi, I got this loop that creates some MovieClips one under another. for (var i:uint = 0; i < data.length; i++) { var R1:ResultLink = new ResultLink(data[i].CompanyName, data[i].CompanyId); // R1.addEventListener(MouseEvent.CLICK, function():void {trace(R1.Label)}); BlackBox.addChild(R1); //x and y here } Where ResultLink is a Class that extends MovieClip and holds The Label, and The Id property from a Dataset fetched from a SQLite database and returned into the array 'data'. Now when I click to each one of the created MovieClips, they trace the last Label and not the corresponding label for each MovieClip Clicked. At this point I think that the event listener is added to the same 'instace' that is overridden everytime. How can I fix this? Thanks -- Omar M. Fouad - www.omar-fouad.net Cellular: (+20) 1011.88.534 Mail: [EMAIL PROTECTED] This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Optimising file size - stripping down intrinsics ...
SJF, Native/intrinsic classes such as Sprite are compiled into the Flash _Player_, not into your .swf file. There's no way to strip them, and they don't bloat your .swf file. HTH, Ian On Wed, Sep 17, 2008 at 2:38 PM, SJF <[EMAIL PROTECTED]> wrote: > Hello, > > Anyone have a starting point or advice in terms of stripping down flash > native/intrinsic AS3 classes - with a goal of file optimization? > > For example, in an application I'm building, I need less than half the > attributes and capabilities of the Sprite class - so any pointers for how to > strip these down, without destroying the original classes? > > Thanks - SJF. > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Adding Listeners in a loop
Hi, I got this loop that creates some MovieClips one under another. for (var i:uint = 0; i < data.length; i++) { var R1:ResultLink = new ResultLink(data[i].CompanyName, data[i].CompanyId); // R1.addEventListener(MouseEvent.CLICK, function():void {trace(R1.Label)}); BlackBox.addChild(R1); //x and y here } Where ResultLink is a Class that extends MovieClip and holds The Label, and The Id property from a Dataset fetched from a SQLite database and returned into the array 'data'. Now when I click to each one of the created MovieClips, they trace the last Label and not the corresponding label for each MovieClip Clicked. At this point I think that the event listener is added to the same 'instace' that is overridden everytime. How can I fix this? Thanks -- Omar M. Fouad - www.omar-fouad.net Cellular: (+20) 1011.88.534 Mail: [EMAIL PROTECTED] This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Optimising file size - stripping down intrinsics ...
I've often seen people trying to highly optimise file sizes and IMHO it's a wasted exercise unless there are very strict guidelines for file size or existing file sizes are highly excessive. I can't help but think that stripping away parts of core classes is overkill. There's has to be a better way to get a solution (such as dynamically loading swfs and other assets on demand). What is the scenario that you are facing? Just why must you do this? Paul - Original Message - From: "SJF" <[EMAIL PROTECTED]> To: Sent: Wednesday, September 17, 2008 2:38 PM Subject: [Flashcoders] Optimising file size - stripping down intrinsics ... Hello, Anyone have a starting point or advice in terms of stripping down flash native/intrinsic AS3 classes - with a goal of file optimization? For example, in an application I'm building, I need less than half the attributes and capabilities of the Sprite class - so any pointers for how to strip these down, without destroying the original classes? Thanks - SJF. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Optimising file size - stripping down intrinsics ...
Hello, Anyone have a starting point or advice in terms of stripping down flash native/intrinsic AS3 classes - with a goal of file optimization? For example, in an application I'm building, I need less than half the attributes and capabilities of the Sprite class - so any pointers for how to strip these down, without destroying the original classes? Thanks - SJF. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders