Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How rotate testimonials in a flash movieclip

Posted on 2008-06-13
11
826 Views
Last Modified: 2009-08-31
I want to basically add to an existing flash movie a small area that will rotate testimonials - if possible from a text file - as a small movie clip.  Any suggestions of where I could find one already done suggest the simplest way to do one that can be updated via text file?  Any help would be great.
0
Comment
Question by:brian2k1
11 Comments
 
LVL 43

Accepted Solution

by:
Rob earned 500 total points
ID: 21787971
http://www.flashkit.com/tutorials/Special_Effects/Continuo-Kirupa_C-649/index.php showing how you can do this with images.  if you substitute a movieclip with an embedded textfield then you can achieve the same effect
0
 
LVL 1

Author Comment

by:brian2k1
ID: 21788574
0
 
LVL 1

Author Comment

by:brian2k1
ID: 21788577
Also

Introduction to XML in Flash - http://www.kirupa.com/web/xml/index.htm
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:brian2k1
ID: 21788840
kinda answered my own question I guess.

Flash File Setup:
- create a new flash file "testimonials.fla"
- add one or more (two in this case) DynamicText area's with the names "dt_TestimonialArea" & "dt_TestimonialArea2"
- add the following actionscript code to Layer 1:Frame 1 in the actionscript panel
- create a text file (then change extension to xml) named "Testimonials.xml" and add the following text

<?xml version="1.0"?>
<testimonials>
      <testimonial>
            <fullname>Jane Doe</fullname>
            <citystate>Beverly Hills, Ca</citystate>
            <testimonial>Love it!</testimonial>
            <date>02-03-2006</date>      
      </testimonial>
      <testimonial>
            <fullname>John Doe</fullname>
            <citystate>Chicago, Il</citystate>
            <testimonial>Love it more!</testimonial>      
            <date>05-03-2007</date>
      </testimonial>
</testimonials>

I tried to use the Photo slideshow tutorial from Kirupa but it caused a serious memory leak because the interval function was not being cleared properly. So I reviewed the Adobe Help text on the setInterval function and using part of their example made the following code which works great and doesn't have a memory leak. I'm leaving this here for anyone else that needs the info.
///////////////////////////// VARIABLE DECLARATIONS
var intervalID:Number;
var intervalDuration:Number = 1500; //1500=1.5seconds initialize starting duration setting
var nodeID:Number = 0; //initialize starting testimonial id
var nodeMaxID:Number = 0;
var intervalCount:Number = 0; //just for debug/tracing
 
var xmlData:XML = new XML(); //setup new XML object in ActionScript
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("testimonials.xml");
 
function loadXML(loaded)
{
	if (loaded)
	{
		xmlNode = this.firstChild;
		fullname = [];
		citystate = [];
		testimonial = [];
		date = [];
		nodeMaxID = xmlNode.childNodes.length;
		
		for (i=0; i<nodeMaxID; i++)
		{
			fullname[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
			citystate[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
			testimonial[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
			date[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
		}		
 
		setTestimonialArea(0);
		beginInterval();
	} else {
		content = "file not loaded!";
	}
}
 
function setTestimonialArea(nodeID)
{
	dt_TestimonialArea.text = fullname[nodeID] + '\n' + citystate[nodeID] + '\n' + date[nodeID] + '\n' + testimonial[nodeID];	
 
	//ALL the text can go into one text area as above, I split it up just to illustrate 
	dt_TestimonialArea2.text = date[nodeID] + '\n' + testimonial[nodeID];
}
 
function getNextTestimonial()
{	
	trace("executeCallback intervalID: " + intervalID + " nodeID: " + nodeID + " intervalCount: " + intervalCount);
	if (nodeID>=(nodeMaxID-1))
	{
		nodeID=0;
	} else {
		nodeID++;
	}	
	setTestimonialArea(nodeID);
	intervalCount++;
}
	
function beginInterval():Void {
 if(intervalID != null)
 {
 	trace("clearInterval");
	clearInterval(intervalID);
 }
 intervalID = setInterval(this, "getNextTestimonial", intervalDuration);
}

Open in new window

0
 
LVL 12

Expert Comment

by:SamuelRostol
ID: 21791314
Great work, and nice code :)
0
 

Expert Comment

by:RNGeer
ID: 21915586
Hey Guys, I am trying to replicate this for a site and cannot get the xml data to display. Are there any steps in the above info that may be missing. I have added the dynamic text box and actionscript from the code box. Any info at all would be great, I only do flash about 10% of the time.
0
 
LVL 1

Author Comment

by:brian2k1
ID: 21916232
Did you name the dynamic text "dt_TestimonialArea"?

what is the output from the trace/debug window?
0
 

Expert Comment

by:RNGeer
ID: 21916333
It is named correctly. Here is the error. I am sure I am jsut failing to set the ActionScript up correctly.

Scene 1, Layer 'Layer 1', Frame
1046: Type was not found or was not a compile-time constant: Void.
function beginInterval():Void {
0
 
LVL 1

Author Comment

by:brian2k1
ID: 21916357
zip up the entire thing and upload it. that error isn't very useful.
0
 

Expert Comment

by:RNGeer
ID: 21916390
I thought not.

 I zipped it up but the Exchange won't let it through.
0
 
LVL 1

Author Comment

by:brian2k1
ID: 21916555
RNGeer please start another quest thread and take some screen shots of the various code pages, upload as JPG's. once you get the question started post a link as a comment here and I'll try to follow up. I'm sure it is just simple thing as the code I posted was copy/pasted out of file.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Flash movie or gif/animation? 3 911
Embedded Webpage Videos don't auto play on Windows 7 1 116
embedding a media live encoder stream 3 148
Flash ActionScript 6 57
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question