A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: [RESOLVED] AS3: looping video error message

  1. #1
    Member
    Join Date
    Sep 2009
    Posts
    32

    resolved [RESOLVED] AS3: looping video error message

    Here is my site sans looping video: http://fantasy-animation.com

    I am setting my video up to loop. I used the following code:

    __________________________________________________ ___________

    var vid:Video = new Video();
    var nc:NetConnection = new NetConnection();
    nc.connect(null);
    var ns:NetStream = new NetStream(nc);
    ns.addEventListener(NetStatusEvent.NET_STATUS, ns_onPlayStatus);
    addChild(vid);
    vid.attachNetStream(ns);
    ns.play("main.flv");

    /////loop video
    var count:Number = 0;
    function ns_onPlayStatus(event:NetStatusEvent):void {
    trace(event.info.code);
    if (event.info.code == "NetStream.Play.Stop") {
    if(count == 0){
    ns.play("main.flv");
    count++;
    trace("now what?");
    } else {
    ns.seek(0);
    }
    }
    }

    __________________________________________________ ___________

    It works but returned this error message:
    __________________________________________________ ___________

    NetStream.Play.Start
    NetStream.Buffer.Empty
    NetStream.Buffer.Full
    Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.NetStream was unable to invoke callback onMetaData. error=ReferenceError: Error #1069: Property onMetaData not found on flash.net.NetStream and there is no default value.
    at index_fla::MainTimeline/frame3()
    Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.NetStream was unable to invoke callback onXMPData. error=ReferenceError: Error #1069: Property onXMPData not found on flash.net.NetStream and there is no default value.
    at index_fla::MainTimeline/frame3()

    __________________________________________________ ___________

    How can I change the code to eliminate this message?

    Thanks in advance.

    D

    fantasy-animation.com

  2. #2
    Senior Member
    Join Date
    Jan 2009
    Posts
    208
    netStream.addEventListener(AsyncErrorEvent.ASYNC_E RROR, doAsyncError);
    netStream.addEventListener(IOErrorEvent.IO_ERROR, doIOError);

    Also, register for Metadata:

    var clientObject:clientObject = new Object();
    clientObject.onMetaData = doMetaData;

    function doMetaData(infoObject:Object):void {

    }

  3. #3
    Member
    Join Date
    Sep 2009
    Posts
    32

    access of undefined property

    var clientObject:clientObject = new Object();

    type was not found or was not a compile time constraint: clientObject
    Last edited by dennisRep; 09-04-2010 at 11:17 AM.

  4. #4
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    var clientObject:Object = new Object();

  5. #5
    Member
    Join Date
    Sep 2009
    Posts
    32
    Thanks Beathoven,

    The following statements contain variables that have not been defined?

    netStream.addEventListener(AsyncErrorEvent.ASYNC_E RROR, doAsyncError);
    netStream.addEventListener(IOErrorEvent.IO_ERROR, doIOError);

    access of undefined property netStream,
    access of undefined property doAsyncError,
    access of undefined property doIOError

  6. #6
    Senior Member
    Join Date
    Jan 2009
    Posts
    208
    Quote Originally Posted by dennisRep View Post
    var clientObject:clientObject = new Object();

    type was not found or was not a compile time constraint: clientObject
    Sorry, I misspelled it, but

    Beathoven corrected it.


    Quote Originally Posted by dennisRep View Post
    Thanks Beathoven,

    The following statements contain variables that have not been defined?

    netStream.addEventListener(AsyncErrorEvent.ASYNC_E RROR, doAsyncError);
    netStream.addEventListener(IOErrorEvent.IO_ERROR, doIOError);

    access of undefined property netStream,
    access of undefined property doAsyncError,
    access of undefined property doIOError

    Yes, I didnt wrote the whole thing.
    Open flash help to see in details.

    netStream you defined as ns, and these functions need to be defined as well:
    Actionscript Code:
    _netConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, doSecurityError);        _netConnection.addEventListener(NetStatusEvent.NET_STATUS, doNetStatus);
    _netConnection.addEventListener(IOErrorEvent.IO_ERROR, doIOError);
    _netStream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, doAsyncError);
    _netStream.addEventListener(NetStatusEvent.NET_STATUS, doNetStatus);
    _netStream.addEventListener(IOErrorEvent.IO_ERROR, doIOError);

    private function doSecurityError(e:SecurityErrorEvent):void {
               
           
    }
           
    private function doIOError(e:IOErrorEvent):void {
               
           
    }
           
    private function doAsyncError(e:AsyncErrorEvent) {
               
           
    }

  7. #7
    Member
    Join Date
    Sep 2009
    Posts
    32
    I have posted this question because I don't know AS3 very well. I don't know anything about the code you are posting. Posting incomplete answers is confusing me more than I was at start. I suspect your last post is incomplete as well as I am getting more errors with more undefined properties.

    I appreciate your help, but incomplete answers don't help me.

  8. #8
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    nc.addEventListener(SecurityErrorEvent.SECURITY_ER ROR, doSecurityError); nc.addEventListener(NetStatusEvent.NET_STATUS, doNetStatus);
    nc.addEventListener(IOErrorEvent.IO_ERROR, doIOError);
    ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, doAsyncError);
    ns.addEventListener(NetStatusEvent.NET_STATUS, doNetStatus);
    ns.addEventListener(IOErrorEvent.IO_ERROR, doIOError);

    private function doSecurityError(e:SecurityErrorEvent):void {


    }

    private function doIOError(e:IOErrorEvent):void {


    }

    private function doAsyncError(e:AsyncErrorEvent) {


    }

  9. #9
    Member
    Join Date
    Sep 2009
    Posts
    32
    Ok, thanks.

    When I post the script as is, I get message 1013: The private attribute may be used only on clas property definitions.

    If I remove 'private' from the code, 'doNetStatus' is undefined.

    Looks like we are almost there. Are you over me yet?

  10. #10
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    Sorry I just quickly skimmed over reg's code.

    If you are not using classes, then you can remove the private statements. They are used within classes to make the functions only available within that class. They are irrelevant to timeline coding.

    The reason doNetStatus is undefined is because you need to create the function.

    The way this works if you look at this statement:

    nc.addEventListener(NetStatusEvent.NET_STATUS, doNetStatus);

    This is what it says:

    Take the object nc (You created this object a few lines above and made it an object of "NetConnection" type) and add an event listener to it. Event listener will listen for events that are dispatched from that nc object.

    If the nc object receives an event of type "NetStatusEvent.NET_STATUS", then the program needs to execute the function "doNetStatus".

    Thinking you would grasp the concept, reg gave you a few function definitions and figured you could fill in the blanks. This is how you would define the doNetStatus function:

    function doNetStatus(e:NetStatusEvent):void
    {

    }

    What this does is say create a function named "doNetStatus". This function will recieve an event of type "NetStatusEvent" as an argument and assign the value of that "NetStatusEvent" to the variable "e". (ie: (e:NetStatusEvent)). The last part, ":void" means the function will not return anything, there will be no return statement within the brackets. ( {} ).

    So for this whole piece of code to work, it needs this:

    Code:
    nc.addEventListener(SecurityErrorEvent.SECURITY_ER ROR, doSecurityError);
    nc.addEventListener(NetStatusEvent.NET_STATUS, doNetStatus);
    nc.addEventListener(IOErrorEvent.IO_ERROR, doIOError);
    ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, doAsyncError);
    ns.addEventListener(NetStatusEvent.NET_STATUS, doNetStatus);
    ns.addEventListener(IOErrorEvent.IO_ERROR, doIOError);
    
    function doSecurityError(e:SecurityErrorEvent):void {
    
    
    }
    
    function doNetStatus(e:NetStatusEvent):void {
    
    }
    
    function doIOError(e:IOErrorEvent):void {
    
    
    }
    
    function doAsyncError(e:AsyncErrorEvent) {
    
    
    }

  11. #11
    Member
    Join Date
    Sep 2009
    Posts
    32
    Thank you so much for taking the time to not only help me with the code but EXPLAIN it as well. I am a digital artist not a developer, so I am a beginner level at best when it comes to code. Just giving me the code is great, but I would like to learn what the code is doing line by line as well.

    I have made the changes and everything works great.
    Last edited by dennisRep; 09-04-2010 at 08:24 PM.

  12. #12
    Member
    Join Date
    Sep 2009
    Posts
    32
    It would be a great policy to follow Beathoven's example when helping others with code. It would be very helpful to comment out each line of code so we can understand what it does. After all, I think most of us want to learn it, not just copy and paste it.

  13. #13
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    Please mark the thread resolved. (Top Right, Thread Tools, Mark Thread Resolved)

  14. #14
    Member
    Join Date
    Sep 2009
    Posts
    32
    I did.

Tags for this Thread

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