Hi there,

I hope someone can help me. I had a look around the forums but did not find a post that matched my own question...

I created a simple competition form in flash that allows you to type in a promotional code and it either tells you if you have won or not. This works fine if I have only one promotional code, however if i want to have more than one winning code I can't as it takes the variable from the first or next highest level in the recordset

I think that I need to return some type of loop or array and say that if you type in either "123" or "456" either will parse the variable into FlashVars and play the winning sequence.

I am curently trying this

$prevar = array(<?php do { ?><?php echo $row_Promotions['PromotionalVariable']; ?>
<?php } while ($row_Promotions = mysql_fetch_assoc($Promotions)); ?>);

and then this is the flash object

</script>

<noscript>
<object classid="clsid😃27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="550" height="400" accesskey="p" tabindex="24" title="Promotional Form">
This is a form that shows an input box and submit button. Input your code to see if you have won anything...
<param name="movie" value="Promotion.swf" />
<param name="quality" value="high" />
<param name="flashvars" value="ProVar=$prevar&SuccessRes=<?php echo $row_Promotions['SuccessResponse']; ?> winning code is...<?php echo $row_Promotions['PromotionalVariable']; ?>" />
<embed src="Promotion.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="400" flashvars="ProVar=$prevar&SuccessRes=<?php echo $row_Promotions['SuccessResponse']; ?> winning code is...<?php echo $row_Promotions['PromotionalVariable']; ?>"></embed>
</object>
</noscript>

Any help would be greatly appreciated.

Thanks

Andi

    I don't understand from your code what you're trying to do, you have <?php tags in illogical places...

    Anyways, why are you forwarding anything to flash via flashvars? Can't you make the flash to contact your server (with XML object) when the code is entered, fetch response in XML, then parse XML for message from the server? On the server-side you can then have a script that checks the code input against entire database of valid winning codes. Much safer and allows refreshless communication between your flash object and server.

      Hi There,

      thanks for getting back to me...
      Know what you're saying... sorry, I am new to this forum.

      you have <?php tags in illogical places...

      We'll I am having difficulty posting my code in this form... when I do it dissapears...
      Does the # resolve this???

      The variable code for the array is above the

      <head>

      tag
      The SWF file that contains the flashvars variables is in the

      <object>

      swf itself...

      Anyways, why are you forwarding anything to flash via flashvars?

      Well... I guess I'll have to show you to see...

      Promotions Form

      If you want to test it out there are two active variable codes which return a response.

      eghamtest
      bar163

      this value is stored in a MySQL database and then supposed to be parsed into the FlashVars so that if the textinput in the flash movie is = MySQL database variable then it plays a winning sequence. Else it does not.

      This only works for one of the codes so far because I believe the flashvars need to retrieve from an array from the MySQL variables.

      At present it is only retrieving the last (or first) Variable that was entered into the recordset in the MySQL Records.

      Can't you make the flash to contact your server (with XML object) when the code is entered, fetch response in XML, then parse XML for message from the server? On the server-side you can then have a script that checks the code input against entire database of valid winning codes. Much safer and allows refreshless communication between your flash object and server.

      Yes that's entirely possible, although only learning about php and xml aqt the moment, but that's my next try failing this... php convert into xml and then use the load xml event in the flash object itself.

      Thanks

      Andi

        northstjarna wrote:

        Yes that's entirely possible, although only learning about php and xml aqt the moment, but that's my next try failing this... php convert into xml and then use the load xml event in the flash object itself.

        I suggest go directly to that. It is very easy. Google for "dynamic flash XML PHP tutorial " for tutorials and articles on the subject. Otherwise, anyone can see your promo code in the page source, unless you choose to encrypt somehow.

          Write a Reply...