Page 1 of 1
is this right to make link into swf movie using ming
Posted: Tue Jan 31, 2006 1:48 pm
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');";
Posted: Tue Jan 31, 2006 1:53 pm
by foobar
Can you explain more thoroughly what you want to achieve? It's a bit difficult to understand what you're aiming at.

Posted: Tue Jan 31, 2006 2:04 pm
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))
Posted: Tue Jan 31, 2006 2:25 pm
by Burrito
I still don't understand your question / problem...
Posted: Tue Jan 31, 2006 2:29 pm
by foobar
Burrito wrote:I still don't understand your question / problem...
Neither do I. Was hoping someone else would understand... :/
Posted: Tue Jan 31, 2006 2:31 pm
by ddragas
What I need is to insert link into every frame of movie and don't know how to do it
Posted: Tue Jan 31, 2006 2:43 pm
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.??
Posted: Tue Jan 31, 2006 2:45 pm
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
Posted: Tue Jan 31, 2006 2:45 pm
by ddragas
Sorry for my bad explanation. That is want I wanna achieve
Posted: Tue Jan 31, 2006 2:54 pm
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
Posted: Tue Jan 31, 2006 3:05 pm
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.
Posted: Tue Jan 31, 2006 3:17 pm
by ddragas
So what do you suggest me?
Point me in right direction
Posted: Tue Jan 31, 2006 3:30 pm
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
Posted: Tue Jan 31, 2006 3:40 pm
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