Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


How to pull a caption from an array and place in a div?



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> JavaScript Forum
View previous topic :: View next topic  
Author Message
Fafnir



Joined: 27 Mar 2008
Posts: 1

PostPosted: Thu Mar 27, 2008 5:08 pm    Post subject: How to pull a caption from an array and place in a div? Reply with quote

Hey all,

I'm working on a site that plays a video when users select them from a list. The site loads with a video up, and there are two divs that hold links to more videos.

I'm using swfobject and the below code for video selection and playing:

Code:

function createplayer(theFile, go){
   var s = new SWFObject("fla/mediaplayer.swf","playerID","500","300","7");
   s.addParam("allowfullscreen","true");
   s.addVariable("file",theFile);
   s.addVariable("width","500");
   s.addVariable("height","300");
   s.addVariable("displayheight","300");
   s.addVariable("overstretch","fit");
   if (go) { s.addVariable("autostart","true"); }
   s.write("clip");
}//end createplayer


The code on the anchor link for a video looks like this:

Code:

<a href="javascript:createplayer('flv/01.flv', true)" title="Movie 1"><img src="images/pic1.jpg" alt="Movie Image 1" /></a>


Each link has a subsequent video, set as 02.flv, 03.flv, etc.

On click, the video loads into the "clip" div. Below that div, I have a "description" div. Here's where my knowledge of JavaScript stops (I'm still in school).

I have an array of descriptions I'd like to pull from:

Code:

var descArray = new Array(13);//change the number in Array(x) to match the number of the descriptions below (starting at zero).
descArray[0] = "This is a null description. It is unused.";
descArray[1] = "Movie One Description.";
descArray[2] = "Movie Two Description.";
descArray[3] = "Movie Three Description.";
descArray[4] = "Movie Four Description.";
descArray[5] = "Movie Five Description.";
descArray[6] = "Movie Six Description.";
descArray[7] = "Movie Seven Description.";
descArray[8] = "Movie Eight Description.";
descArray[9] = "Movie Nine Description.";
descArray[10] = "Movie Ten Description.";
descArray[11] = "Movie Eleven Description.";
descArray[12] = "Movie Twelve Description.";


My question is.. how do I write a script that will load the particular description of a video into the "description" div when the user clicks to load the video?

Is it possible to do this on the anchor link instead of writing a function? The reason I'd like to do it this way is that the client requires that edits to the site be made through the design view in Dreamweaver.. I'm trying to keep it as simple as possible for whomever takes over to add descriptions and movies without having to mess with much code (other than copying and pasting).

I'd really appreciate any help on the matter. Thanks in advance!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> JavaScript Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap