A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Dynamic Button with Streaming Video

  1. #1
    Junior Member
    Join Date
    Jun 2003
    Posts
    14

    Dynamic Buttons with Streaming Video,Audio

    I finally got cloned buttons working like I wanted.

    I am using an external text file to load the Titles,
    Descriptions and filenames for swfs or jpgs files into a movie that corresponds to each button.

    Some of the swfs are video encoded flash files.

    It is still a work in progress, but if any one is interested:

    trafficsafetyproductsandmore.com/videos/dynamic_menu.html

    pmjackson
    Last edited by pmjackson; 07-04-2003 at 01:55 AM.

  2. #2
    A Senior Newbie - How Odd ForumNewbie's Avatar
    Join Date
    Mar 2003
    Posts
    590
    This looks really good, particularly all the streaming stuff.

    Just one thing though:

    How come the wind resistant traffic cones fall over in the wind!!



    M.
    Please note that my domain has changed to http://www.morganmultinational.com

  3. #3
    Junior Member
    Join Date
    Jun 2003
    Posts
    14
    It's getting there.

    The real point is that all of the content is dynamic. Not part of the Flash File. An external text file holds all the data that the Flash program uses whether it be a streaming video, jpg or another swf movie. The buttons are clones of a hidden button. The captions are pulled from the external file along with the descriptions and the filenames that are used by the template.

    It would make it very easy to allow Web customers to update their own site and information. They simply have to upload the files along with the text data and it is parsed into the template.



    I see what you mean about the cones. It's not really clear but,the wind cones are alternated with non wind type. The video doesn't get close enough to tell the difference.
    I'll change the description to bring that out. By the way no change to the flash file will be needed to do this.

    Thanks for the reply.

  4. #4
    Senior Member
    Join Date
    Jan 2003
    Posts
    169
    Woah! Cool!

    I thought the cones one was cute (as in funny or LOL). It would be nice to see the code for this one.

  5. #5
    Junior Member
    Join Date
    Jun 2003
    Posts
    14
    Source for Dynamic Buttons with Streaming Videos

    Note: Pay close attention to the text file format.
    No space after the variables.
    Place in same folder as swf or change path in starting script.
    Attached Files Attached Files

  6. #6
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    FANTASTIC WORK

    This is great thanks!!!!

  7. #7
    Junior Member
    Join Date
    Jun 2003
    Posts
    14
    Thanks for your kind replys.

    My next goal with this is to create an online means to upload files,
    create the text file, or use a database to save the external data.
    Database sounds great,but I little experience with it.

    Then use a special login to allow updates easily.
    Maybe on the same Template.

    Any thoughts on this would be appreciated.

  8. #8
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Originally posted by pmjackson
    Thanks for your kind replys.

    My next goal with this is to create an online means to upload files,
    create the text file, or use a database to save the external data.
    Database sounds great,but I little experience with it.

    Then use a special login to allow updates easily.
    Maybe on the same Template.

    Any thoughts on this would be appreciated.
    If I can help you with PHP and MySql Let me know. I've integrated these many times with Flash.

  9. #9
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    wow

    Ok I'm really impressed now that I've looked at the code for this.

    I'm a little confused as to how in the heck you did it.

    PHP Code:

    new_button
    [i].movie.choice=i// ****create a new variable per clone  ****important to use to know what button is pressed
    temp_element new_button[i]+".movie.t1";  //t1 is the editbox variable

    root[temp_element]=_root["b"+i]; //index the text file variables-- put caption on the buttons

    Ok choice is a property that you are creating?

    the last two lines totaly elude me....

  10. #10
    Junior Member
    Join Date
    Jun 2003
    Posts
    14
    I wish I had documented the steps it took to finally get to this code.

    I do know that it took a while to finally pin-piont some key pieces, alot of ActionScript searching and just playing with the code. Many of the points ended up being in the 3DFA Help files.

    Key Points:
    1) Button elements are actually "child movies". You must use the movie property to access the variables of the child movie. Hence new_button[i]+".movie.t1 " (see 3DFA Help --Objects---Movies---Scripts and movies.) It makes sense now, But it was long getting to understand this...

    I re-coded it a little clearer. But this line this.t1= root[this +".t1"]; in Btton 29.mouse over needs to be deleted.

    new_button= new Array;

    for (i=1;i<21;i++){
    new_button[i]=n_button.clone();
    new_button[i].x=8; // position button clones
    new_button[i].y=(i*23)-6; // same
    new_button[i].movie.choice=i; // Create and set a new property as a pointer(indexer)
    new_button[i].movie.t1 = root["b"+i]; // use movie property to access edit box var(t1)of element("Button 29")
    } // set it to Pseudo array element b(i)ndex)

    It is still getting clearer to me. Hope this helped.
    Last edited by pmjackson; 07-08-2003 at 12:12 AM.

  11. #11
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    child movie

    Ah Ha!
    I didn't realize that a button was a child movie. That makes sense now, and I can see how it could work.

  12. #12
    Member
    Join Date
    Nov 2001
    Posts
    49
    Tried it, love it, one question......

    could this all be loaded locally?
    Say all the files, menu & menu.txt on a cd-rom & played locally instead of on the web?

    Thanks

  13. #13
    Junior Member
    Join Date
    Jun 2003
    Posts
    14
    Yes, it can be driven locally.

    The easiest way is to place all the files in a single directory/folder. The html,swf and all of the files pointed to in the Menu_info.txt file. Place all of them in a single folder.
    Then run the html file from that folder.

    In the starting script change the loadVariables command to:
    root.loadVariables ("Menu_info.txt",root)

    Next in the Menu_info.txt file:
    Change the &fn variables to something like this:

    &fn1=localfile.jpg

    Actually, as long as you set the paths to the files correctly you can have the files located anywhere on the local machine or on the internet. It can be mixed.

    I hope this answered your question.

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