Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Additional params for uploaded flash


Reply


23 Posts   4640 Views

Avatar
AlaVive

Community Member, 42 Posts

3 December 2009 at 9:23am

Thank you, Banal!

Avatar
Taffy

Community Member, 119 Posts

4 December 2009 at 10:54pm

Banal has put this recipe/tutorial on http://ssbits.com/embed-flash-content-using-swfobject/

Nice one!

Avatar
JuLo

Community Member, 37 Posts

17 December 2009 at 12:16pm

Great idea, as I have been battling with the relative paths to my swfs for hours to no avail.

However, in your example Requirements::javascript('mysite/javascript/lib/swfobject.js'); does not seem to have any effect and swfobjects does not see to get included. (can't see "<script type="text/javascript" src="mysite/javascript/swfobject_new.js"></script>" anywhere)

Any ideas why?

Are you sure the code is working as is for you?

Thanks,

JuLo

Avatar
banal

Community Member, 901 Posts

17 December 2009 at 8:18pm

Hi

Yes, the code is definitely working.
Why would it include swfobject_new.js, when you're telling it to load swfobject.js. Just a typo I guess.

Make sure you put the files in the correct folders, and maybe check using Firebugs "Net" Tab that the file loads. You don't have to use Requirements::javascript, you could put <script type="text/javascript" src="mysite/javascript/lib/swfobject.js"></script> in your template code just as well.

Avatar
JuLo

Community Member, 37 Posts

18 December 2009 at 8:30pm

Sorry. That was a copy paste mistake.

I had another page using the old swfobject so renamed the new version to swfobject_new.js.

On the other hand, it does work when I manually add the code in FlashPage.ss.

Go figure.

Thanks.

Nevermind.

Avatar
Samba Sam

Community Member, 85 Posts

28 April 2010 at 4:13pm

Edited: 30/04/2010 2:03pm

Hi,
Following Banal's example, I would like to play a swf file with an external flv (i.e., a swf file that will load the video from an external FLV file at runtime and will not embed anything in the swf file itself?. The question is what is the code I would use in my FlashPage.php to load both the swf and flv file through the CMS? The swfobject code in the template ss is the same as Banal's except I changed the variable name from FlashFile to swfFile.

I tried the following in my FlashPage.php, but it didn't work.

public static $has_one = array(
      'swfFile'   => 'File',
      'flvFile'   => 'File'
   );
public function getCMSFields(){
      $fields = parent::getCMSFields();
      $swfUpload = new FileIFrameField('swfFile', 'Flash file (swf)');
      $flvUpload = new FileIFrameField('flvFile', 'Flash file (flv)');
      $fields->addFieldToTab("Root.Content.Flash", new FieldGroup(
            new NumericField("Width", "Width"),
            new NumericField("Height", "Height"),
            new TextField("TopMargin", "Top Margin"),
            new TextField("LeftMargin", "Left Margin")
         ));
      $fields->addFieldsToTab('Root.Content.Flash', array(
         $swfUpload,$flvUpload,
         new HtmlEditorField('AlternateContent', 'Flash replacement text', 20)
      ));
      return $fields;
   }


Any ideas,
Sam

Avatar
Samba Sam

Community Member, 85 Posts

30 April 2010 at 2:00pm

Edited: 30/04/2010 3:50pm

Ah, figured it out. There was no swfobject.js file link in my template. Works fine now.
Sam

Avatar
studio6

Community Member, 14 Posts

20 July 2010 at 1:51am

hay sam i would love some more info on how you play a swf file with an external flv how did you use that code (eg. did you add that code or was that all you needed)