2 Replies Latest reply on Jan 7, 2013 6:03 AM by --tristian--

    Flex 4.5.1 Setting VideoPlayer source to null when it is already null results in a runtime error

    FM_Flame Level 1

      I moved my project from Flex 4.1 to Flex 4.5.1 and I noticed that setting VideoPlayer source to null when it is already null results in a runtime error. The same thing applies to the case where you specified as a source url some invalid location (no video found there) and then you try to set the source to null.

       

      Here is the error:

       

      TypeError: Error #1009: Cannot access a property or method of a null object reference.

          at spark.components::VideoDisplay/cleanUpSource()[E:\dev\4.5.1\frameworks\projects\spark\src \spark\components\VideoDisplay.as:1956]

          at spark.components::VideoDisplay/setUpSource()[E:\dev\4.5.1\frameworks\projects\spark\src\s park\components\VideoDisplay.as:1609]

          at spark.components::VideoDisplay/set source()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\VideoDisplay.as:1073 ]

          at spark.components::VideoPlayer/set source()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\VideoPlayer.as:1362]

       

       

      The problem is that in the VideoDisplay cleanUpSource function, in some of the cases there properties on the videoObject are modified like this:

       

      videoPlayer.displayObject.visible = true;

       

      without checking if displayObject is null which is done in the rest of the videoDisplay functions.

       

      So when it reaches this line: videoPlayer.displayObject.visible = true; it results in a runtime error.

       

      Is this supposed to work this way now ? I didn't have this problem on Flex 4.1. Not sure if it is a bug, but if it is please report it, I don't have the time right now to be checking in on this.

       

      I fixed it by checking if the source is set, of course... (that won't help me in cases where I provide a wrong or missing video url by mistake.. so it is important to be fixed!)

       

      F

        • 1. Re: Flex 4.5.1 Setting VideoPlayer source to null when it is already null results in a runtime error
          randawilly0

          Hi

           

          I found the same error displaying video on flex !

          in my simple code, i have :

           

          videoInfoDataVideo.source = videoName;

           

          the full error is :

          TypeError: Error #1009: Il est impossible d'accéder à la propriété ou à la méthode d'une référence d'objet nul.

                    at spark.components::VideoDisplay/cleanUpSource()[E:\dev\4.5.1\frameworks\projects\spark\src \spark\components\VideoDisplay.as:1956]

                    at spark.components::VideoDisplay/setUpSource()[E:\dev\4.5.1\frameworks\projects\spark\src\s park\components\VideoDisplay.as:1609]

                    at spark.components::VideoDisplay/set source()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\VideoDisplay.as:1073 ]

                    at spark.components::VideoPlayer/set source()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\VideoPlayer.as:1362]

                    at Function/item/private:updateVideo/anonymous/resultGetVideo()[C:\Users\randev\Adobe Flash Builder 4.5\visurbaCMS\src\item.mxml:800]

                    at flash.events::EventDispatcher/dispatchEventFunction()

                    at flash.events::EventDispatcher/dispatchEvent()

                    at HTTPOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\http\HTTPService.as:993]

                    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:318]

                    at mx.rpc::Responder/result()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\Responder.as:5 6]

                    at mx.rpc::AsyncRequest/acknowledge()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AsyncR equest.as:84]

                    at DirectHTTPMessageResponder/completeHandler()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\ messaging\channels\DirectHTTPChannel.as:451]

                    at flash.events::EventDispatcher/dispatchEventFunction()

                    at flash.events::EventDispatcher/dispatchEvent()

                    at flash.net::URLLoader/onComplete()

           

          did you solve the problem or someone else?

           

          Thanks