Solved

How to add hypertext link attribute to an existing flash component using xml?

Posted on 2008-06-13
3
646 Views
Last Modified: 2012-06-27
I recently purchased a Flash Component and wanted to add hypertext link attribute. I have requested this information from the component author, but have not been able to obtain a response. I have limited knowledge in this area and when I purchased the component I was assured that the author would help me. The component is a flash video gallery. I have attached the xml code and the action script code. Any information on how I can accomplish this would be greatly appreciated.

Thanks in advance!
xml code:
 
<!-- 
  - contains information about video files 
  - each video item has the id, title, preview and description attributes
  - the id is the same for both xml and html layout file  
-->
 
<?xml version="1.0" encoding="utf-8?>
<videos>
	<video id="v1" title="Bourne Ultimatum" preview="videos/bourneultimatum.flv" description="Bourne is once again brought out of hiding, this time inadvertently by London-based reporter Simon Ross who is trying to unveil Operation Blackbriar--an upgrade to Project Treadstone--in a series of newspaper columns. Bourne sets up a meeting with Ross and realizes instantly they're being scanned. Information from the reporter stirs a new set of memories, and Bourne must finally, ultimately, uncover his dark past whilst dodging The Company's best efforts in trying to eradicate him. After being recovered from the sea, and after losing the one he loves, Jason Bourne is one more step closer to finding out how David Webb became Jason Bourne. Whilst Pamela Landy has decided to leave Bourne alone, CIA Deputy Director Noah Vosen has other plans. He believes that Bourne is still dangerous and must be eliminated, before he finds out his true identity and takes the CIA down with him." />
	<video id="v2" title="Die Hard" preview="videos/livefreeordiehard.flv" description="When someone hacks into the computers at the FBI's Cyber Crime Division; the Director decides to round up all the hackers who could have done this. When he's told that because it's the 4th of July most of their agents are not around so they might have trouble getting people to get the hackers. So he instructs them to get local PD'S to take care of it. And one of the cops they ask is John McClane who is tasked with bringing a hacker named Farrell to the FBI. But as soon as he gets there someone starts shooting at them. McClane manages to get them out but they're still being pursued. And it's just when McClane arrives in Washington that the whole system breaks down and chaos ensues." />	
	<video id="v3" title="Ratatouille" preview="videos/ratatouille.flv" description="A rat named Remy dreams of becoming a great French chef despite his family's wishes and the obvious problem of being a rat in a decidedly rodent-phobic profession. When fate places Remy in the sewers of Paris, he finds himself ideally situated beneath a restaurant made famous by his culinary hero, Auguste Gusteau. Despite the apparent dangers of being an unlikely - and certainly unwanted - visitor in the kitchen of a fine French restaurant, Remy's passion for cooking soon sets into motion a hilarious and exciting rat race that turns the culinary world of Paris upside down." />	
   <video id="v4" title="Spiderman" preview="videos/spiderman.flv" description="Peter Parker has finally managed to piece together the once-broken parts of his life, maintaining a balance between his relationship with Mary-Jane and his responsibility as Spider-Man. But more challenges arise for our young hero. Peter's old friend Harry Obsourne has set out for revenge against Peter; taking up the mantle of his late father's persona as The New Goblin, and Peter must also capture Uncle Ben's real killer, Flint Marko, who has been transformed into his toughest foe yet, the Sandman. All hope seems lost when suddenly Peter's suit turns jet-black and greatly amplifies his powers. But it also begins to greatly amplify the much darker qualities of Peter's personality that he begins to lose himself to. Peter has to reach deep inside himself to free the compassionate hero he used to be if he is to ever conquer the darkness within and face not only his greatest enemies, but also...himself." />	
   	<video id="v5" title="Bourne Ultimatum" preview="videos/bourneultimatum.flv" description="Bourne is once again brought out of hiding, this time inadvertently by London-based reporter Simon Ross who is trying to unveil Operation Blackbriar--an upgrade to Project Treadstone--in a series of newspaper columns. Bourne sets up a meeting with Ross and realizes instantly they're being scanned. Information from the reporter stirs a new set of memories, and Bourne must finally, ultimately, uncover his dark past whilst dodging The Company's best efforts in trying to eradicate him. After being recovered from the sea, and after losing the one he loves, Jason Bourne is one more step closer to finding out how David Webb became Jason Bourne. Whilst Pamela Landy has decided to leave Bourne alone, CIA Deputy Director Noah Vosen has other plans. He believes that Bourne is still dangerous and must be eliminated, before he finds out his true identity and takes the CIA down with him." />
	<video id="v6" title="Die Hard" preview="videos/livefreeordiehard.flv" description="When someone hacks into the computers at the FBI's Cyber Crime Division; the Director decides to round up all the hackers who could have done this. When he's told that because it's the 4th of July most of their agents are not around so they might have trouble getting people to get the hackers. So he instructs them to get local PD'S to take care of it. And one of the cops they ask is John McClane who is tasked with bringing a hacker named Farrell to the FBI. But as soon as he gets there someone starts shooting at them. McClane manages to get them out but they're still being pursued. And it's just when McClane arrives in Washington that the whole system breaks down and chaos ensues." />	
  <video id="v7" title="Bourne Ultimatum" preview="videos/bourneultimatum.flv" description="Bourne is once again brought out of hiding, this time inadvertently by London-based reporter Simon Ross who is trying to unveil Operation Blackbriar--an upgrade to Project Treadstone--in a series of newspaper columns. Bourne sets up a meeting with Ross and realizes instantly they're being scanned. Information from the reporter stirs a new set of memories, and Bourne must finally, ultimately, uncover his dark past whilst dodging The Company's best efforts in trying to eradicate him. After being recovered from the sea, and after losing the one he loves, Jason Bourne is one more step closer to finding out how David Webb became Jason Bourne. Whilst Pamela Landy has decided to leave Bourne alone, CIA Deputy Director Noah Vosen has other plans. He believes that Bourne is still dangerous and must be eliminated, before he finds out his true identity and takes the CIA down with him." />
  <video id="v8" title="Spiderman" preview="videos/spiderman.flv" description="Peter Parker has finally managed to piece together the once-broken parts of his life, maintaining a balance between his relationship with Mary-Jane and his responsibility as Spider-Man. But more challenges arise for our young hero. Peter's old friend Harry Obsourne has set out for revenge against Peter; taking up the mantle of his late father's persona as The New Goblin, and Peter must also capture Uncle Ben's real killer, Flint Marko, who has been transformed into his toughest foe yet, the Sandman. All hope seems lost when suddenly Peter's suit turns jet-black and greatly amplifies his powers. But it also begins to greatly amplify the much darker qualities of Peter's personality that he begins to lose himself to. Peter has to reach deep inside himself to free the compassionate hero he used to be if he is to ever conquer the darkness within and face not only his greatest enemies, but also...himself." />
  <video id="v9" title="Ratatouille" preview="videos/ratatouille.flv" description="A rat named Remy dreams of becoming a great French chef despite his family's wishes and the obvious problem of being a rat in a decidedly rodent-phobic profession. When fate places Remy in the sewers of Paris, he finds himself ideally situated beneath a restaurant made famous by his culinary hero, Auguste Gusteau. Despite the apparent dangers of being an unlikely - and certainly unwanted - visitor in the kitchen of a fine French restaurant, Remy's passion for cooking soon sets into motion a hilarious and exciting rat race that turns the culinary world of Paris upside down." />	
  <video id="v10" title="Spiderman" preview="videos/spiderman.flv" description="Peter Parker has finally managed to piece together the once-broken parts of his life, maintaining a balance between his relationship with Mary-Jane and his responsibility as Spider-Man. But more challenges arise for our young hero. Peter's old friend Harry Obsourne has set out for revenge against Peter; taking up the mantle of his late father's persona as The New Goblin, and Peter must also capture Uncle Ben's real killer, Flint Marko, who has been transformed into his toughest foe yet, the Sandman. All hope seems lost when suddenly Peter's suit turns jet-black and greatly amplifies his powers. But it also begins to greatly amplify the much darker qualities of Peter's personality that he begins to lose himself to. Peter has to reach deep inside himself to free the compassionate hero he used to be if he is to ever conquer the darkness within and face not only his greatest enemies, but also...himself." />	
  <video id="v11" title="Die Hard" preview="videos/livefreeordiehard.flv" description="When someone hacks into the computers at the FBI's Cyber Crime Division; the Director decides to round up all the hackers who could have done this. When he's told that because it's the 4th of July most of their agents are not around so they might have trouble getting people to get the hackers. So he instructs them to get local PD'S to take care of it. And one of the cops they ask is John McClane who is tasked with bringing a hacker named Farrell to the FBI. But as soon as he gets there someone starts shooting at them. McClane manages to get them out but they're still being pursued. And it's just when McClane arrives in Washington that the whole system breaks down and chaos ensues." />		
  <video id="v12" title="Bourne Ultimatum" preview="videos/bourneultimatum.flv" description="Bourne is once again brought out of hiding, this time inadvertently by London-based reporter Simon Ross who is trying to unveil Operation Blackbriar--an upgrade to Project Treadstone--in a series of newspaper columns. Bourne sets up a meeting with Ross and realizes instantly they're being scanned. Information from the reporter stirs a new set of memories, and Bourne must finally, ultimately, uncover his dark past whilst dodging The Company's best efforts in trying to eradicate him. After being recovered from the sea, and after losing the one he loves, Jason Bourne is one more step closer to finding out how David Webb became Jason Bourne. Whilst Pamela Landy has decided to leave Bourne alone, CIA Deputy Director Noah Vosen has other plans. He believes that Bourne is still dangerous and must be eliminated, before he finds out his true identity and takes the CIA down with him." />
