Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: fortune cookie nightmare; putting PHP text on top of Flash video

  1. #1
    Join Date
    Jun 2009

    Question fortune cookie nightmare; putting PHP text on top of Flash video

    I have made a Flash video of a fortune cookie and at the end the white piece of paper is supposed to display a different fortune every time. I've used PHP cases for that. It doesn't work.

    Right now I am just trying to display any PHP text on top of the Flash video.

    echo '<div style="position:absolute; top: 280px; z-index:5; width: 350px; color: yellow">';
    echo 'the';
    echo '</div>';
    the 5 is to be sure it's above the movie layer, which has a smaller index
    none of it works. I don't know if the 'the' is behind the movie or heading graphic or anything. Sorry I can't show the actual site. It's on my computer. If that would help, I can upload it and graphic and video.

    The complete code (for those of you with a lot of time on your hands) is below:

    HTML Code:
    <style type="text/css">
    body {
    	background-color: black;
    	color: black;
    	text-align: center;
    	font-size: 17px;
    #center_wrapper {
    	margin-right: auto;
    	width: 720px;
    #center_wrapper2 {
    	margin-right: auto;
    	margin-left: auto;
    	width: 350px;
    	display: block;
    <script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
    <div id="center_wrapper">
    <img src="fortune_title.gif" style="position: relative; top: 30px" />
    <div id="flash" style="position:absolute; top: 100px; z-index:0">
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="720" height="480" id="FLVPlayer">
      <param name="movie" value="FLVPlayer_Progressive.swf" />
      <param name="quality" value="high" />
      <param name="wmode" value="opaque" />
      <param name="scale" value="noscale" />
      <param name="salign" value="lt" />
      <param name="FlashVars" value="&amp;MM_ComponentVersion=1&amp;skinName=Clear_Skin_1&amp;streamName=cookie&amp;autoPlay=true&amp;autoRewind=true" />
      <param name="swfversion" value="8,0,0,0" />
      <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you donít want users to see the prompt. -->
      <param name="expressinstall" value="Scripts/expressInstall.swf" />
      <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="FLVPlayer_Progressive.swf" width="720" height="480">
        <param name="quality" value="high" />
        <param name="wmode" value="opaque" />
        <param name="scale" value="noscale" />
        <param name="salign" value="lt" />
        <param name="FlashVars" value="&amp;MM_ComponentVersion=1&amp;skinName=Clear_Skin_1&amp;streamName=cookie&amp;autoPlay=true&amp;autoRewind=true" />
        <param name="swfversion" value="8,0,0,0" />
        <param name="expressinstall" value="Scripts/expressInstall.swf" />
        <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
          <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
          <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
        <!--[if !IE]>-->
    $rint = rand(1, 24);
    switch($rint) {
     case 1: $st = "I bet you can't eat another."; break;
     case 2: $st = "Now would be a good time to get your head out of your ass."; break;
     case 3: $st = "Wow.  Good luck with that one."; break;
     case 4: $st = "If you eat too many fortune cookies, you'll get fat (like Buddha) and wise (like Buddha)."; break;
     case 5: $st = "I'm a cryptic fact instead of a fortune."; break;
     case 6: $st = "Fortune cookies are b*ll****."; break;
     case 7: $st = "You will lose only two fingers in an accident that involves a dingo and a rabid rabbit."; break;
     case 8: $st = "The only way to win the lotto is by not playing it.  Here is your lotto number: 16-20-22-32-37."; break;
     case 9: $st = "You ate my fortune cookie."; break;
     case 10: $st = "Your future self will be a millipede.  It's karma, b*tch."; break;
     case 11: $st = "Girlfriend, don't you wear that shirt again."; break;
     case 12: $st = "Honesty is unbecoming of you."; break;
     case 13: $st = "Your death will involve a fire hydrant and a pair of high-heeled shoes."; break;
     case 14: $st = "Your love of peanut butter will be your undoing."; break;
     case 15: $st = "Hey, you're not supposed to choose this fortune cookie!"; break;
     case 16: $st = "Somebody will confuse you with Sandra Bullock, <br />and you will spend the rest of the day<br /> trying to figure out how that happened."; break;
     case 17: $st = "Atitudes are contagious-you can get them from holding hands."; break;
     case 18: $st = "You are a terrible, terrible person and should be thoroughly ashamed."; break;
     case 19: $st = "Dude, I've seen you dance, and dude, you shouldn't dance in public.";break;
     case 20: $st = "Despite the fact that you've always thought your favorite color was pink, it is actually green.  Good to know."; break;
     case 21: $st = "You are awesome like cheesecake."; break;
     case 22: $st = "If you don't have everything you want, try marrying into a large family so you'll get more presents at Christmas."; break;
     case 23: $st = "You are contemplateive and analytical.  While that sounds like a good thing, it actually means you're a nerd."; break;
     case 24: $st = "Watch Reno911 on Comedy Central on Wednesdays at 9:30pm. <br> It's way funnier than this fortune cookie gig."; break;
    <div id="center_wrapper2">
    echo '<div style="position:absolute; top: 280px; z-index:5; width: 350px; color: yellow;">';
    echo 'the';
    echo '</div>';
    <script type="text/javascript">
    I didn't really know when I was embedding the Flash video either.

    Is PHP even the right thing to make this work? Is what I'm trying to do even possible?

  2. #2
    Join Date
    Jan 2009
    Why don't you send the variables to flash and have it display the text?

  3. #3
    Join Date
    Jun 2009


    Because I have no idea what that means. Are you suggesting I get a book on ActionScript? I don't want a different video per each fortune. Do you mean I can randomly choose a phrase and display it using actionscript?

    It would be cool if I could make the play button be on the movie. I think that's very simple actionscript, right? I wouldn't know how to make the player not show up.

  4. #4
    Join Date
    Jan 2009
    You can send values to the flash element through flashvars. Then in the flash file use a little bit of actionscript to put that text into your textfield. That way you can just use the one video for all texts and you could even change the text without having to touch the flash file.

  5. #5
    Join Date
    Jun 2009
    Do you know of any good resources or tutorials for doing this? I kinda get what you're saying, but I have no idea how to implement it. Thanks for giving me some good basics for further investigation, though.

  6. #6
    Join Date
    Jan 2009

  7. #7
    Join Date
    Jun 2009
    How do I implement the random element of choosing a fortune?

    For now I am making a blank movie just to figure things out before implementing to the actual movie. I don't want to mess up what semi-works.

  8. #8
    Join Date
    Jan 2009
    You can still load the random fortune in PHP. Just include your value in a flashvar and output it using actionscript in flash.

    Or am I getting confused and you need to load a new fortune without refreshing the element?

  9. #9
    Join Date
    Jun 2009
    Once I display a fortune, you have the option of pushing play for the video player and getting another fortune. You don't refresh the page, if that's what you're asking....I'm not entirely sure.

  10. #10
    Join Date
    Jan 2009
    You can use a bit of AJAX type scripting to call your php file from flash if thats what you wish. Any way around it it would be much more difficult to try and position your output above the flash element and much easier to have the flash element grab the value either through flashvars or the flash calling your php directly. How were you planning to provide the text with PHP without a refresh before?

  11. #11
    Join Date
    Jun 2009
    Well, I never got it to display, so I don't know if it ever changed randomly. :nP I just realized that. Does Flash have code for randomly selecting something? I also have to time the appearance of the fortune so it is right when the cookie opens, which I can do by adding a keyframe. Could I just make lots of mini movies of different fortunes when the fortune is displayed? And put one of those mini-fortune movies after the opening the fortune movie? Can Flash do that? I can make the mini-movies. I just don't know how to go about randomly selected one of them and playing it after the opening cookie movie.

  12. #12
    Join Date
    Jan 2009
    You can make mini movies but it would be easier to make one animation and use a textfield with an instance name so you can add the text dynamically. Very similar to the way PHP works in fact.

  13. #13
    Join Date
    Jun 2009
    Okay, so I'm taking this one step at a time, and I'm just trying to put text on my video clip (.flv) embedded in my Flash viewer thingy in Flash. On the last frame, I put a keyframe and wrote:

    myTextField.text = "Hello World";

    this.createTextField("my_txt", 30, 30, 30, 100, 21);
    my_txt.text = "the";


    The stop(); works, the myTextField doesn't, and neither does the "the". I'm going off of http://livedocs.adobe.com/flash/9.0/...=00000887.html and one of the links.

    It seems like it should be so simple.

  14. #14
    Join Date
    Jan 2009
    Are you creating a flash for actionscript 2 or actionscript 3? Flash 9 or better supports actionscript 3.

  15. #15
    Join Date
    Jun 2009
    I have Adobe Flash CS4. It's not showing up within the program.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.12604 seconds
  • Memory Usage 3,040KB
  • Queries Executed 15 (?)
More Information
Template Usage (37):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (1)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (15)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (15)postbit
  • (15)postbit_onlinestatus
  • (15)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (75):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates