[support] Flash objects within a module
sebastian
inforazor at gmail.com
Thu Dec 10 20:59:08 UTC 2009
I know how you set it up WITHOUT SWFtools / SWFObject2, but that might
not be the answer you are looking for:
Views->theme field [op populate value from variables]:
<script type="text/javascript">swfobject.embedSWF("<?php print
trim($output;) ?>", "replaceSWF", "720", "640", "10.0.0");
</script>
<div id="replaceSWF" class="swftools swfobject2">
</div>
this assumes you are loading swfobject.js, size would obviously need to
be configured/altered; and the content of the div you want to show if
the swf is not loaded [and before load is done]
Seb.
Yani wrote:
> Hi,
>
>
>
> I’m trying to add a Flash object to an existing module.
>
>
>
> I’ve tried a couple of ways without success.
>
>
>
> I’ve created a module.
>
> I have SWFTool with SWFObject2 enabled
>
>
>
> Using JS as per this
>
>
>
> $(document).ready(*function*(){
>
> *var* flashtags = $('<div>[swf
> file="http://XXX/sites/all/modules/flashtags/flash/flashtags.swf"]</div>').appendTo('#privatemsg-new').get(0);
>
> *if* (Drupal.jsEnabled) {
>
> Drupal.attachBehaviors(flashtags);
>
> }
>
> });
>
>
>
> By doing that I end up with this printed at the bottom of the form
>
>
>
> [swf file="http://XXX/sites/all/modules/flashtags/flash/flashtags.swf"]
>
>
>
> But no Flash object.
>
>
>
> I tried this approach…
>
>
>
> function privatemsg_form_alter(&$form, $form_state, $form_id) {
>
>
>
> $vars['swf_tags'] =
> swf("http://XXX/sites/all/modules/flashtags/flash/flashtags.swf",
>
> array('width' => '420', 'height' => '140', 'bgcolor' => '#336699'), FALSE,
>
> array('html_alt' => 'Name of site if flash is disabled.')
>
> );
>
>
>
> if ($form_id == 'privatemsg_new' && user_access('create flashtags')) {
>
> $form['privatemsg']['flashtags'] = array(
>
> '#type' => 'fieldset',
>
> '#access' => user_access('create flashtags'),
>
> '#title' => t('Flash Tags'),
>
> '#collapsible' => FALSE,
>
> '#collapsed' => empty($form['#privatemsg_message']['flashtags']),
>
> '#description' => t('Flashtags are used to add a context to a
> message and only viewable by the sender.'),
>
> '#prefix' => '<div class="flashtags">',
>
> *'#value' => print $swf_tags,***
>
> '#suffix' => '</div>',
>
> '#weight' => 1,
>
> );
>
> }
>
> }
>
>
>
> Obviously I’m missing something in understanding how to make that work.
> It’s creating a field set on the form but no Flash object. Value is
> unlikely to be the right name. I’m not sure what this should be.
>
>
>
> Anyone got some clues for me on this?
>
>
>
> Yani
>
>
>
More information about the support
mailing list