0 Replies Latest reply on Jan 23, 2011 2:51 PM by crni.ivan

    Flex 4 and php,get data from php script

    crni.ivan Level 1

      Hi,I'm new at flex,it is interesting,maybe will start learning a little bit more.

      I need help,I'm working with wordpress(php),with php I get video url from database,now I need to paste that url into my video player.

      Php script and embed code are on the same page.Can someone help me with flex.Tnx in advance.

      This is my php code

       

      $post_id = $_GET['post_id'];

      global $wpdb;

      $query = "SELECT * FROM wp_posts WHERE wp_posts.post_type = 'attachment' AND wp_posts.post_mime_type LIKE '%flv%' AND wp_posts.post_parent = $post_id";

      $result = $wpdb->get_row($query);

      $video = $result->guid;

       

      and this is my flex code :

       

      <?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/mx" minWidth="550" minHeight="440" height="328" width="704">

       

      <fx:Script>

      <![CDATA[

      import mx.events.VideoEvent;

       

       

      protected function button1_clickHandler(event:MouseEvent):void

      {

      var bmpData:BitmapData = new BitmapData(videoDisplay.width,videoDisplay.height-25);

      bmpData.draw(videoDisplay);

       

      var bm:Bitmap = new Bitmap(bmpData); 

      img.source = bm; 

      }

       

      ]]>

      </fx:Script>

       

      <fx:Declarations>

      <!-- Place non-visual elements (e.g., services, value objects) here -->

       

      <s:HTTPService id="video_url" resultFormat="text">

       

      </s:HTTPService>

       

      </fx:Declarations>

      <s:Button x="492" y="9" label="Capture image" width="132" click="button1_clickHandler(event)"/>

      <mx:Image id="img" left="414" horizontalCenter="202" right="10" top="38" verticalCenter="14" bottom="10"/>

      <s:VideoPlayer x="10" y="10" width="384" height="308" source="Futbal1.flv" id="videoDisplay" autoPlay="false"/>

      </s:Application>

       

      Can someone help me with this please.