</videos>
 
Action Script:
 
//PARAMETERS//
 
var videoData = "videoInfo.xml"; //video info xml file 
var htmlTableList = "videoLayout1.html"; //html table template for the video list
 
var flvPlayerPath = this._parent.playerBox; //path to FLV player Movie Clip
var descriptionBox = this._parent.videoDescriptionBox.videoDescription; //path to description Movie Clip
var titleBox = this._parent.videoTitleBox; //path to title Movie Clip
 
//END PARAMTERS//
 
//-----------------------------------------------------------------------------
// FOR MORE INFO ON ALL THE SUPPORTED METHODS, PROPERTIES AND EVENTS       
// PLEASE CHECK THE FT TABLE RENDERER AND FT SCROLLBAR  HELPBOOKS THAT CAN BE ACCESSED  //
// VIA THE FLASH HELP PANEL AND THE EXAMPLES INCLUDED IN THE DOWNLOAD PACKAGES     
// AND THE ONLINE REFERENCES                                                   
//------------------------------------------------------------------------------
 
var xmlObj; //used in calculation
 
var listener = new Object();
var mcpath = this;
 
//default hide boxes and display them with some fading effect after movie loads
this._alpha = 0; // video list box
titleBox._alpha = 0;
descriptionBox._parent._alpha = 0;
flvPlayerPath._alpha = 0;
 
 
listener.onTableRendered = function(evt) {
	
 
 fadeVideoList(); //add some fading effect	
	
 // assign press, roollOver, rollOut handlers
 
 var tableCells = new Array();
 tableCells = table.getCells(); //get table cells
 
 for(var i=0;i<tableCells.length;i++) {
  var cellMc = tableCells[i];	 
  var firstChar = cellMc._name.charAt(0);
  if (firstChar == "v") //is a video (the cell has id=v1 / id=v2 etc attributes) 
   {
	//get info
	var infObj = getVideoInfo(cellMc._name);
	cellMc["info"] = infObj;
	
	//start playing the first movie
	var firstVideo = cellMc["info"].attributes.preview;
	if (cellMc._name=="v1") {
		                     flvPlayerPath.videoMaru.playVideo(firstVideo);
							 titleBox.tf.text = infObj.attributes.title;
							 descriptionBox.tf.text = infObj.attributes.description;
							 
	}
	
	//add event handlers
	cellMc.onPress = pressHandler; 
	cellMc.onRollOver = rollOverHandler;
    cellMc.onRollOut = rollOutHandler;
   }
 }   
}
 
 
function init() {
 xmlObj = new XML(); 
 xmlObj.ignoreWhite = true;
 xmlObj.load(videoData); //load video data
 xmlObj.onLoad = function() {
	table.sourceFile = htmlTableList;
	table.addEventListener("onTableRendered",listener); //after table is rendered assign cell press,rollOver etc event handlers	
 } 
 //setFLVPlayerControls(); //set FLVPlayback controls
}
 
