Ooops forgot to include the code sorry! See below.... doesnt soudn too
encouraging tho, seems like a little bit of an omission on Adobes part?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml";
    horizontalAlign="center" verticalAlign="center" 
    height="100%" 
    width="100%" 
    layout="absolute"
    creationComplete="init()">
    
    <mx:Script>
        <![CDATA[
                
                //import the necessary youtube API classes
                import ca.newcommerce.youtube.data.*;
                import ca.newcommerce.youtube.events.*;
                import ca.newcommerce.youtube.feeds.*;
                import ca.newcommerce.youtube.iterators.*;
                import ca.newcommerce.youtube.webservice.YouTubeClient;
                
                import mx.collections.ArrayCollection;
                
                public var videoArray:Array;
                
                //declare your variables
                [Bindable]
                public var webservice:YouTubeClient;
                [Bindable]
                public var feed:VideoFeed;
                [Bindable]
                public var video:VideoData;
                
                public var myVideoArray:Array = new Array();
                
                [Bindable]
                public var dgData:ArrayCollection;
                
                
                
                //functions to go here
                private function init():void{

                        webservice = YouTubeClient.getInstance();
                        
                
webservice.addEventListener(VideoFeedEvent.USER_FAVORITES_DATA_RECEIVED,
doStuff);
                        
                        
webservice.getUserFavorites("RuralGateway",null,null,1,10);
                }
                
                private function doStuff(evt:VideoFeedEvent):void{
                        //store the feed
                        feed = evt.feed;
                        
                        while(video = feed.next()){
                                myVideoArray.push({Title:video.title,
                                                                        
Duration:video.duration,
                                                                        
URL:video.swfUrl});
                        }
                        
                        dgData = new ArrayCollection(myVideoArray);
                        
                        dg.dataProvider = dgData;
                }
                
                private function changeSWF():void {
                        myLoader.source = dg.selectedItem.URL;
                        }
                 
            ]]>
    </mx:Script>
    
    <mx:DataGrid width="100%" id="dg" change="changeSWF()">
        
    </mx:DataGrid>
    
    <mx:Label text="{dg.selectedItem.URL}" x="300" y="200"/>
    
    <mx:SWFLoader id="myLoader"
                                x="200"
                                y="160"
                                width="200"
                                height="150"
                                />
                                 
    
</mx:Application>


--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> I don't see any code, but in general, if the SWF you loaded does not
> clean up after itself, there's no way to force it to unload.  You'll
> need to find a way to stop the video and audio before loading something
> else.
> 
>  
> 
> ________________________________
> 
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of Ben Reed
> Sent: Friday, June 06, 2008 11:31 AM
> To: [email protected]
> Subject: [flexcoders] Flex Unload SWFLoader issues
> 
>  
> 
> Hi guys,
> 
> I have just today signed up with this mailing list after stumbling
> across an issue I cannot resolve! Seems to be a flaw with the SWFLoader
> in Flex 3. Basically my problem is this, I have to create a youtube
> player for a client and am using the wrapper classes from martin legris
> to aid me. All is working ok, I have a datagrid being populated by an
> array, and when a video is selected, the SWFLoader loads it into place
> as it should. The problem comes when selecting another video from the
> list, several things happen (or dont!), the loaded Youtube player
> disappears as if another one will be loaded into its place (the desired
> effect) but nothing is loaded, also the sound from the original swf is
> still audible.
> 
> Any suggestions or modifications to the code below would be most
> welcome. I have read that possibly using Loader as oppose to SWFLoader
> could be the way to go, or maybe Module Loader? I am ver new to flex but
> not to actionscript and I seem to recall a similar problem once before
> but I am damned if I can remember how (or if) i resolved it.
> 
> Anyway, I hope this hasn't been answered ages ago and if it has please
> accept my apologies. I hope I can be of some use to some of you in
> future postings! 
> 
> Cheers
> --------------------------------
> Ben Reed
>


Reply via email to