A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 24

Thread: [RESOLVED] Shouldn't a swf file loaded into a movie play its sound?

  1. #1
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389

    resolved [RESOLVED] Shouldn't a swf file loaded into a movie play its sound?

    Hi,

    I'm having some trouble.

    I have converted this MPG file into a swf file several times changing the audio bitrate to all the possible conversions, but each time I load it into Flash it's silent.

    Is this normal or is it me not doing something right?

    this is what I have in my code

    Code:
    stop;
    
    this.swapDepths(_root.board);
    
    var vLoader:MovieClipLoader = new MovieClipLoader();
    var vListener:Object = new Object();
    vLoader.addListener(vListener);
    
    this.createEmptyMovieClip("bHolder", this.getNextHighestDepth());
    
    bHolder._x = this._width /4;
    bHolder._y = this._height /4;
    vLoader.loadClip("Teach.swf", bHolder);
    and the swf is at: https://onedrive.live.com/redir?resi...int=file%2cswf

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    HI Cap,

    Copy the sound file from Teach.swf into the first swf library (the one that loads Teach.swf), publish the swf, then delete the sound file from the first swf library and publish again.

    Voila, don't ask me why it works.

  3. #3
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    Quote Originally Posted by fruitbeard View Post
    HI Cap,

    Copy the sound file from Teach.swf into the first swf library (the one that loads Teach.swf), publish the swf, then delete the sound file from the first swf library and publish again.

    Voila, don't ask me why it works.
    Are you suggesting that I ought to extract the sound file from the video, Fruit?

    I'm having a hard time following, you know...

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    HI Cap,

    I grabbed your swf from the link and had to decompile it to see how you had it.
    After decompiling it I had separate sound and video files.

    Perhaps you should just convert the mpg to flv and load it as video.( save you converting to swf and having the same problem with all )

    If you had attached or linked to your Teach.fla then I might have been able to give you a better answer.

  5. #5
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    Good morning, Fruit,

    thanks there... I see what you mean somehow. The reason I'm not using the fla is that I want my video as it is (with no black borders on top and bottom) I had tried.

    In fact this is all quite awkward. The swf plays with sound the second time around, perhaps when it's fully loaded?

    Maybe if you can connect later on before our 14:00 time you will see for yourself. I'm really busy these days...

    The thing is I want to alpha the clip down and get rid of the borders. That can't be done in the fla, can it? Even if I choose no skin, it always has the borders.

    see you

  6. #6
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi Cap,

    Good for you at being busy.

    I suggest you put a stop on the first frame of the video/music clips.

    Then use the complete rules for MoveClipLoader(), meaning use the onLoadComplete() and everything else.

    When movie has loaded completely, then tell it to play inside the onLoadComplete function.

    That way the sound wuill have loaded properly before playing at all.

  7. #7
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    Hi,

    thanks. Will try so but I can't seem to load the swf movieClip into a new file. All I get are empty frames.

    The swf I have is a conversion made with a video editing program

  8. #8
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    Hi, FruitBeard,

    Followed your suggestion and got the audio and video synced and all is working quite well but I can't remove the clip once it's finished now. I've tried unLoadClip and even removing the clip where it's at swapping the depths at 0, using onSoundComplete as a function.

    I can't post the code right now, but I'd like to finish it properly.

    Any ideas?

  9. #9
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi Cap,

    Try something like
    bHolder.unloadMovie();

    or

    unloadMovie(bHolder);

    or even remove bHolder movieClip itself

    removeMoveClip(bHolder);

  10. #10
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    Thanks, FruitBeard,

    but as usual I must be doing something wrong. I am using those methods with no result...

    var vLoader:MovieClipLoader = new MovieClipLoader();
    var vListener:Object = new Object();
    vLoader.addListener(vListener);

    this.createEmptyMovieClip("vHolder", this.getNextHighestDepth());
    vHolder._alpha = 30;
    vHolder._x = Stage.width /4;
    vHolder._y = Stage.height / 4;
    vLoader.loadClip("Teach.swf", vHolder);


    is this correct in the clip's frame?

    this is a swf with no sound I'm loading and later I'd like to use on sound complete to unload the movie.

    I think I used to have something like:

    var Teach:Sound = new Sound(this);
    Teach.loadSound("Teach.mp3", true);


    and then Teach.onSoundComplete trying to remove the clip, but I never achieved removing the clip

    Would you say this is a good idea?

  11. #11
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    HI Cap,

    You should messa round with combinations and you will figure it out.

    Either of the commands inside the function work (with my mock example )
    PHP Code:
    Teach.onSoundComplete = function()
    {
        
    trace("Complete");
        
        
    _root.vHolder.unloadMovie();
        
        
    removeMovieClip(_root.vHolder);
    }; 
    and if you want to see how it works when testing without the wrapper swf
    PHP Code:
    Teach.onSoundComplete = function()
    {
        if (
    _root.vHolder)
        {
            
    _root.vHolder.unloadMovie();

            
    removeMovieClip(_root.vHolder);
            
    trace("Complete and vHolder clip removed.");
        }
        else
        {
            
    trace("Complete, but not inside of vHolder clip.");
        }
    }; 
    Last edited by fruitbeard; 12-01-2015 at 01:46 PM.

  12. #12
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389

    Loading a flv instead

    Hi, Fruit,

    I am going crazy. I finally decided to use a FLV instead and it works and streams right, but since I want to get rid of the borders, I tried having everything happen in a movieclip.

    I know it loads because I can hear the music, but I've no idea about the mismatching coordinates relation and the clip doesn't show.

    I thought everything loads into 0, 0...

    Code:
    stop;
    
    _parent.music.stop();
    
    this.createEmptyMovieClip("vHolder", this.getNextHighestDepth);
    
    var my_nc:NetConnection = new NetConnection();
    my_nc.connect(null);
    var my_ns:NetStream = new NetStream(my_nc);
    
    vHolder.my_video.attachVideo(my_ns);
    vHolder.my_video._alpha = 40;
    
    my_ns.setBufferTime(5);
    my_ns.play("http://webs.ono.com/jpdurba/Untitled.flv");
    my_ns.onStatus = function(infoObject:Object) {	
    	if (infoObject.code == "NetStream.Play.Stop") {
    		vHolder.my_video._alpha = 0;
    	}
    };

  13. #13
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi Cap,

    You will need to put a new video into the library then put that into an empty movieclip and give the clip a name and the video a name.

    PHP Code:
    stop;

    _parent.music.stop();

    this.createEmptyMovieClip("vHolder",this.getNextHighestDepth);

    var 
    my_nc:NetConnection = new NetConnection();
    my_nc.connect(null);

    var 
    my_ns:NetStream = new NetStream(my_nc);
    vHolder.attachMovie("vidcontainer","vidcontainer",2);

    vHolder.vidcontainer.my_video.attachVideo(my_ns);
    vHolder.vidcontainer.my_video._alpha 40;

    my_ns.setBufferTime(5);
    my_ns.play("http://webs.ono.com/jpdurba/Untitled.flv");

    my_ns.onStatus = function(infoObject:Object)
    {
        if (
    infoObject.code == "NetStream.Play.Stop")
        {
            
    vHolder.vidcontainer.my_video._alpha 0;
        }
    }; 
    I have called it vidcontainer in the library (as linkage name) video instance name of my_video, clip not on stage.

  14. #14
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    Thanks, Fruit,

    after a while I reached that conclusion too, but I can't get it done.

    I want to get rid of the borders but I can't think of a way...

    I did this (almost the same)

    Code:
    stop;
    
    _parent.music.stop();
    
    this.attachMovie("vHolder", "vHolder", this.getNextHighestDepth());
    vHolder._x = 120;
    vHolder._y = 340;
    
    vHolder._alpha = 40;
    
    var my_nc:NetConnection = new NetConnection();
    my_nc.connect(null);
    var my_ns:NetStream = new NetStream(my_nc);
    
    vHolder.my_video.attachVideo(my_ns);
    vHolder.my_video.smoothing;
    
    my_ns.setBufferTime(5);
    my_ns.play("http://webs.ono.com/jpdurba/Untitled.flv");
    my_ns.onStatus = function(infoObject:Object) {	
    	if (infoObject.code == "NetStream.Play.Stop") {
    		vHolder.my_video.clear();
    	}
    };
    I'll just leave it like that but is there the way to add the skin here?
    Last edited by capdetrons; 12-05-2015 at 12:40 PM. Reason: changed mind

  15. #15
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    You should be able to crop the video in adobe media encoder when you convert it from mpg to flv, have a go.

    where is the video so I can try too, link.

    I think you need to use FLVPlayback component to use skins, not too sure.
    Last edited by fruitbeard; 12-05-2015 at 12:43 PM.

  16. #16
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    I'll upload it again... it'll take a while.

    I'm online if you're not too busy

  17. #17
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Is there a link to the video on the web, the actual mpeg

  18. #18
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    389
    I'm uploading the flv... should I upload the MPG instead?

  19. #19
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    Yes, i need the mpeg to see if it can be cropped when converting to a flv, you need to do it yourself.

    I just want to test it.

    I can get the flv anytime as its in the code
    Last edited by fruitbeard; 12-05-2015 at 01:05 PM.

  20. #20
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi Cap,

    Here is something that will help you along, especially the width height part.
    Save you resizing the video inside the movieClip all the time.

    PHP Code:
    my_ns.onMetaData = function(item:Object):Void 
    {
        for (var 
    detail:String in item);
        {
            
    trace(detail " = " item[detail]);
        }
        
    vHolder.my_video._width item.width;
        
    vHolder.my_video._height item.height;
    }; 

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