is this right to make link into swf movie using ming

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

is this right to make link into swf movie using ming

Post by ddragas »

is this right to make link into swf banner using ming

Code: Select all

$strAction="getURL('here should be link', '_self','SWFBUTTON_MOUSEUP');";
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post by foobar »

Can you explain more thoroughly what you want to achieve? It's a bit difficult to understand what you're aiming at. :wink:
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Post by ddragas »

Sorry U'right

I've got script that makes swf movie from images from folder, and I'm using it to make banner in swf.

Here is code

Code: Select all

// jpg slideshow 2.0 : grab jpgs from specified directories and create a swf slideshow...
// code by gazb : gazb dot ming at NOSPAM gmail dot com
// http://www16.brinkster.com/gazb/ming/
// October 2003 version 1
// December 2003 version 2
// just put the directories with the jpgs here and compile
$pathtojpgs= array();
$pathtojpgs[0]= "../uploadedfiles/banner/" . $Sifra_apartmana . "/";

// some typical movie variables
Ming_setScale(20.00000000);
ming_useswfversion(6);

$movie=new SWFMovie();
$movie->setBackground(255,255,255);
$movie->setRate(40); 
$movie->setDimension($w,$h);

// easing functions based on those at robertpenner.com
function easeInQuad ($t, $b, $c, $d) {
$t/=$d;
	return $c*$t*$t + $b;
};
function easeOutQuad ($t, $b, $c, $d) {
$t/=$d;
	return -$c *($t)*($t-2) + $b;
};

// HERE SHOULD CAME LINK THAT IS INSERTED ON EVERY FRAME

//$strAction="getURL('http://www.croatia-tourist.biz/stranice/pregled_smjestaja.php?smjestaj=" . $Sifra_apartmana . "', '_self','SWFBUTTON_MOUSEUP');";  

//

$movie->add(new SWFAction($strAction));

// grab the jpgs
$f = array();
for($i=0;$i<count($pathtojpgs);$i++){
	$f[$i] = array();
	if ($handle = opendir($pathtojpgs[$i])) {
		while (false !== ($file = readdir($handle))) { 
			$tmp = explode(".",$file);
			if($tmp[1]=="jpg"){
				array_push ($f[$i],$pathtojpgs[$i] . $file);
			}
			if($tmp[1]=="jpeg"){
				array_push ($f[$i],$pathtojpgs[$i] . $file);
			}

		}
	}
}
closedir($handle);




///////////////slideshow patch start//////////////////////////////
// sort the jpgs into 'natural' order using natsort		//
// (eg 1.jpg,a.jpg,b1.jpg,b2.jpg,b10.jpg,b12.jpg,b100.jpg)	//
// see http://www.php.net Array docs for alts to natsort		//
for($i=0;$i<count($f);$i++){					//
// echo "original order\n";					//
// print_r($f[0]);						//
								//
natsort($f[$i]); 	// sort that array			//
$tmp=implode(",",$f[$i]); // ugly...				//
$f[$i]=explode(",",$tmp); // but it works			//
								//
// echo "new order\n";						//
// print_r($f[0]);						//
}								//
///////////////slideshow patch end////////////////////////////////



// add the jpgs to the movie with basic fade in/out
$movie->nextFrame();
for($i=0;$i<count($f);$i++){
	for($k=0;$k<count($f[$i]);$k++){
		$img = new SWFBitmap(fopen($f[$i][$k],"rb"));
		$pic=$movie->add($img); 

		$sirina=$img->getwidth($img);
		$visina=$img->getheight($img);
		
		$pozicija_w = (($w - $sirina)/2);
		$pozicija_h = (($h - $visina)/2);
		
		$pic->moveTo( ($pozicija_w),($pozicija_h));

		$transition=25;
$cnt=1; $startpos=0; $offset=1; $duration=$transition;
while($cnt<=$duration){
$inc=easeInQuad ($cnt++, $startpos, $offset, $duration);
			$pic->multColor(1,1,1,$inc);
			$movie->nextFrame();
		}
		for($j=1;$j<=$transition*2;$j++){
			$movie->nextFrame();
		}
$cnt=1; $startpos=1; $offset=-1; $duration=$transition;
while($cnt<=$duration){
$inc=easeOutQuad ($cnt++, $startpos, $offset, $duration);
			$pic->multColor(1,1,1,$inc);
			$movie->nextFrame();
		}
		$movie->remove($pic);
	}
}
$movie->nextFrame();

$film=$Photo_Dir . $userID . $Sifra_apartmana . ".swf";

if($movie->save($film,9))
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

I still don't understand your question / problem...
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post by foobar »

Burrito wrote:I still don't understand your question / problem...
Neither do I. Was hoping someone else would understand... :/
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Post by ddragas »

What I need is to insert link into every frame of movie and don't know how to do it
User avatar
wtf
Forum Contributor
Posts: 331
Joined: Thu Nov 03, 2005 5:27 pm

Post by wtf »

I think he's working on some sort of Flash slideshow, using Ming to read directory and create dynamic slide show. From what I understand, each slide should be clickable and point to some url.??
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

If that's the case why not script your flash movie to the movie can reach and grab the images it needs? You can pass variables from PHP to flash through the GET string on the URL
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Post by ddragas »

Sorry for my bad explanation. That is want I wanna achieve
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Post by ddragas »

I'm using this script to make flash movie on the fly from images that user has uploaded on server. Script is working fine, and only thing I have to more is to insert link on every frame of movie. That way when user click on flash move he would be edirected to link from movie.

do not know how to implement getURL( into frames
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

This can be done without generating the flash movie on the fly because of flash's ability to load key-value pairs or xml from any file (including a PHP script) over the net. It also has the ability to load images into movieclips.
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Post by ddragas »

So what do you suggest me?

Point me in right direction
User avatar
wtf
Forum Contributor
Posts: 331
Joined: Thu Nov 03, 2005 5:27 pm

Post by wtf »

I've never used Ming, so I'm not sure what it can/can't do. I'd probably go the easy way. Use PHP to read directory and output it as xml. Make Flash file to parse xml and load contest based on what's in xml.

duh... just read jshpro2 post


http://www.maani.us/slideshow/index.php?menu=Download
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

Your link was dead so I don't know if you got it:
http://www.macromedia.com/support/flash ... ry537.html

that loads a movie, you can pass an array of imageIDs it needs to load by requesting it as

movie.swf?array=123,345,678


the comma separated list needs to be urlencoded().


In flash you just do _root.array=_root.array.split(','); (I think)? To get an array, then you loop through loading the images based on their imageID's
Post Reply