magicButton : A Flash Button That Launches popup windows

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
Ibis Fernandez
Posts: 67
Joined: Tue 22. Jun 2004, 19:54
Contact:

magicButton : A Flash Button That Launches popup windows

Post by Ibis Fernandez »

Here is A Mod that places a dynamic Flash button in your articles which can lauch any external content within a popup window.

I will call this version 1. Im open to suggestion. i will not bother with stuff like skins and uch although I if anyone else wishes to expand it I will be glad to post the source as well.

Overview:
User a replacement tag to insert the button. The replacement tag follows the syntax:

{BUTTON:Label,URL,WIDTHxHEIGHT}

Label is the Text that will appear on the button.
URL
is the address to the content that will appear in the window.
Width is the width of the window
Height is the height of the window.

Online Sample:
http://www.flashfilmmaker.com/index.php ... 03,0,0,1,0


Installation:
1. Download the file
2. Upload the swf file to /include/magicButton.swf
3. Add the replacement tag entry in /include/inc_front/front.func.inc.php

The replacement tag entry is as follows:
// Adds the magicButtom Version 1.0 Replacement Tag
$search[XX] = '/\{BUTTON:(.*),(.*?),(.*?)x(.*?)\}/';
$replace[XX] = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shoc ... n=6,0,29,0" width="100" height="22"><param name="movie" value="/include/magicButton.swf?label=$1&url=$2&winWidth=$3&winHeight=$4"><param name="quality" value="high"><embed src="/include/magicButton.swf?label=$1&url=$2&winWidth=$3&winHeight=$4" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100" height="22"></embed></object>';

CHANGE the red XX to what ever number is next in your sequence.

Thats pretty much it, enjoy :D
Be sure to check out my PHPFlash Player Module, work great with this button :D
Ibis Fernandez
Cinestar Filmworks
http://flashfilmmaker.com
http://cinestarfilmworks.com
Author of Macromedia Flash Animation and Cartooning: A Creative Guide
leone
Posts: 21
Joined: Tue 19. Oct 2004, 11:30
Location: Switzerland

Post by leone »

Hi Ibis,

due to the fact that my current phpwcms is not in the root I had to change the code to the following:

Code: Select all

// Adds the magicButtom Version 1.0 Replacement Tag 
$search[xx] = '/\{BUTTON:(.*),(.*?),(.*?)x(.*?)\}/'; 
$replace[xx] = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='100' height='22'><param name='movie' value='/" . $GLOBALS['phpwcms']['root'] . "img/magicButton.swf?label=$1&url=$2&winWidth=$3&winHeight=$4'><param name='quality' value='high'><embed src='/" . $GLOBALS['phpwcms']['root'] . "img/magicButton.swf?label=$1&url=$2&winWidth=$3&winHeight=$4' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='100' height='22'></embed></object>"; 
I included the global variable to the root and put the magicButton.swf in the /img directory.

In any case thanks you very much for providing this solution for playing flash videos without having to loop them.

leone
Ibis Fernandez
Posts: 67
Joined: Tue 22. Jun 2004, 19:54
Contact:

Post by Ibis Fernandez »

Yes, definately make sure the paths you use reflect your own set-up :P