function getVideoInfo(id) { //search for video id and return info
 
var objects = xmlObj.firstChild.childNodes;
for(var i=0; i<objects.length; i++) {
 if (id==objects[i].attributes.id) return objects[i];
}
 return 0 //if not video id found
}
 
 
function pressHandler() {
 flvPlayerPath.videoMaru.playVideo(this["info"].attributes.preview);
 titleBox.tf.text = this["info"].attributes.title;
 descriptionBox.tf.text = this["info"].attributes.description;
}
 
function rollOverHandler() {
 table.setCell(this,"bgcolor","0x333333");
}
 
function rollOutHandler() {
 table.setCell(this,"bgcolor","0x1c1e20");
}
 
					
					
					
					//FADE EACH BOX ON THE STAGE AFTER THE MOVIE IS LOADED//
					
function fadeVideoList() {
 var listBox = table._parent;//mainContent.movieListBox;
 var func1 = mx.transitions.easing.Regular.easeOut;
 var xs = 0;
 var xf = 100;
 var duration1 = 1.5;
 var tw1 = new mx.transitions.Tween(listBox, "_alpha", func1, xs, xf, duration1, true);
 //tw1.onMotionFinished = fadeTitle;
 tw1.onMotionChanged = checkCurrTime1;
}
 
function checkCurrTime1() {
//trace("Motion change: "+this.time+"  "+this.position);	
 if (this.time > 0.5)
   { 
    fadeTitle();
	delete this.onMotionChanged;	
   }
}
 
 
function fadeTitle() {
 var mc = titleBox;
 var func1 = mx.transitions.easing.Regular.easeOut;
 var xs = 0;
 var xf = 100;
 
 var duration1 = 0.5;
 var tw1 = new mx.transitions.Tween(mc, "_alpha", func1, xs, xf, duration1, true);
 //tw1.onMotionFinished = fadePlayerBox;
 tw1.onMotionChanged = checkCurrTime2;
}
 
