A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: Media Playback component & variables...

  1. #1
    Animal Flasher RobbieC's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    242

    [MX04] Media Playback component & variables...

    I'm trying to get a Media Playback component to play videos. I can get it all to work if I hard code the component with this code:
    Code:
    video/1234.flv
    but I'm trying to get it to work by parsing a variable into it using:
    Code:
    video/+variable+.flv
    the variable is parsed into the movie using:
    Code:
    main.swf?variableID=1234
    and the code within the movie to identify the variable:
    Code:
    var variable = _root.variableID;
    but it doesn't work, although I can't see anything wrong with what I've done.

    Is it actually possible to use Media Playback component with variables?

    Thanks in advance for your help.
    Last edited by RobbieC; 09-22-2007 at 01:21 PM.

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    variable is a Textfield property, it is recommended to not
    use reserved words in your naming strategy in Flash.

    i tested with this in html -
    <param name="movie" value="test.swf?variableID=1234" />
    <embed src="test.swf?variableID=1234" .....

    in Flash, i have a dynamic textfield with instance name - varsTxt
    and code on the main timeline -

    varsTxt.text = "video/"+variableID+".flv";

    the textfield shows - video/1234.flv

    any help to you ??

  3. #3
    Animal Flasher RobbieC's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    242
    thanks for getting back to me. I don't have a problem getting the variable parsed into the flash movie (using dynamic text like you suggested), but I'm still having problems getting the variable into the MediaPlayback component. If I hard-code :
    Code:
    video/1234.fla
    into the MedaiPlayback component URL, it works, but if I try to use the variable using:
    Code:
    video/+_root.variableID+.fla
    it doesn't.... My question is, on the 'Component Inspector' for the MediaPlayback component, can I put
    Code:
    +_root.variableID+
    into the URL? It doesn't appear to like it.....

  4. #4
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    in folder - video, I have w50s.flv

    in html, appended to the object/embed code - "test.swf?variableID=w50s"

    in Flash - MediaPlayback component, instance name - myPlybk
    and code on main timeline - frame#1 -

    path = "video/"+variableID+".flv";
    myPlybk.contentPath = path;

    hth

  5. #5
    Animal Flasher RobbieC's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    242
    it still doesn't like it.... variableID is successfully parsing, path is being built correctly, but the Media Playback component still won't follow the path....

    I've put my working example here http://www.bigbrother.co.uk/videotest.htm and zipped it all up there with a link.

    It's probably something stupidly ridiculous that I have missed....

    If you can help, I'll be very grateful

    Cheers

  6. #6
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    haven't dl'd the zip, looking at your html, you need either -

    ID.text = variableID;
    path.text = "video/"+ID.text+".flv";
    myPlybk.contentPath = path.text;

    or simply-

    path = "video/"+variableID+".flv";
    myPlybk.contentPath = path;

  7. #7
    Animal Flasher RobbieC's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    242
    I just don't get it.....

    do I have to do anything else to the Media Playback Controller to get it to work? The URL is left blank and all I have done is named it MyPlybk.

    the code I have on frame 1 is: MyPlybk.contentPath = path.text;

    I have tried every combination of strings and it won't play. It plays fine if I hard code video/1426.flv into the url of the component...... aaarrrghh

  8. #8
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    tested online at - http://www.jackleaman.co.uk/test/flv/test.html
    zip file - http://www.jackleaman.co.uk/test/flv/test.zip

    NOTE: place w50s.flv in video folder

    hth

    ps..please let me know when you have the zip file
    as space is limited on my server
    Last edited by a_modified_dog; 09-23-2007 at 07:09 AM.

  9. #9
    Animal Flasher RobbieC's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    242
    I'm so sorry about all this mate. I can't actually open your .fla file.... I'm using MX Pro 2004 and it says it's an 'unexpected file format'.... doh

  10. #10

  11. #11
    Animal Flasher RobbieC's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    242
    Thank you very much mate - I got it working!

    In my Media Playback component, I only had contentPath enabled in 'Schema'

    Your version had another 9 properties going on..... I copied those over and it works!!!

    Thanks again for your time mate! Much appreciated!

    Rob

  12. #12
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    you're welcome

  13. #13
    Junior Member
    Join Date
    Jun 2007
    Posts
    9
    How do you get rid of the white background in Media playback?

  14. #14
    Junior Member
    Join Date
    Jun 2007
    Posts
    9

    media playback

    How do you get rid of the white background in Media playback?

  15. #15
    Junior Member
    Join Date
    Jul 2006
    Posts
    5
    Quote Originally Posted by RobbieC View Post
    Thank you very much mate - I got it working!

    In my Media Playback component, I only had contentPath enabled in 'Schema'

    Your version had another 9 properties going on..... I copied those over and it works!!!

    Thanks again for your time mate! Much appreciated!

    Rob
    It would be great to know how to do this - use a variable passed via HTML to the SWF and load into mediaPlayback component. The source files you guys were working on have been since removed.

    Thank you in advance,
    HL

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