dcsimg
A Flash Developer Resource Site

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

Thread: CS4/AS3 - Can't Unload FLV Called to Timeline

Hybrid View

  1. #1
    Junior Member
    Join Date
    Oct 2006
    Posts
    26

    CS4/AS3 - Can't Unload FLV Called to Timeline

    Hello - I'm working on a flash music site (http://moronica.net.index2.html) and am trying to integrate a 480x320 .flv into a frame loop in the "game" section of the main movie.

    I first tried loading a .swf version of the same file but I couldn't get the file to unload and it really slowed down the performance of the main movie.
    That was Thursday.

    So I tried to use quicktime but flash CS4 no longer accepts it.

    All day yesterday I've been working with a .flv version (which doesn't look nearly as good) and tried to directly import it but got an error ("no such file exists") even when it's right next to the other files.

    With the Wizard I tried both picking the local file and assigning the URL of the file previously uploaded to my site.

    So i then tried to use actionscript to load it into the actions layer on the frame at the beginning of the "game" scene which after hours of fiddling finally worked.

    Here's the current problem:

    I just want it to loop until someone clicks to go to another section but now what happens is the video and sound from the .flv keep playing even after you click on another button to navigate away from this scene.

    I tried online to find a way to unload the .flv but none of them worked - wen thru pages and pages of google searches but the suggested coding did not prevent the .flv from unloading.

    here's my code which is in the actions layer at the beginning of the "game" scene:

    var vid:Video = new Video(480, 320);

    vid.x=231;
    vid.y=457;

    addChild(vid);

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

    var ns:NetStream = new NetStream(nc);
    vid.attachNetStream(ns);

    var listener:Object = new Object();
    listener.onMetaData = function(evt:Object):void {};
    ns.client = listener;

    ns.play("compton.flv");

    It is very frustrating that Adobe makes it incredibly difficult for an intermediate user to do such a basic thing - load a swf or flv into an fla and have it play, then stop playing when someone navigates away. RIDICULOUS.

    So any help would be most appreciated and sorry for the type o negativity

    Mark

  2. #2
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    ns.close();
    ns.attachnetStream(null);
    ns.attachnetStream(false);

    its on of those i'd have to open code snippets to be sure but i'm eating a hotdog
    ~calmchess~

  3. #3
    Junior Member
    Join Date
    Oct 2006
    Posts
    26
    thank you so much -

    should your code be put in in the actions layer of the start frames of all the other scenes or in the main AS3 code in the first frame of the entire movie which controls all the buttons?

    mark

  4. #4
    Junior Member
    Join Date
    Oct 2006
    Posts
    26
    I just tried to place the code in the first frame of the actions layer for the "music" scene sections and got this error message:

    1061: Call to a possibly undefined method attachnetStream through a reference with static type flash.net:NetStream.

  5. #5
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    spell it right upper and lower case
    ~calmchess~

  6. #6
    Junior Member
    Join Date
    Oct 2006
    Posts
    26
    I copied and pasted your code so I didn't introduce any spelling errors...

    mark

  7. #7
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    code should be placed in the frame where the netConnection and Netstream are intialized if you try to put the code in any other frame it will be out of scope.
    ~calmchess~

  8. #8
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    I spelled it wrong sorry.
    ns.close();
    vid.attachNetStream(null);
    vid.attachNetStream(false);
    ~calmchess~

  9. #9
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    i apologize for sending you on missions
    ~calmchess~

  10. #10
    Junior Member
    Join Date
    Oct 2006
    Posts
    26
    i tried to paste it below the code which loads the .flv and got this error:

    1061: Call to a possibly undefined method attachnetStream through a reference with static type flash.net:NetStream.

    damn....

    thanks for the assist -

    mark

  11. #11
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    does that work?

    vid.attachNetStream(null);
    ~calmchess~

  12. #12
    Junior Member
    Join Date
    Oct 2006
    Posts
    26
    sorry for the delay - had to go out of town and just got back -

    I put the code at the end of the script that loads the flv and got the same 1061 error message -

    here's the code:

    var vid:Video = new Video(480, 320);

    vid.x=231;
    vid.y=457;

    addChild(vid);

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

    var ns:NetStream = new NetStream(nc);
    vid.attachNetStream(ns);

    var listener:Object = new Object();
    listener.onMetaData = function(evt:Object):void {};
    ns.client = listener;

    ns.play("compton.flv");

    ns.close();
    ns.attachnetStream(null);
    ns.attachnetStream(false);

  13. #13
    Junior Member
    Join Date
    Oct 2006
    Posts
    26
    also tried vid.attachNetStream(null);

  14. #14
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    try this code while i go look in my snippets for the proper way to kill a stream

    PHP Code:


    var vid:Video = new Video(480320);

    vid.x=231;
    vid.y=457;

    addChild(vid);

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

    var 
    ns:NetStream = new NetStream(nc);
    vid.attachNetStream(ns);

    var 
    listener:Object = new Object();
    listener.onMetaData = function(evt:Object):void {};
    ns.client listener;
    ns.play("compton.flv");
    vid.attachNetStream(null); 
    Last edited by calmchess; 06-06-2010 at 08:11 PM.
    ~calmchess~

  15. #15
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    i had a type edited the above post should work now
    ~calmchess~

  16. #16
    Junior Member
    Join Date
    Oct 2006
    Posts
    26
    it doesn't like the last line of code and i'm getting the 1061 error still...

  17. #17
    Junior Member
    Join Date
    Oct 2006
    Posts
    26
    I think I know why all this is happening - I have a 2006 Mac Pro Xeon and everything worked ok with CS3. I upgraded to CS4 but the new encoder/media center will not run on that architecture. So I had to convert my mov to an flv using the CS3 encoder which is only supported by the Flash 8 player.

    I am using a jukebox in my main movie that requires AS3 so I can't set the publishing setting to Flash 8 player.

    So I'm now guessing that I'm trying to communicate to a .flv that was made to work with an earlier version of Flash

  18. #18
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    yeah that could be true the reason my code fails is because i'm trying to use code that destroys a stream for a webcam on a progressive stream thats playing a video on a video object.
    ~calmchess~

  19. #19
    Junior Member
    Join Date
    Oct 2006
    Posts
    26
    could you do me a incredibly huge favor and encode my .mov to an FLV for flash player 9 so it will work with CS4 on my Mac Pro?

    I would very extremely grateful - I'm pretty sure that's the only way this is going to work

    if you will, here's the link: http://moronica.net/compton.mov.zip

    thanks again for all your help - I guess you have to buy a new mac and the latest Creative Suite every two years

    one other thing that happened when I upgraded to CS4 is that Premiere also wouldn't work in my architecture...

    mark

  20. #20
    Senior Member calmchess's Avatar
    Join Date
    Sep 2006
    Location
    Earth
    Posts
    2,588
    the archive is either damaged or is an unknown format
    ~calmchess~

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