By the way I finished the new version of the player. This is a non-PHP version, It works in conjunction with this magicButton mod. (it doesn't have to, you can embbed the player in the pages too if you like, but I preffer the videos to play in a separate pop-up.)

You can see it in action here:

http://flashfilmmaker.com/index.php?quickstart_jbh

The first two videos have content in them, the second two don't (at leat not during the time of this posting).

The player will basically load the content, go through a preloading stage, and it also has a small set of uninstrusive controls on the lower right hand side... :D... I basically set up these controls from scratch so Im particularly proud of the rewind and fast forward feature. :P
Ibis Fernandez
Cinestar Filmworks
http://flashfilmmaker.com
http://cinestarfilmworks.com
Author of Macromedia Flash Animation and Cartooning: A Creative Guide
leone
Posts: 21
Joined: Tue 19. Oct 2004, 11:30
Location: Switzerland

Post by leone »

Wow, I finally got where I wanted to be from the beginning. I just wanted play controls to follow the mark on the admin interface, just like for Quicktime or WMP. :D

So I did some modifications on include\inc_front\content\cnt9.article.inc.php. For this to work you need:

1. flash.swf (from Ibis Fernandez) -> renamed to FlashCont.swf in the img directory.
2. The amended include\inc_front\content\cnt9.article.inc.php and then you have full control over your flash movies, i.e. if you want to provide control buttons then you mark the button in the menu.
The section on the Flash Media has to be replaced with the following code:

Code: Select all

	case 3:	//Flash Player/Plugin
													if($media["media_control"] == "true") $media_controller="/" . $GLOBALS['phpwcms']['root'] . "img/FlashCont.swf?movie=";
													$media["width"]  = ($media["media_width"]) ? "width=\"".$media["media_width"]."\" " : "";
													$media["height"] = ($media["media_height"]) ? "height=\"".$media["media_height"]."\" " : "";
													$media["code"]	= "<OBJECT CLASSID=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ";
													$media["code"] .= $media["width"].$media["height"]." border=\"0\" id=\"".$randomID."\" ";
													$media["code"] .= "CODEBASE=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\">\n";
													$media["code"] .= "<PARAM name=\"movie\" VALUE=\"". $media_controller . $media["source"]."\">\n";
													$media["code"] .= "<PARAM name=\"quality\" VALUE=\"high\">\n";
													$media["code"] .= "<PARAM name=\"SCALE\" VALUE=\"noborder\">\n";
													$media["code"] .= "<PARAM name=\"LOOP\" VALUE=\"true\">\n";
													$media["code"] .= "<PARAM name=\"PLAY\" VALUE=\"".$media["media_auto"]."\">\n";
													$media["code"] .= "<EMBED SRC=\"". $media_controller . $media["source"]."\" BORDER=\"0\" ";
													$media["code"] .= $media["width"].$media["height"]." id=\"".$randomID."\" ";
													$media["code"] .= "TYPE=\"application/x-shockwave-flash\" play=\"".$media["media_auto"]."\" ";
													$media["code"] .= "quality=\"high\" scale=\"noborder\" pluginspace=\"http://www.macromedia.com/go/getflashplayer/\"></EMBED>\n";
													$media["code"] .= "</OBJECT>\n";
													break;
Sorry due to high indentation the code looks a bit ugly. Anyway you can cut and paste it into the section beginning with case 3.

As you can see I just added line 1 to check if the controller option has been marked, if yes the variable $media_controller is created with the path and parameter call for img/FlashCont.swf. This string then gets added to the actual media string at $media["code"] = .... and at embed src ...

The only thing I don't know yet is, if Ibis actually has released the flash.swf to the public or not, I actually just downloaded it from the location I found in the example :oops: source and my page is not public yet so it is not a problem. In any case I would be glad if you could fill us in.

I have found no problem running flash movies like this, except that on linux Mozilla the movie runs in slow motion when using the FlashCont.swf to run the movie. Turning controls off lets the movie run at normal speed.

I have not been able to test it on Windows Mozilla or other browsers besides IE6 and linux Mozilla.

Leone
Ibis Fernandez
Posts: 67
Joined: Tue 22. Jun 2004, 19:54
Contact:

Post by Ibis Fernandez »

Im fine with this although i would prefer the name of the file to remain a generically "flash.swf" cause I have bigger plans for it... It will make it easier for people to update it in future releases by simply overriding that file or any file that will point to it... also I will be doing another one that is specifically just the controller rather than a loader type of file.

When I get a chance I will post it in a zip file if anyone else wants it. not sure if I'll have the time for it this weeks though so if you just want to put it in a zip file somewhere and post a link to it here. I would be fine with that as well.

post a demo, I'd love to see how you are using it :)
Ibis Fernandez
Cinestar Filmworks
http://flashfilmmaker.com
http://cinestarfilmworks.com
Author of Macromedia Flash Animation and Cartooning: A Creative Guide
Ibis Fernandez
Posts: 67
Joined: Tue 22. Jun 2004, 19:54
Contact:

Post by Ibis Fernandez »

so I take it this new addition makes it work with the flash content type? cool!
Ibis Fernandez
Cinestar Filmworks
http://flashfilmmaker.com
http://cinestarfilmworks.com
Author of Macromedia Flash Animation and Cartooning: A Creative Guide
leone
Posts: 21
Joined: Tue 19. Oct 2004, 11:30
Location: Switzerland

Post by leone »

Hi Ibis,
thanks. Concerning the renaming I have renamed it to flash.swf.

In any casee I do seem to have a speed issue yet, i.e. does flash.swf actually dictate the frame rate or something, I just noticed that my videos do run faster when called with the controller flash.swf. I have used various frame rates in my videos between 10 and 15 fps. As mentioned above on a linux Mozilla they run slower than required and on IE6 faster. I have no explanation for that.

Do I have to adhere to a specific frame rate by using flash.swf?

Concerning size, I have noticed that videos that are below 640x480 are resized to a smaller size, is this by design?

Unfortunately I cannot post a link right now as I am on an intranet, but will get one up tomorrow so at least one of the pages containing a video can be viewed.

The changed code:

Code: Select all

					case 3:	//Flash Player/Plugin
													if($media["media_control"] == "true") $media_controller="/" . $GLOBALS['phpwcms']['root'] . "img/flash.swf?movie=";
													$media["width"]  = ($media["media_width"]) ? "width=\"".$media["media_width"]."\" " : "";
													$media["height"] = ($media["media_height"]) ? "height=\"".$media["media_height"]."\" " : "";
													$media["code"]	= "<OBJECT CLASSID=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ";
													$media["code"] .= $media["width"].$media["height"]." border=\"0\" id=\"".$randomID."\" ";
													$media["code"] .= "CODEBASE=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\">\n";
													$media["code"] .= "<PARAM name=\"movie\" VALUE=\"". $media_controller . $media["source"]."\">\n";
													$media["code"] .= "<PARAM name=\"quality\" VALUE=\"high\">\n";
													$media["code"] .= "<PARAM name=\"SCALE\" VALUE=\"noborder\">\n";
													$media["code"] .= "<PARAM name=\"LOOP\" VALUE=\"true\">\n";
													$media["code"] .= "<PARAM name=\"PLAY\" VALUE=\"".$media["media_auto"]."\">\n";
													$media["code"] .= "<EMBED SRC=\"". $media_controller . $media["source"]."\" BORDER=\"0\" ";
													$media["code"] .= $media["width"].$media["height"]." id=\"".$randomID."\" ";
													$media["code"] .= "TYPE=\"application/x-shockwave-flash\" play=\"".$media["media_auto"]."\" ";
													$media["code"] .= "quality=\"high\" scale=\"noborder\" pluginspace=\"http://www.macromedia.com/go/getflashplayer/\"></EMBED>\n";
													$media["code"] .= "</OBJECT>\n";
													break;
Leone
Ibis Fernandez
Posts: 67
Joined: Tue 22. Jun 2004, 19:54
Contact:

Post by Ibis Fernandez »

Hmmm yes it might. Since a file bieng loaded into a flash file, any file that is loaded will play at the frame rate set by the parent flash file, which in this case is the loader....

The only way to ensure the loaded file plays at it's propper framerate, is if the loaded file contain streaming sound. Flash is pretty wacky. My primary use for this is to load camtasia videos so for this purpose it works fine for me.

The camtasia files i use run at 5 frames per second and they play perfect everytime. (Must be due to the streaming audio layer.)

Anyways, I'll go ahead start working on that second flash file I soke to you about.

There is a couple of ways way for one flash file to communicate with another on the same page. So what Im going to do is make just the controller file. This file will be placed right below the main file... so rather that loading it into anew flash file.... the controller would simply send intructions to the main Flash file... I'm sure this should fix the FPS issue.
Ibis Fernandez
Cinestar Filmworks
http://flashfilmmaker.com
http://cinestarfilmworks.com
Author of Macromedia Flash Animation and Cartooning: A Creative Guide
leone
Posts: 21
Joined: Tue 19. Oct 2004, 11:30
Location: Switzerland

Post by leone »

You are right. Since my videos are without sound there is no sync from the sound. I have established that the right framerate is 20 fps, i.e. one has to encode the videos at 20 fps for them to have the correct speed.

Leone
doorwish
Posts: 18
Joined: Wed 1. Dec 2004, 13:08

Re: magicButton : A Flash Button That Launches popup windows

Post by doorwish »

Hi Ibis,

i would like to use this contribution. but i am a rookie and can´t really figure out what you mean with
Ibis Fernandez wrote: CHANGE the red XX to what ever number is next in your sequence.
can you please help me out here!? :roll:

thanx alot!
:wink:
ITs ALL Good !
Ibis Fernandez
Posts: 67
Joined: Tue 22. Jun 2004, 19:54
Contact:

Post by Ibis Fernandez »

It means that there will be a sequence in the number of entries.

23
24
25
26
etc...

if the last entry is 26 then you will use 27 as this entries number.
Ibis Fernandez
Cinestar Filmworks
http://flashfilmmaker.com
http://cinestarfilmworks.com
Author of Macromedia Flash Animation and Cartooning: A Creative Guide
doorwish
Posts: 18
Joined: Wed 1. Dec 2004, 13:08

Post by doorwish »

Ibis Fernandez wrote:It means that there will be a sequence in the number of entries.
if the last entry is 26 then you will use 27 as this entries number.
thanx a lot for the quick reply Ibis :wink: ...

...where can i find the last entry number ???? :roll:
...and what is the entry number ???? :shock:

sorry, if the questions sound a bit weird to you but i am new to this and would like to learn... :D
ITs ALL Good !
Ibis Fernandez
Posts: 67
Joined: Tue 22. Jun 2004, 19:54
Contact:

Post by Ibis Fernandez »

go back to the original post and read step 3. Thats where you will find it.
Ibis Fernandez
Cinestar Filmworks
http://flashfilmmaker.com
http://cinestarfilmworks.com
Author of Macromedia Flash Animation and Cartooning: A Creative Guide
Post Reply