Dynamic Flash Slide Show in WordPress

May 12, 2010 3:32 am Published by Leave your thoughts

This tutorial will go over how to create a dynamic Flash slide show in WordPress using Peak Studios Flash Php MySQL extension.

You can follow along on the video or simply follow the steps below.   You will see (sv:some time) at the start each section.  This lets you know where to cue the video tutorial to if you want to learn more about the function.

Set up your Flash file | (sv:0:25)

  • Create .fla and save as anything you want.
  • Add slideshow_mc to library.
    1. Export for AS and in 1st frame.
    2. Bassclass should be “slideshow”.
  • Set up publish settings
    1. AS3 settings > import Flash Php MySQL classes
    2. Set access to network only
  • Set document class to “slideshowtostage”

Set up slide show in WordPress | (sv:7:45)

  • Add custom field.
    1. Name it “home_pics”.
    2. Make a comma separated list of your images
  • Upload images to WordPress root in a folder named “home-slides”. Also have this folder next to your Flash file on your computer.
  • Create and upload the PHP create by the Flash PHP MySQL extension.

Create slideshowtostage.as | (sv:3:05)

import flash.display.MovieClip;

public class slideshowtostage extends MovieClip{

private var ss:MovieClip = new slideshow_mc();

public function slideshowtostage(){
//add your stuff to the stage.
ss.cacheAsBitmap = true;

Create slideshow.as | (sv:4:50)

import flash.display.MovieClip;
import flash.net.URLVariables;
import flash.utils.Timer;
import flash.events.*;
import fl.transitions.*;
import fl.transitions.easing.*;
//custom classes
import FP9.flash.com.ps.php.as3.*;
import MyLoader;

public class slideshow extends MovieClip{
private var DB_loc:String;
private var slideshow_select:SelectDB;
private var pics:Array;
private var slideshowPlaying:Boolean;
private var t:Timer;
public var pics_count:int;
public var pics_length:int;
public var showingChild:int;
public var displayArray:Array = new Array();

public function slideshow(){
//set your db loc
DB_loc = "";
//-------------Flash PHP MySQL-------------
private function slideshowselect():void{
var slideshow_table = "wp_postmeta";
//--Array should be the table row names you wish to pull from
var slideshow_tableRow:Array = new Array();
slideshow_tableRow[0] = "meta_value";
//where to look
var slideshow_where:Array = new Array();
slideshow_where[0] = "meta_key";
/*values can be = <> > < <= >= BETWEEN LIKE IN You can put TABLE (i.e =TABLE)after any of the operators to use a table field in the what array value*/
var slideshow_like:Array = new Array();
slideshow_like[0] = "=";
//What to look for
var slideshow_what:Array = new Array();
slideshow_what[0] = "home_pics";
//What to look for
var slideshow_functionStrings:Array = new Array();
slideshow_functionStrings[0] = "";
//orderBy and ASC arrays must have the same amount of items in the array.
//What to look for
var slideshow_orderBy:Array = new Array();
slideshow_orderBy[0] = "";
//What to look for
var slideshow_ASC:Array = new Array();
slideshow_ASC[0] = "";
slideshow_select = new SelectDB(slideshow_table, slideshow_tableRow, slideshow_where, slideshow_like, slideshow_what, slideshow_orderBy, slideshow_ASC, slideshow_returnFunction, slideshow_functionStrings, DB_loc);
private function slideshow_returnFunction(vars:URLVariables, selectRows:Array, functionStrings:Array):void{
pics = vars.meta_value0.split(",",20);
pics_length = pics.length;
if(pics_length > 0){

//-------------start loading images--------------
private function loadPics(n:int):void{
var mypic:String = pics[n];
var myl:MyLoader = new MyLoader("home-slides/"+mypic, picloaded);
myl.alpha = 0;
private function picloaded():void{
if (pics_count == 0){
Create MyLoader.as | (sv:12:55)

package {
import flash.display.Loader;
import flash.events.ProgressEvent;
import flash.events.Event;
import flash.net.URLRequest;
import flash.display.MovieClip;

public class MyLoader extends MovieClip {

private var ldr:Loader;
private var func:Function;

public function MyLoader(argFile:String, f:Function) {
func = f;
ldr = new Loader();
ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoadProgressEvent);
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
ldr.load(new URLRequest(argFile));

private function onLoadProgressEvent(e:ProgressEvent):void {
//var percent:int = Math.round((e.bytesLoaded / e.bytesTotal) * 100);
private function loaded(e:Event):void{
e.target.removeEventListener(ProgressEvent.PROGRESS, onLoadProgressEvent);
e.target.removeEventListener(Event.COMPLETE, loaded);


Categorised in:

This post was written by admin

Leave a Reply