4 Replies Latest reply on Jun 15, 2009 6:39 PM by jaijaz

    Spark VideoPlayer problem

    jaijaz

      I am trying to work with a Spark VideoPlayer and load video into it depending on what is selected in a tree.

       

      I can populate a label or text field but when I try to set the source of the player is throws up this error:

       

      TypeError: Error #1006: value is not a function.

      at SerkoTutorials/poplulateViewer()[/Users/jai/Documents/Adobe Flash Builder Beta/SerkoTutorials/src/SerkoTutorials.mxml:22]

      at SerkoTutorials/__moduleTree_change()[/Users/jai/Documents/Adobe Flash Builder Beta/SerkoTutorials/src/SerkoTutorials.mxml:37]

      at flash.events::EventDispatcher/dispatchEventFunction()

      at flash.events::EventDispatcher/dispatchEvent()

      at mx.core::UIComponent/dispatchEvent()[E:\dev\beta1\frameworks\projects\framework\src\mx\co re\UIComponent.as:11260]

      at mx.controls.listClasses::ListBase/mouseUpHandler()[E:\dev\beta1\frameworks\projects\frame work\src\mx\controls\listClasses\ListBase.as:10153]

      at mx.controls::List/mouseUpHandler()[E:\dev\beta1\frameworks\projects\framework\src\mx\cont rols\List.as:2440]

      at mx.controls::Tree/mouseUpHandler()[E:\dev\beta1\frameworks\projects\framework\src\mx\cont rols\Tree.as:3147]

       

       

      My code is:

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"

      xmlns:mx="library://ns.adobe.com/flex/halo"

      minWidth="960" minHeight="675" width="100%" height="100%" creationComplete="srv.send()" xmlns:local="*">

      <s:layout>

      <s:BasicLayout/>

      </s:layout>

      <fx:Declarations>

      <mx:HTTPService id="srv" url="assets/data.xml" resultFormat="e4x"/>

      <mx:XMLListCollection id="datalist" source="{srv.lastResult.category}"/>

      </fx:Declarations>

      <fx:Script>

      <![CDATA[

      import flash.net.navigateToURL;

      private var source:String;

      private function poplulateViewer(event:Event):void{

      if (player.playing) {

      player.stop();

      }

      var selectedNode:Object=event.target.selectedItem;

      playerPanel.title = selectedNode.@name;

      player.source(selectedNode.@file);

      }

      private function goToJaijaz() : void

                  {

                      navigateToURL( new URLRequest( "http:www.jaijaz.co.nz" ), '_blank' );

                  }

       

      ]]>

      </fx:Script>

      <fx:Style source="SerkoTutorials.css"/>

      <s:HGroup height="50" left="10" right="10" top="10">

      <mx:Image source="assets/logo.gif"/>

      </s:HGroup>

      <s:HGroup top="60" left="10" right="10" bottom="60">

      <s:Panel id="treePanel" width="30%" height="100%" skinClass="skins.TreePanelSkin">

      <mx:Tree width="100%" height="100%" dataProvider="{datalist}" labelField="@name" change="poplulateViewer(event)"  id="moduleTree" color="#000000" borderStyle="none"/>

      </s:Panel>

      <s:Panel id="playerPanel" width="100%" height="100%" skinClass="skins.PlayerPanelSkin">

      <s:VideoPlayer id="player" width="776" height="582" skinClass="skins.CustomVideoPlayerSkin" />

      </s:Panel>

      </s:HGroup>

      <s:HGroup height="40" bottom="10" left="10" right="10">

      </s:HGroup>

      </s:Application>

       

      Any help would be hugely appreciated.

       

      Thanks.

        • 1. Re: Spark VideoPlayer problem
          Peter deHaan Level 4

          jaijaz,

           

          Out of curiosity, what does your "assets/data.xml" file look like?

           

          Peter

          • 2. Re: Spark VideoPlayer problem
            jaijaz Level 1

            <?xml version="1.0" encoding="utf-8"?>

            <modules>

            <category name="Introduction" catid="1">

            <module name="Login and Navigation" file="assets/modules/Sample1-Amy.mp4"/>

            <module name="Manage My Profile" file="assets/modules/Sample2-Sarah.mp4"/>

            </category>

            <category name="Create Travel Bookings" catid="2">

            <module name="Commence a Quick Booking" file="assets/modules/edit.mp4"/>

            <module name="Select Air Requirements" file="this is cat2 module2"/>

            <module name="Book Air Sectors" file="this is cat2 module3"/>

            <module name="Book Rental Car" file="assets/modules/edit.mp4"/>

            <module name="Book Hotel" file="this is cat2 module2"/>

            <module name="Finalise Booking" file="this is cat2 module3"/>

            </category>

            <category name="Maintain Travel Bookings" catid="3">

            <module name="View Existing Bookings" file="this is cat3 module1"/>

            <module name="Create Booking Documentation" file="this is cat3 module2"/>

            <module name="Modify/Cancel a Booking" file="this is cat3 module3"/>

            <module name="Authorise a Booking" file="this is cat3 module2"/>

            </category>

            <category name="Administration" catid="3">

            <module name="Create a Custom Booking" file="this is cat3 module1"/>

            <module name="Manage Unused Tickets" file="this is cat3 module1"/>

            </category>

            <category name="Other" catid="3">

            <module name="Clue Card" file="this is cat3 module1"/>

            </category>

            </modules>

            • 3. Re: Spark VideoPlayer problem
              Peter deHaan Level 4

              Try changing your code to this:

               

              player.source = selectedNode.@file.toString();

               

              I believe you were trying to do something like player.source(selectedNode.@file);

               

              Peter

               

               

              • 4. Re: Spark VideoPlayer problem
                jaijaz Level 1

                Peter, thank you so much!

                 

                I didn't think of putting to string as I hadn't needed to do it in Flex 3 with video object there.

                 

                Thanks heaps.