Jump to content


random image selector


  • You cannot reply to this topic
5 replies to this topic

#1 darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 20 February 2007 - 05:13 PM

anyone have any idea who i can create a image viewer which can:
pick the URL for ONE randomly selected image from a MYSQL database,
then send this image into flash?

anyone got any ideas how to do this?

#2 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 20 February 2007 - 05:43 PM

PHP.
// Assuming your connection and such is already done here
$query = mysql_query("SELECT `image_url` FROM `images` ORDER BY RAND() LIMIT 1") or die(mysql_error());
$image = mysql_fetch_array($query);

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0">
	  <param name="movie" value="images.swf?img=<?php echo $image['image_url']; ?>">
	  <param name="quality" value="high">
	  <embed src="images.swf?img=<?php echo $image['image_url']; ?>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>
</object>

Then of course with Flash you can pull it like so.
image = level0.img;

And customize as needed.

#3 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 20 February 2007 - 06:17 PM

Dont you need _level0?

#4 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 20 February 2007 - 07:15 PM

Ya, I forgot about the underscore and didn't feel like opening up Flash to make sure. ;)

#5 darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 21 February 2007 - 10:56 AM

only problem with that is that the swf is being loaded into another movie so that code won't work.
anyone know how to do it through XML?

#6 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 21 February 2007 - 01:25 PM

Use your php to write an xml doc and have flash load it up, or have flash echo a string and use loadvars to grab it in flash.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users