function checkCurrTime2() {
//trace("Motion change: "+this.time+"  "+this.position);	
 if (this.time > 0.25)
   { 
    fadePlayerBox();
	delete this.onMotionChanged;	
   }
}
 
function fadePlayerBox() {
 var mc = flvPlayerPath;
 var func1 = mx.transitions.easing.Regular.easeOut;
 var xs = 0;
 var xf = 100;
 
 var duration1 = 0.5;
 var tw1 = new mx.transitions.Tween(mc, "_alpha", func1, xs, xf, duration1, true);
 //tw1.onMotionFinished = fadeVideoDescr;
 tw1.onMotionChanged = checkCurrTime3;
}
 
function checkCurrTime3() {
//trace("Motion change: "+this.time+"  "+this.position);	
 if (this.time > 0.25)
   { 
    fadeVideoDescr();
	delete this.onMotionChanged;	
   }
}
 
function fadeVideoDescr() {
 var mc = descriptionBox._parent;
 var func1 = mx.transitions.easing.Regular.easeOut;
 var xs = 0;
 var xf = 100;
 
 var duration1 = 0.5;
 var tw1 = new mx.transitions.Tween(mc, "_alpha", func1, xs, xf, duration1, true);
}
						 			
									// END FADING //
						
init(); //init call

Open in new window

0
Comment
Question by:gustafson_barbara
[X]
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
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
BongoMoose earned 250 total points
ID: 21780510
Hello gustafson,

You'll need to create a movieclip to hold your hyperlink, modify your xml to have an hyperlink attribute and maybe some more things, hard to say this way.

If you want you can send me the fla (with the component) and i can take a look at the needed modifications.  (com.hotmail@r_exelmans just turn it around :p )

kind regards,
Bongomoose
0
 

Author Comment

by:gustafson_barbara
ID: 21781350
Thanks Bongomoose - I am sending you the fla.
Barbara
0
 

Author Closing Comment

by:gustafson_barbara
ID: 31466934
The Expert was excellent and really helped me with an issue that I would have had a difficult time resolving.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses

751 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