Spry XML Dataset Video Gallery Question
Hi there,
We are trying to create a video gallery using a Spry XML Dataset.
It's currently working in FF and Safari, but not working in IE6-7 or Opera.
Here is a link... http://www.rightsidedesign.com.au/test/tv.html
IE seems to display the content for a second, but it doesn't load the videos or text, but then it disappears.
The elements being fed via the dataset are the video, video description (at bottom right of video) and thumbnails
Can anyone give us a hint as to what we might be doing wrong??
We followed the tutorial at... http://www.coremediadesign.co.uk/web_design_tutorials/dreamweaver_tutorials/spry_image_gal lery_adobe.html
and replaced the image with an FLV player.
Thanks for your help in advance!
Hi there,
We are trying to create a video gallery using a Spry XML Dataset.
It's currently working in FF and Safari, but not working in IE6-7 or Opera.
Here is a link... http://www.rightsidedesign.com.au/test/tv.html
IE seems to display the content for a second, but it doesn't load the videos or text, but then it disappears.
The elements being fed via the dataset are the video, video description (at bottom right of video) and thumbnails
Can anyone give us a hint as to what we might be doing wrong??
We followed the tutorial at... http://www.coremediadesign.co.uk/web_design_tutorials/dreamweaver_tutorials/spry_image_gal lery_adobe.html
and replaced the image with an FLV player.
Thanks for your help in advance!
Similar Messages
-
How to show an entry with specific ID from spry xml dataset?
I have a spry xml dataset, can I show only one record
specified by, say, unique ID?yeah, I first posted this one, then found out that my other
message was replied:) -
Spry xml datasets can't recognise images
Been trying all day to load a spry xml dataset with image
information into a table using the wizard. problem is, you can't
tell the wizard that the data in one of the columns is the path to
an image, so it sees it as a string and just sticks the path in the
table. I tried putting it in as html rather than string but really
I am firing into the dark here!
What have I missed?thanks for the reply. I found the issue in the path string,
along with having to edit the html tag directly, which I wasn't
expecting, being used to DW doing it all for me! I found a lot of
the answer here:
http://www.csupomona.edu/~llsoe/42101/css/sprytables.htm
At least it stopped me being scared of html! -
Currently when I try and add a SPRY XML Dataset and hit the Get Schema button I get "Unable to locate or parse the XML Source (-1,-1). I created the XML from the Export recordset to XML tool in the Developer Toolbox. I can't seem to figure out what I am missing. Anyone else having this problem as well. It use to work then I think my system did some update from Adobe and since has stopped working. Any assistance is greatly appreciated. Thanks.
Hello,
The error usually means that the XML source that you choose within Spry XML Data Set interface is not valid.
So you should check the XML source to see if it returns a valid XML.
Regards,
Ionut -
Spry xml dataset driven page and search engines
If a page uses Spry xml dataset to present products to a
visitor, what do google and yahoo crawlers see in that page?
I'm asking because i plan to rewrite our products' static
pages using spry xml dataset, and i'd like to ensure crawlers see
the products. I haven't looked much, yet, into this pry capability,
but the products page will most probably be paginated (not sure if
possible in this capability) since there are hundreds of products.
currently, our static html pages generated good conversions
into purchases from google and yahoo searches.
It would be great if there is a real-life website that uses
this spry capability and has their pages appear in those search
engines.
thanks.If a page uses Spry xml dataset to present products to a
visitor, what do google and yahoo crawlers see in that page?
search bot do not read / understand javascript. So they would
not index it.
Its a commen point of failure of the ajax techniques, Spry
has a handy solution for it (spry:content) wich will allow u to
overwrite 'content' if javascript is enabled so and bots will just
see the static page. -
I am new to DW and have a question I am hoping someone will
answer. I am using Spry.Data.XMLDataSet found in SpryData.js. I
have it working correctly, but if I change the XML content and
attempt to reload the page using this data it does not show the
changes. I have declared a dsObj called dsXMLdata that the
XMLDataSet method loads. How can I cause the dsXMLdata to reload
from the file. I would assume this would happen each time the
Spry.Data.XMLDataSet method is called, but I never see my changes
unless I rename the file and read the newly named file.. Kind of a
PIA.
Thanks.,
PatI am brand new to Spry, and ran into the same problem. I
believe you will have the functionality you are looking for if you
use the subpaths command in your dataset declaration. Otherwise,
your XML dataset will be limited to the data nodes in the first
tier of the <root> node (ie. only channel) You can try code
like this:
var ds1 = new Spry.Data.XMLDataSet("test.xml", "root", {
subPaths: ["channel/data1","channel/data2"] });
then access through the tags {ds1::channel/data1} ....
If you download the prerelease 1.5 spry package it has the
API docs with samples. One of the samples is about nested XML data
structures and is a good source to find out what you can do.
Hope this helps
Josh -
Passing a Spry XML Dataset to a function
I am very much a noob at this. How would I pass my XML dataset to a function so that the function would check a "date" field in the XML file and color the corresponding date cell in a YUI calendar? I have looked through the YUI Forums, but couldn't find any good examples. I am making a calendar of events that uses a calendar to filter the events in my XML file. I want the calendar to highlight the dates that have an event scheduled, so the users get a visual pointer to when events are scheduled. Here is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="SpryAssets/xpath.js" type="text/javascript"></script>
<script src="SpryAssets/SpryData.js" type="text/javascript"></script>
<script src="SpryAssets/SpryDataExtensions.js" type="text/javascript"></script>
<script src="yui/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js" type="text/javascript"></script>
<script src="yui/2.6.0/build/calendar/calendar-min.js" type="text/javascript"></script>
<script src="SpryAssets/SpryDOMUtils.js" language="javascript" type="text/javascript"></script>
<script type="text/javascript">
<!--
var dsMDEvents = new Spry.Data.XMLDataSet("schedule.xml", "events/event", {sortOnLoad: "date", sortOrderOnLoad: "ascending"});
var dsEvents = new Spry.Data.XMLDataSet("schedule.xml", "events/event", {sortOnLoad: "date", sortOrderOnLoad: "ascending"} );
dsEvents.setColumnType("date", "date");
dsEvents.setColumnType("@id", "number");var thisDate = new Date();
var todaysDate = mydateFormat(thisDate);
function pad(v)
return (v<10?"0"+v:v);
function mydateFormat(inDate)
var myData = inDate;
var gToday = new Date(myData);
var tToday = pad(gToday.getMonth()+1).toString() + "/" + pad(gToday.getDate()).toString() + "/" + gToday.getFullYear().toString();
return (tToday);
}//-->
</script>
<link href="yui/2.6.0/build/fonts/fonts-min.css" rel="stylesheet" type="text/css" />
<link href="yui/2.6.0/build/calendar/assets/skins/sam/calendar.css" rel="stylesheet" type="text/css" /><link href="SpryAssets/SpryMasterDetail.css" rel="stylesheet" type="text/css" />
</head><body>
<div id="Schedule">
<div id="calendarDiv"></div>
<script type="text/javascript">
// BeginWebWidget YUI_Calendar: yuicalendar1
YAHOO.namespace("calendar"); (function() {
var cn = document.body.className.toString();
if (cn.indexOf('yui-skin-sam') == -1) {
document.body.className += " yui-skin-sam";
YAHOO.calendar.init = function() {
YAHOO.calendar.cal1 = new YAHOO.widget.CalendarGroup("cal1", "CalendarDiv", {PAGES:3}); // The following event subscribers demonstrate how to handle
// YUI Calendar events, specifically when a date cell is
// selected and when it is unselected.
// See: http://developer.yahoo.com/yui/calendar/ for more
// information on the YUI Calendar's configurations and
// events.
// The YUI Calendar API cheatsheet can be found at:
// http://yuiblog.com/assets/pdf/cheatsheets/calendar.pdf
//--- begin event subscribers ---//
YAHOO.calendar.cal1.selectEvent.subscribe(selectHandler, YAHOO.calendar.cal1, true);
YAHOO.calendar.cal1.deselectEvent.subscribe(deselectHandler, YAHOO.calendar.cal1, true);
//--- end event subscribers ---//
function dateHighlightRenderer(workingDate, cell) {
var isHighlighted = false;
var date = workingDate.getMonth()+1 + "/" + workingDate.getDate() + "/" + workingDate.getFullYear();
/*if (rows["date"].search(date) != -1) {
isHighlighted = true;
if (date) {
isHighlighted = true;
if (isHighlighted) {
YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT4);
//YAHOO.calendar.cal1.addRenderer("11/14/2009, 11/1/2009, 11/29/2009, 11/30/2009", YAHOO.calendar.cal1.renderCellStyleHighlight1);
for (var i = 1; i <= 7; i++) {
// Attach to the Weekday, instead of individual dates/ranges, to improve performance.
YAHOO.calendar.cal1.addWeekdayRenderer(i, dateHighlightRenderer);
YAHOO.calendar.cal1.render();
var todayFilterFunc = function(dsMDEvents, row, rowNumber)
if (row["date"] >= todaysDate)
return row; // Return the row to keep it in the data set.
return null; // Return null to remove the row from the data set.
dsMDEvents.filter(todayFilterFunc);
} function selectHandler(event, data) {
// The JavaScript function subscribed to yuicalendar1. It is called when
// a date cell is selected.
// alert(event) will show an event type of "Select".
// alert(data) will show the selected date as [year, month, date].
var formattedDate = pad(data[0][0][1]) + "/" + pad(data[0][0][2]) + "/" + data[0][0][0];
var dateFilterFunc = function(dsMDEvents, row, rowNumber)
if (row["date"].search(formattedDate) != -1)
return row; // Return the row to keep it in the data set.
return null; // Return null to remove the row from the data set.
dsMDEvents.filter(dateFilterFunc); // Filter the rows in the data set.
}; function deselectHandler(event, data) {
// The JavaScript function subscribed to yuicalendar1. It is called when
// a selected date cell is unselected.
}; // Create the YUI Calendar when the HTML document is usable.
YAHOO.util.Event.onDOMReady(YAHOO.calendar.init);
// EndWebWidget YUI_Calendar: yuicalendar1
</script>
<div class="MasterDetail">
<div spry:region="dsMDEvents" class="MasterContainer">
<div class="MasterColumn" spry:repeat="dsMDEvents" spry:setrow="dsMDEvents" spry:hover="MasterColumnHover" spry:select="MasterColumnSelected">{date}<br />
{name}<br />
{starttime} - {endtime}</div>
</div>
<div spry:detailregion="dsMDEvents" class="DetailContainer">
<h2 class="DetailColumn">{name}</h2>
<p class="DetailColumn"><strong>Date:</strong> {date}<br />
<strong>Time:</strong> {starttime} - {endtime}</p>
<p class="DetailColumn"><strong>Where:</strong> {location}<br />
<strong>Type:</strong> {type}</p>
<p class="DetailColumn"><strong>Contact:</strong> {contact}</p>
</div>
<br style="clear:both" />
</div>
</div>
</body>
</html>
and here is a snipet of my xml file:
<?xml version="1.0" encoding="utf-8"?>
<events>
<event id="1">
<name>Dreamweaver CS4 Intermediate</name>
<date>10/15/2009</date>
<starttime>8:00 am</starttime>
<endtime>5:00 pm</endtime>
<location>Room 1</location>
<type>Training</type>
<contact>Contact 1</contact>
</event>
<event id="2">
<name>InDesign CS4 Advanced</name>
<date>11/14/2009</date>
<starttime>8:00 am</starttime>
<endtime>5:00 pm</endtime>
<location>Room 2</location>
<type>Training</type>
<contact>Contact 1</contact>
</event>
<event id="3">
<name>Flex CS4 Data Services</name>
<date>10/15/2009</date>
<starttime>1:00 pm</starttime>
<endtime>5:00 pm</endtime>
<location>Room 2</location>
<type>Meeting</type>
<contact>Contact 2</contact>
</event>
<event id="4">
<name>Another Dreamweaver CS4 Intermediate</name>
<date>11/30/2009</date>
<starttime>8:00 am</starttime>
<endtime>5:00 pm</endtime>
<location>Room 1</location>
<type>Training</type>
<contact>Contact 1</contact>
</event>
<event id="5">
<name>Another InDesign CS4 Advanced</name>
<date>11/29/2009</date>
<starttime>8:00 am</starttime>
<endtime>5:00 pm</endtime>
<location>Room 2</location>
<type>Training</type>
<contact>Contact 3</contact>
</event>
<event id="6">
<name>Another Flex CS4 Data Services</name>
<date>11/01/2009</date>
<starttime>1:00 pm</starttime>
<endtime>5:00 pm</endtime>
<location>Room 2</location>
<type>Meeting</type>
<contact>Contact 2</contact>
</event>
<event id="7">
<name>More Training</name>
<date>11/02/2009</date>
<starttime>8:00 am</starttime>
<endtime>10:00 am</endtime>
<location>Room 3</location>
<type>Training</type>
<contact>Contact 4</contact>
</event>
<event id="8">
<name>Another Training</name>
<date>10/25/2009</date>
<starttime>9:00 am</starttime>
<endtime>11:00 am</endtime>
<location>Room 3</location>
<type>Training</type>
<contact>Contact 4</contact>
</event>
<event id="9">
<name>Some More Training</name>
<date>12/02/2009</date>
<starttime>1:00 pm</starttime>
<endtime>3:00 pm</endtime>
<location>Room 3</location>
<type>Training</type>
<contact>Contact 4</contact>
</event>
</events>
The function "dateHighlightRenderer" is where I am running into the problem. How do I code this so that "dateHighlightRenderer" can read the "date" field in my XML file?I have tried the getData() function for this. However, I am not sure if I am using it right:
var d = dsMDEvents.getData();
for (var i = 0; i < d.length(); i++) {
var day = d[i]["date"];
YAHOO.calendar.cal1.addRenderer(day, dateHighlightRenderer);
When I run this for loop, my calendar will not appear on the page. Any suggestions? -
Spry xml dataset / IE / Phatfusion Multibox
I try to use spry xml data set with phatfusion multibox.
I use multibox script to open a PHP page with query string
insides spry:region.
It has problem on this application on IE either 6 and 7. But
works fine in Firefox
The requested php page just open in a new window.
I tested to relocate the dummy scripts for multibox outsides
spry:region, the script do works.
How to solve the problem ! Help pleaseHi bsyyu,
First, you might want to validate your markup because I see
that you have several unclosed tags and a missing title tag.
To solve the problem, you'll have to create your multibox
object inside an observer for the region.
Replace your code inside the region:
<script
type="text/javascript">
var ben = {};
window.addEvent('domready', function(){
ben = new MultiBox('mb', {descClassName: 'multiBoxDesc'});
</script>
with this code, put in a script in the page head:
var obs = new Object;
obs.onPostUpdate = function(notifier, data){
var ben = new MultiBox('mb', {descClassName:
'multiBoxDesc'});
Spry.Data.Region.addObserver('events', obs);
--Florin TUDOR -
XML Driven Video Gallery with Playlist
Hi,
I have put together a XML Driven Video Player with auto thumbnail detection but there is a problem.The Video plays but, The thumbs will not show. I think my thumbnail function is not reaching the correct node in my XML.Can someone take a look at my Actionscript Please? The Action Script is below. The XML is at the bottom of this post. The top half of the code is the video playing code the bottom is for the thumbs.
Actionscript 2.0
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.setNufferTime(30);
ns.onStatus = function(info) {
if (info.code == "NetStream.Buffer.Full") {
bufferClip._visible = false;
if (info.code == "NetStream.Buffer.Empty") {
bufferClip._visible = true;
if (info.code == "NetStream.Buffer.Stop") {
ns.seek(0);
theVideo.attachVideo(ns);
rewindButton.onRelease = function() {
ns.seek(0);
playButton.onRelease = function() {
ns.pause();
var videoInterval = setInterval(videoStatus, 100);
var amountLoaded:Number;
var duration:Number;
ns["onMetaData"] = function (obj) {
duration = obj.duration;
function videoStatus() {
amountLoaded = ns.bytesLoaded/ns.bytesTotal;
loader.loadbar._width = amountLoaded*187.4;
loader.scrub._x = ns.time/duration*187.4;
var scrubInterval;
loader.scrub.onPress = function() {
clearInterval(videoInterval);
scrubInterval = setInterval(scrubit, 10);
this.startDrag(false,0,this._y,187.4,this._y);
loader.scrub.onRelease = loader.scrub.onReleaseOutside=function () {
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus, 100);
this.stopDrag();
function scrubit() {
ns.seek(Math.floor((loader.scrub._x/187)*duration));
var theMenu:ContextMenu = new ContextMenu();
theMenu.hideBuiltInItems();
_root.menu = theMenu;
var i1:ContextMenuItem = new ContextMenuItem(":::::Video Controls:::::", trace);
theMenu.customItems[0] = i1;
var i2:ContextMenuItem = new ContextMenuItem("Play / Pause Video", pauseIt, true);
theMenu.customItems[1] = i2;
var i3:ContextMenuItem = new ContextMenuItem("Replay Video", replayIt);
theMenu.customItems[2] = i3;
var i4:ContextMenuItem = new ContextMenuItem("All Rights Reserved 2009", trace, true);
theMenu.customItems[3] = i4;
var i5:ContextMenuItem = new ContextMenuItem("SamAndOnline.com Video Player", trace);
theMenu.customItems[4] = i5;
function pauseIt() {
ns.pause();
function replayIt() {
ns.seek(0);
//sound controls
_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
vSound.attachAudio(ns);
var so:Sound = new Sound(vSound);
so.setVolume(100);
volControl.volcon.slider1.onPress = function() {
this.startDrag(true,volControl.volcon.groove1._x,volControl.volcon.groove1._y,volControl.v olcon.groove1._x,volControl.volcon.groove1._y+100);
slideit = setInterval(volControl.volcon.slider_1Move, 100, this);
volControl.volcon.slider1.onRelease = function() {
this.stopDrag();
clearInterval(slideit);
mute.gotoAndStop("on");
volControl.volcon.slider1.onReleaseOutside = function() {
this.stopDrag();
clearInterval(slideit);
mute.gotoAndStop("on");
mute.onRollOver = function() {
if (so.getVolume() == 100) {
this.gotoAndStop("onOver");
} else {
this.gotoAndStop("muteOver");
mute.onRollOut = function() {
if (so.getVolume() == 100) {
this.gotoAndStop("on");
} else {
this.gotoAndStop("mute");
mute.onRelease = function() {
if (so.getVolume() == 100) {
so.setVolume(0);
this.gotoAndStop("muteOver");
} else {
so.setVolume(100);
this.gotoAndStop("onOver");
//listBx
var vlist:XML = new XML();
vlist.ignoreWhite = true;
vlist.onLoad = function() {
var videos:Array = this.firstChild.childNodes;
for (i=0; i<videos.length; i++) {
videoList.addItem({label:videos[i].attributes.desc,data:videos[i].attributes.url ,image:videos[i].attributes.thumb});
//play 1st video
ns.play(videoList.getItemAt(0).data);
videoList.selectedIndex = 0;
//would like to reference something in the XML File with the thumb attribute
thumbnails_fn(i);
var vidList:Object = new Object();
vidList.change = function() {
ns.play(videoList.getItemAt(videoList.selectedIndex).data);
videoList.addEventListener("change",vidList);
vlist.load("videos.xml");
soundb.onRelease = function() {
if (volControl.switch2=open2) {
volControl.gotoAndPlay("open");
} else {
volControl.play();
function thumbNailScroller() {
// thumbnail code!
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 10;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._x -= scroll_speed;
} else if ((_root._xmouse<=40) && (thumbnail_mc.hitTest(hit_left))) {
thumbnail_mc._x += scroll_speed;
} else {
delete tscroller.onEnterFrame;
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_left._x+(eval("thumbnail_mc.t"+k)._width+5)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
target_mc.onRollOut = function() {
this._alpha = 100;
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(image[k], "thumbnail_mc.t"+k);
trace(videoList.getItemAt(0).image+ "k= "+k+" "+videos.length+" pv "+target_mc.pictureValue+" thumbnails");
XML Example
<?xml version="1.0" encoding="ISO-8859-1"?>
<videos>
<video url="vid1.flv" desc="Video 1" thumb="1.jpg"/>
<video url="vid2.flv" desc="Video 2" thumb="2.jpg"/>
</videos>I'm trying to load the thumbnails in with this code
image_mcl.loadClip(image[k], "thumbnail_mc.t"+k);
i tried
videoList.getItemAt(k).image
which works in the trace method but gives no response in the actual code it self
So the line of code that should work is
image_mcl.loadClip(videoList.getItemAt(k).image, "thumbnail_mc.t"+k);
and not
image_mcl.loadClip(image[k], "thumbnail_mc.t"+k);
but I gets no response -
Spry XML dataset + PHP problem
I have installed Dreamweaver CS3 and created a simple page
that receives a XML dataset from a PHP page. I was not able to
display any data in either FF or IE (just got a blank page). I then
downloaded the 1.5 pre-release and discovered the Data Set Explorer
which worked well in FF but doesn't do anything in IE. Then I
copied SpryData.js and xpath.js to my sites' SpryAssets directory,
overwriting the 1.4 files and my simple page worked in FF,
but still NOT in IE6/7. I then uploaded the pages to a
remote server and tested on another PC, but it still doesn't work.
If I replace the php file with a XML dataset it works on both FF
and IE. Can someone please look at the
test page and tell me what
I am missing? The PHP page that feeds the XML can be viewed
hereThanks for the reply Kin, I also had an idea that it might be
the headers. When I copied the example from
here
the
header('Content-type:
text/xml'); line was commented out by mistake! Thanks for
your help, it's working now! -
Ajax load spry/xml dataset....
I'm a noob. And a very frustrated one.
I am using Ajax to load an external page into my main site.
The external page has XML/Spry data attached to it. The page loads
fine when executing the Ajax request, but the page will not display
the XML data. Any ideas? Do I need to embed the xml? How do I
attach the xml to my main page?Do the scripts get loaded when u do the request?, is the page
working when u don't do a request?
Got a url to show? or code snippet? Using 1.6.1? -
SPRY XML Dataset...add node filter
This is working fine except I want to only show records whose value is "1" for the XML node called "node".
Below is the HTML file followed by the XML file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="../SpryAssets/xpath.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryData.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryStackedContainers.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var ds1 = new Spry.Data.XMLDataSet("PSY303.xml", "VitalSource/URL", { sortOnLoad: [ "node", "sort"] });
</script>
</head>
<body>
<div spry:region="ds1" class="StackedContainers">
<div spry:repeat="ds1" class="RowContainer">
<div class="RowColumn"><a href="{link}" target="_blank">{title}</a></div>
</div>
</div>
</body>
</html>
<?xml version="1.0" encoding="ISO-8859-1"?>
<VitalSource>
<URL>
<node>1</node>
<sort>2</sort>
<title>Node 1 Link Test 2</title>
<link>http://www.cnn.com</link>
</URL>
<URL>
<node>1</node>
<sort>1</sort>
<title>Node 1 Link Test 1</title>
<link>http://www.msnbc.com</link>
</URL>
<URL>
<node>2</node>
<sort>1</sort>
<title>Node 2 Link Test 1</title>
<link>http://www.yahoo.com</link>
</URL>
<URL>
<node>2</node>
<sort>2</sort>
<title>Node 2 Link Test 2</title>
<link>http://www.google.com</link>
</URL>
<URL>
<node>2</node>
<sort>3</sort>
<title>Node 2 Link Test 3</title>
<link>http://www.google.com</link>
</URL>
<URL>
<node>3</node>
<sort>1</sort>
<title>Node 3 Link Test 1</title>
<link>http://www.yahoo.com</link>
</URL>
</VitalSource>Have a look at XPath filtering here http://labs.adobe.com/technologies/spry/samples/data_region/XPathFilteringSample.html and herehttp://labs.adobe.com/technologies/spry/samples/data_region/FilterXPath_with_params.html
Gramps -
Hope someone can help me --
I've been having some success bringing an XML data set into a table using Spry, but was looking for some help on how to do something more specific.
I have a small group of data with the following headings: State, number, credits, date. I'd like to create a two-row table with the top row as the column headings and a second row that populates based on a drop-down list for the state.
For example:
State
Number
Credits
Date
Alabama (drop down arrow)
589654
7
4/29/2009
Then, when you click the drop down arrow and choose New York, the other fields will fill in from that XML item
State
Number
Credits
Date
New York (drop down arrow)
XL7654
6.4
5/3/2009
Can anyone help?Hi eschillay,
Assuming you had a data set with column names that matched the headers in your table, it would look something like this:
<script type="text/javascript">
var ds1 = new Spry.Data.XMLDataSet("states.xml", "/states/state");
</script>
<div spry:detailregion="ds1">
<table>
<tr>
<th>State</th>
<th>Credit</th>
<th>Numbers</th>
<th>Date</th>
</tr>
<tr>
<td>
<select spry:repeatchildren="ds1" spry:choose="choose" onchange="ds1.setCurrentRowNumber(this.selectedIndex)">
<option spry:when="{ds_RowNumber} == {ds_CurrentRowNumber}" selected="selected" value="{State}">{State}</option>
<option spry:default="default" value="{State}">{State}</option>
</select>
</td>
<td>{Credit}</td>
<td>{Numbers}</td>
<td>{Date}</td>
</tr>
</table>
</div>
--== Kin ==-- -
Spry Menu Using Nested XML Dataset (Spry 1.6)
I have a vertical menu with a few items. One of which is
labeled Products which has submenus. I want to have that submenu
read from a Nested XML dataset. Using a single dataset for one
level in a menu is easy enough, but the subenu will have submenus.
Example Menu:
Home
Company
Products
|-- Product 1
|-- Item 1
|-- Item 2
|-- Item 3
|-- Product 2
|-- Item 1
|-- Item 2
|-- Product 3
|-- Item 1
|-- Item 2
|-- Item 3
|-- Item 4
|-- Product 4
|-- Item 1
|-- Item 2
|-- Product 5
I have been looking for an easy way to use the Spry Nested
XML Dataset to create the Product/Item menu. The number of Products
may vary as well as the number of Items in each Product submenu
(also, some Products may not have Items).
I already have an ASP page that creates the XML data from a
database.
Schema follows (XSD ):
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
<xsd:element name="products">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="product_type"
maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="type_name" maxOccurs="1"
type="xsd:string"/>
<xsd:element name="type_url" maxOccurs="1"
type="xsd:anyURI"/>
<xsd:element name="product_name"
maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="item_name" maxOccurs="1"
type="xsd:string"/>
<xsd:element name="item_url" maxOccurs="1"
type="xsd:anyURI"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
I have been programming for 17 years but am new to Spry. If
this cannot be done easily with the Spry framework, I'll probably
wind up splitting the XML data into 2 files (Products and Items)
then writing a nested loop and call each by row, but then I have to
find out how Spry Datasets reference XML data. Figuring out how to
call rows from the XML data shouldn't be so bad, but this method
just seems like such a hassle for something that should be easy.
Pseudocode follows:
j=1
i=1 to TotalNumberProducts
display Product i from Products
ItemsExist=true
While ItemsExist
if j > TotalNumberItems | Item j is not for Product then
ItemsExist=false
else
display Item j from Items
j++
Wend
Next
Thanks in advance for any help or direction!That's exactly what I'm trying to do. However, I implemented
that code and the submenus won't appear. I suspect the submenus
aren't finding the field names from the Nested XML Dataset. The
first level of Product menus work great (this is a submenu of the
overall menu) and correctly identify products that do not have
submenus, so I know it's picking up the number of records in the
Nested Dataset correctly - it just won't display the data in the
next level of menu.
variable and script declarations:
<script src="SpryAssets/SpryMenuBar.js"
type="text/javascript"></script>
<script src="SpryAssets/xpath.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryData.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryNestedXMLDataSet.js"
type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarVertical.css"
rel="stylesheet" type="text/css">
<script type="text/javascript">
<!--
var productMenuData = new
Spry.Data.XMLDataSet("products.asp", "products/product_type");
var productMenuDataItems = new
Spry.Data.NestedXMLDataSet(productMenuData, "product_name");
//-->
</script>
Code for menus:
<ul id="NavMenu" class="MenuBarVertical">
<li><a
href="index.html">Home</a></li>
<li><a
href="company.html">Company</a></li>
<li><a href="franco_giberti.html">Franco
Giberti</a></li>
<li><a class="MenuBarItemSubmenu"
href="products.asp">Products</a>
<ul spry:region="productMenuData
productMenuDataItems">
<li spry:repeat="productMenuData"><a
class="MenuBarItemSubmenu" href="{type_url}"
spry:if="{productMenuDataItems::ds_RowCount} !=
0">{type_name}</a> <a href="{type_url}"
spry:if="{productMenuDataItems::ds_RowCount} ==
0">{type_name}</a>
<ul spry:if="{productMenuDataItems::ds_RowCount} !=
0">
<li spry:repeat="productMenuDataItems"><a
href="{productMenuDataItems::item_url}">{productMenuDataItems::item_name}</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="contact.html">Contact Us</a>
<!-- end #sidebar1 -->
</li>
</ul>
XML:
<products
xsi:noNameSpaceSchemaLocation="products.xsd">
−
<product_type>
<type_name>Pasta Sauce</type_name>
<type_url>pt_2.asp</type_url>
−
<product_name>
<item_name>Putenesca</item_name>
<item_url>pn_3.asp</item_url>
</product_name>
−
<product_name>
<item_name>Arrabiata</item_name>
<item_url>pn_4.asp</item_url>
</product_name>
−
<product_name>
<item_name>Pesto</item_name>
<item_url>pn_5.asp</item_url>
</product_name>
−
<product_name>
<item_name>Basil and Tomato</item_name>
<item_url>pn_6.asp</item_url>
</product_name>
−
<product_name>
<item_name>Bolognese</item_name>
<item_url>pn_7.asp</item_url>
</product_name>
−
<product_name>
<item_name>Carboniera</item_name>
<item_url>pn_8.asp</item_url>
</product_name>
</product_type>
+
<product_type>
<type_name>Organic Olive Oil</type_name>
<type_url>pt_3.asp</type_url>
−
<product_name>
<item_name>Original</item_name>
<item_url>pn_9.asp</item_url>
</product_name>
−
<product_name>
<item_name>Basil</item_name>
<item_url>pn_10.asp</item_url>
</product_name>
−
<product_name>
<item_name>Herbs</item_name>
<item_url>pn_11.asp</item_url>
</product_name>
−
<product_name>
<item_name>Sun Dried Tomato</item_name>
<item_url>pn_12.asp</item_url>
</product_name>
</product_type>
+
<product_type>
<type_name>Organic Spreads</type_name>
<type_url>pt_4.asp</type_url>
−
<product_name>
<item_name>Putenesca</item_name>
<item_url>pn_13.asp</item_url>
</product_name>
−
<product_name>
<item_name>Arrabiata</item_name>
<item_url>pn_14.asp</item_url>
</product_name>
−
<product_name>
<item_name>Pesto</item_name>
<item_url>pn_15.asp</item_url>
</product_name>
−
<product_name>
<item_name>Basil and Tomato</item_name>
<item_url>pn_16.asp</item_url>
</product_name>
−
<product_name>
<item_name>Bolognese</item_name>
<item_url>pn_17.asp</item_url>
</product_name>
−
<product_name>
<item_name>Carboniera</item_name>
<item_url>pn_18.asp</item_url>
</product_name>
</product_type>
+
<product_type>
<type_name>Organic Grilled Vegetables</type_name>
<type_url>pt_5.asp</type_url>
−
<product_name>
<item_name>Putenesca</item_name>
<item_url>pn_19.asp</item_url>
</product_name>
−
<product_name>
<item_name>Arrabiata</item_name>
<item_url>pn_20.asp</item_url>
</product_name>
−
<product_name>
<item_name>Pesto</item_name>
<item_url>pn_21.asp</item_url>
</product_name>
−
<product_name>
<item_name>Basil and Tomato</item_name>
<item_url>pn_22.asp</item_url>
</product_name>
−
<product_name>
<item_name>Bolognese</item_name>
<item_url>pn_23.asp</item_url>
</product_name>
−
<product_name>
<item_name>Carboniera</item_name>
<item_url>pn_24.asp</item_url>
</product_name>
</product_type>
−
<product_type>
<type_name>Truffle Products</type_name>
<type_url>pt_6.asp</type_url>
</product_type>
</products>
Any further guidance would be very much appreciated! -
Need help with xml video gallery
Hello everyone
I recently bought a xml video gallery. I'm loading the movie externally into another movie. When the xml gallery loads, it cancels all sounds.
I need to figure out where in the actionscription can i reverse the cancellation of sounds. Can anyone help? if possible, I can email, whomever is willing to help, the xml gallery to see if theres another reason the sound is being canceled.
Also, the sound of the gallery doesn't work til you click the volume scroller.
Here are two parts of actionscript included in the gallery:
part one:
// Import filter classes
import mx.transitions.Tween;
import mx.transitions.easing.*;
// Set flash variables
var xmlFileUrl:String = "playlist.xml";
var auto_play:String = "true";
// Set xml file URL
if (_root.xmlfile) {
xmlFileUrl = _root.xmlfile;
var V_SRC;
var thuArray:Array = new Array();
var currentVideo:Number = 0;
var totalItems;
var numOfItems:Number;
var itemDistance:Number = 120+5;
var itemHeight:Number = 80+2;
var Value:Number = 1;
var boundry:Number = 1;
var ratio:Number = 1;
var diff:Number = 1;
var collectionWidth:Number = 1;
var buffer:Number = 135*2;
this.createEmptyMovieClip("video_txt",this.getNextHighestDepth());
video_txt.createTextField("theText",video_txt.getNextHighestDepth(),0,0,584,36);
video_txt.theText.selectable = false;
video_txt.theText.autoSize = "left";
//The Format
myFormat = new TextFormat();
myFormat.font = _root.font_format;
myFormat.size = _root.font_size;
myFormat.color = _root.font_color;
myFormat.align = "center";
video_txt.theText.setNewTextFormat(myFormat);
// Create a new movieclip to load the thumbs
var thumbLoader:MovieClipLoader = new MovieClipLoader();
var thumbListener:Object = new Object();
thumbLoader.addListener(thumbListener);
thumbListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number)
new Tween(target_mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
target_mc._parent.preloader_mc._alpha = 0;
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = xmlLoaded;
xml.load(xmlFileUrl);
// Load the xml file into the player
function xmlLoaded(b:Boolean) {
if (b) {
auto_play = this.firstChild.firstChild.attributes.auto_play;
scrollSpeed = parseInt(this.firstChild.firstChild.attributes.scrollSpeed);
totalItems = this.firstChild.firstChild.childNodes;
numOfItems = totalItems.length;
for (j=0; j<numOfItems; j++) {
var i = player_mc.main_mc.collection_mc.attachMovie("mc_Thumb", "thumb_"+j, j);
i._x = itemDistance*j;
thumbLoader.loadClip(totalItems[j].attributes.thumb,i.loader_mc);
i.id = j;
i.videoTitle = totalItems[j].attributes.title;
i.videoUrl = totalItems[j].attributes.src;
// Create an event for thumb rollover
i.onRollOver = iRoll;
i.onRollOut = i.onReleaseOutside=iOut;
i.onRelease = iRelease;
thuArray[j] = i;
// default first video
collectionWidth = player_mc.main_mc.collection_mc._width;
currentVideo = 0;
V_SRC = thuArray[0].videoUrl;
changeVideo();
//scope._alpha = 100;
new Tween(scope, "_alpha", Regular.easeOut, 0, 100, 0.5, true);
else
trace("Error! xml file not loaded");
// onRollOver Events
function iRoll() {
player_mc.mc_title.title_txt.htmlText = totalItems[this.id].attributes.title;
this.light_mc.play();
function iRelease() {
currentVideo = this.id;
changeVideo();
function changeVideo() {
V_SRC = thuArray[currentVideo].videoUrl;
player_mc.loadVideo();
currentThumb();
player_mc.mc_title.title_txt.htmlText = thuArray[currentVideo].videoTitle;
video_txt.theText.text = totalItems[currentVideo].attributes.title;
player_mc.so.getVolume();
player_mc.playStatus = 1;
player_mc.checkStatus();
function nextVideo() {
if (currentVideo<(numOfItems-1)) {
currentVideo++;
} else {
currentVideo = 0;
changeVideo();
function currentThumb() {
for (i=0; i<thuArray.length; i++) {
if (i == currentVideo) {
thuArray[i].enabled = true;
// Mouse movement on rollover
this.onMouseMove = function() {
collectionWidth = player_mc.main_mc.collection_mc._width;
boundry = player_mc.main_mc.area_mc._width;
if ((player_mc.main_mc._ymouse>0) && (player_mc.main_mc._ymouse<itemHeight)) {
if ((player_mc.main_mc._xmouse>0) && (player_mc.main_mc._xmouse<boundry)) {
ratio = player_mc.main_mc._xmouse/boundry;
diff = (collectionWidth-boundry)+buffer;
Value = Math.floor((-ratio)*diff)+(buffer/2);
updateAfterEvent();
this.onEnterFrame = function() {
// Define movement area and speed
if (player_mc.main_mc.collection_mc._width>player_mc.main_mc.area_mc._width) {
player_mc.main_mc.collection_mc._x = Math.round((player_mc.main_mc.collection_mc._x)+((Value-player_mc.main_mc.collection_mc._ x)/scrollSpeed));
if (player_mc.main_mc.collection_mc._x>0) {
player_mc.main_mc.collection_mc._x = 0;
} else if (player_mc.main_mc.collection_mc._x<(player_mc.main_mc.area_mc._width-(player_mc.main_mc. collection_mc._width))) {
player_mc.main_mc.collection_mc._x = Math.round(player_mc.main_mc.area_mc._width-(player_mc.main_mc.collection_mc._width));
} else {
player_mc.main_mc.collection_mc._x = 0;
updateAfterEvent();
part two:
// Define flash variables
var video_url:String = "";
var tempx:Number = this._parent._x;
var tempy:Number = this._parent._y;
var timeCounter:Number = 0;
var timeInSeconds:Number = _root.time_counter;
// Object to listen to onStage Event
videoObj = vid.videoObj;
// Setting up the connection
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
// Buffer time
ns.setBufferTime (10);
videoObj.attachVideo (ns);
function loadVideo () {
video_url = _parent.V_SRC;
trace(video_url);
ns.play (video_url);
function checkStatus()
if (playStatus == 1)
controls_mc.playPause.gotoAndStop("pause");
mc_playAgain._visible = false;
thumbs_out = false;
title_out = false;
else
controls_mc.playPause.gotoAndStop("play");
mc_playAgain._visible = true;
} // end else if
if (so.getVolume() == 0)
controls_mc.mute_mc.gotoAndStop("mute");
else
controls_mc.mute_mc.gotoAndStop("on");
}; // End of the function
mc_playAgain._visible = false;
// Check Status of video
ns.onStatus = function (info)
if (info.code == "NetStream.Buffer.Empty")
mc_buffer._visible = true;
else if (info.code == "NetStream.Buffer.Full")
mc_buffer._visible = false;
else if (info.code == "NetStream.Play.Stop")
ns.seek(0);
if (playStatus == 1)
ns.pause();
playStatus = 0;
else
trace;
} // end else if
mc_playAgain._visible = true;
mc_buffer._visible = false;
thumbs_out = true;
title_out = true;
checkStatus();
} // end else if
// Get info about video
ns.onMetaData = function(infoObject:Object)
FLVduration = infoObject["duration"];
relationshipW = infoObject.height / infoObject.width;
relationshipH = infoObject.width / infoObject.height;
if (Stage["displayState"] == "fullScreen")
largeSize ();
else
regularSize ();
if (_parent.auto_play == "false")
ns.seek(0);
if (playStatus == 1)
ns.pause();
playStatus = 0;
mc_buffer._visible = false;
controls_mc.playPause.gotoAndStop("play");
mc_playAgain._visible = true;
thumbs_out = true;
title_out = true;
_parent.auto_play = "true";
}// end else if
var videoInterval = setInterval(videoStatus, 100);
var amountLoaded;
var duration;
// videoStatus on load Event
function videoStatus()
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
controls_mc.mc_progress.mc_buff._width = amountLoaded * 250;
controls_mc.mc_progress.mc_played._x = ns.time / duration * 250;
controls_mc.mc_progress.mc_played._xscale = Math.round(ns.time*100/FLVduration);
}; // End of the function
function scrubIt()
ns.seek(Math.floor(controls_mc.mc_progress.mc_played._x / 250 * duration));
}; // End of the function
// video time
var time_interval:Number = setInterval(checkTime, 500, ns);
function checkTime(ns:NetStream) {
//current time
var ns_seconds:Number = ns.time;
var minutes:Number = Math.floor(ns_seconds/60);
var seconds = Math.floor(ns_seconds%60);
sec = seconds;
min = minutes;
if (sec<10) {
sec = "0"+sec;
if (min<10) {
min = "0"+min;
controls_mc.time_txt.time_1.text = min+":"+sec;
//total time
var minutes2:Number = Math.floor(FLVduration/60);
var seconds2 = Math.floor(FLVduration%60);
sec2 = seconds2;
min2 = minutes2;
if (sec2<10) {
sec2 = "0"+sec2;
if (min2<10) {
min2 = "0"+min2;
controls_mc.time_txt.time_2.text = min2+":"+sec2;
if (controls_mc.time_txt.time_2.text == "NaN:NaN") {
controls_mc.time_txt.time_2.text = "00:00";
setStage ();
// Object to listen onStage Event
var stageL:Object = new Object ();
// function respnsible for content alignment
function setStage ()
if (Stage["displayState"] == "fullScreen") {
tempx = this._parent._x;
tempy = this._parent._y;
this._parent._x = 0;
this._parent._y = 0;
vidBg_mc._x = 0;
vidBg_mc._y = 0;
mc_title._x = 0;
mc_title._y = -30;
slide_me._x = 0;
slide_me._y = 0;
vidBg_mc._width = Stage.width;
vidBg_mc._height = Stage.height;
mc_title._width = Stage.width;
mc_title._height = Stage.height / 20;
slide_me._width = Stage.width;
slide_me._height = Stage.height / 20;
vid._x = vid._y = 0;
largeSize ();
controls_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));
controls_mc._y = Math.round (Stage.height - 36);
mc_playAgain._x = Math.round ((Stage.width / 2) - (mc_playAgain._width / 2));
mc_playAgain._y = Math.round (Stage.height - 572);
thumbs_mc._x = Math.round ((Stage.width / 2) - (thumbs_mc._width / 2));
thumbs_mc._y = Math.round (Stage.height - 115);
main_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));;
hide_mc.onEnterFrame = function () {
timeCounter = timeCounter + 1;
if (timeCounter >= timeInSeconds * 30) {
timeCounter = 0;
controls_mc._alpha = 0;
this.onMouseMove = function () {
timeCounter = 0;
controls_mc._alpha = 100;
else
delete hide_mc.onEnterFrame;
delete this.onMouseMove;
controls_mc._alpha = 100;
this._parent._x = tempx;
this._parent._y = tempy;
vidBg_mc._width = 600;
vidBg_mc._height = 360;
mc_title._width = 600;
mc_title._height = 30;
slide_me._width = 600;
slide_me._height = 30;
vidBg_mc._x = vid._x = 0;
vidBg_mc._y = vid._y = 35;
mc_title._x = vid._x = 0;
mc_title._y = vid._x = -30;
slide_me._x = vid._x = 0;
slide_me._y = vid._y = 35;
regularSize ();
controls_mc._x = 0;
controls_mc._y = 395;
mc_playAgain._x = 243;
mc_playAgain._y = 158;
thumbs_mc._x = 0;
thumbs_mc._y = 316;
main_mc._x = 0;
main_mc._y = 406;
mc_buffer._x = Math.round (vidBg_mc._x + (vidBg_mc._width / 2));
mc_buffer._y = Math.round (vidBg_mc._y + (vidBg_mc._height / 2));
// to apply when stage (browser window) is resized or modified
stageL.onResize = function () {
setStage ();
// attaching object to the stage
Stage.addListener (stageL);
MovieClip.prototype.slide = function(yPos) {
this._y -= (this._y-yPos)/5;
// tilte actions
mc_title.onEnterFrame = function()
if (Stage["displayState"] == "normal" && title_out == false)
this.slide(5);
else if (Stage["displayState"] == "normal" && title_out == true)
this.slide(35);
if (Stage["displayState"] == "fullScreen" && title_out == false)
this._y -= (this._y+106)/5;
else if (Stage["displayState"] == "fullScreen" && title_out == true)
this.slide(0);
// thumbs actions
main_mc.onEnterFrame = function()
if (Stage["displayState"] == "normal" && thumbs_out == false)
this.slide(406);
else if (Stage["displayState"] == "normal" && thumbs_out == true)
this.slide(299);
if (Stage["displayState"] == "fullScreen" && thumbs_out == false)
this._y = Math.round (Stage.height - 0);
else if (Stage["displayState"] == "fullScreen" && thumbs_out == true)
this._y = Math.round (Stage.height - 133);
// Playlist button
controls_mc.playlist_mc.onRollOver = function ()
this.gotoAndStop("playlistOver");
controls_mc.playlist_mc.onRollOut = controls_mc.playlist_mc.onReleaseOutside = function ()
this.gotoAndStop("playlist");
// Toggle playlist button
controls_mc.playlist_mc.onRelease = function ()
if (thumbs_out == false)
thumbs_out = true;
title_out = true;
else if (thumbs_out == true)
thumbs_out = false;
title_out = false;
} // end if else
// Define hit area for playPause button
vid.onPress = controls_mc.playPause.onRelease = function ()
ns.pause();
if (playStatus == 1)
controls_mc.playPause.gotoAndStop("play")
playStatus = 0;
checkStatus();
else if (playStatus == 0)
controls_mc.playPause.gotoAndStop("pause");
playStatus = 1;
checkStatus();
// playPause button
controls_mc.playPause.onRollOver = function ()
if (playStatus == 1)
this.gotoAndStop("pauseOver");
else
this.gotoAndStop("playOver");
} // end else if
controls_mc.playPause.onRollOut = controls_mc.playPause.onReleaseOutside = function ()
if (playStatus == 1)
this.gotoAndStop("pause");
else
this.gotoAndStop("play");
} // end else if
// Toggle playPause button
controls_mc.playPause.onRelease = function ()
ns.pause();
if (playStatus == 1)
this.gotoAndStop("play");
playStatus = 0;
checkStatus();
else if (playStatus == 0)
this.gotoAndStop("pause");
playStatus = 1;
checkStatus();
controls_mc.skip_mc.onRollOver = function ()
this.gotoAndStop("skipOver");
controls_mc.skip_mc.onRollOut = controls_mc.skip_mc.onReleaseOutside = function ()
this.gotoAndStop("skip");
controls_mc.skip_mc.onRelease = function ()
_parent.nextVideo()
// Play Again button
mc_playAgain.onRollOver = function ()
this.gotoAndStop("playAgainOver");
mc_playAgain.onRollOut = mc_playAgain.onReleaseOutside = function ()
this.gotoAndStop("playAgain");
// Toggle Play Again button
mc_playAgain.onRelease = function ()
this._visible = false;
ns.pause();
playStatus = 1;
checkStatus();
// make the seek bar clickable
controls_mc.mc_progress.mc_buff.onPress = function()
xpos = controls_mc.mc_progress._xmouse;
percent = Math.round(xpos/controls_mc.mc_progress._width*100);
seekTime = percent/100*FLVduration;
seekTime = Math.round(seekTime*100)/100;
ns.seek(seekTime);
// Set volume level
var s:Sound = new Sound();
s.setVolume(_root.volume_value);
controls_mc.mc_soundLevel.mc_volume._xscale = _root.volume_value;
// Volume control
controls_mc.mc_soundLevel.onPress = function()
volumeTo = (this._xmouse / this._width)*100;
this.mc_volume._xscale = volumeTo;
s.setVolume(volumeTo);
// Volume
_parent.createEmptyMovieClip("vSound", _parent.getNextHighestDepth());
vSound.attachAudio(ns);
var so = new Sound(vSound);
so.setVolume(_root.volume_value);
// Mute button
controls_mc.mute_mc.onRollOver = function ()
if (so.getVolume() >= 1)
this.gotoAndStop("onOver");
else
this.gotoAndStop("muteOver");
} // end else if
controls_mc.mute_mc.onRollOut = controls_mc.mute_mc.onReleaseOutside = function ()
if (so.getVolume() >= 1)
this.gotoAndStop("on");
else
this.gotoAndStop("mute");
} // end else if
// Toggle mute button
controls_mc.mute_mc.onRelease = function ()
if (so.getVolume() >= 1)
controls_mc.mc_soundLevel.mc_volume._xscale = 0;
so.setVolume(0);
this.gotoAndStop("muteOver");
else
controls_mc.mc_soundLevel.mc_volume._xscale = 70;
so.setVolume(_root.volume_value);
this.gotoAndStop("onOver");
} // end else if
// Resize video proportionaly
function regularSize ()
videoObj._width = 600;
videoObj._height = videoObj._width * relationshipW;
if (videoObj._height > 360)
videoObj._height = 360;
videoObj._width = videoObj._height * relationshipH;
videoObj.smoothing = true;
//var scale:Number;
videoObj._x = (600 - videoObj._width) / 2;
videoObj._y = (360 - videoObj._height) / 2;
function largeSize ()
videoObj._width = Stage.width;
videoObj._height = videoObj._width * relationshipW;
if (videoObj._height > Stage.height)
videoObj._height = Stage.height;
videoObj._width = videoObj._height * relationshipH;
videoObj.smoothing = true;
//var scale:Number;
videoObj._x = (Stage.width - videoObj._width) / 2;
videoObj._y = (Stage.height - videoObj._height) / 2;
// Fullscreen button
controls_mc.fullscreen_mc.onRollOver = function ()
if (Stage["displayState"] == "normal")
this.gotoAndStop("fullOver");
else
this.gotoAndStop("fullCloseOver");
} // end else if
controls_mc.fullscreen_mc.onRollOut = controls_mc.fullscreen_mc.onReleaseOutside = function ()
if (Stage["displayState"] == "normal")
this.gotoAndStop("full");
else
this.gotoAndStop("fullClose");
} // end else if
// Toggle fullscreen button
controls_mc.fullscreen_mc.onRelease = function ()
if (Stage["displayState"] == "normal")
Stage["displayState"] = "fullscreen";
_parent.video_txt.theText._visible = false;
else
Stage["displayState"] = "normal";
_parent.video_txt.theText._visible = true;if you mean sound works well when the gallery is tested without being loaded into another swf but fails when loaded, change the highlighted line:
// Import filter classes
import mx.transitions.Tween;
import mx.transitions.easing.*;
// Set flash variables
var xmlFileUrl:String = "playlist.xml";
var auto_play:String = "true";
// Set xml file URL
if (_root.xmlfile) {
xmlFileUrl = _root.xmlfile;
var V_SRC;
var thuArray:Array = new Array();
var currentVideo:Number = 0;
var totalItems;
var numOfItems:Number;
var itemDistance:Number = 120+5;
var itemHeight:Number = 80+2;
var Value:Number = 1;
var boundry:Number = 1;
var ratio:Number = 1;
var diff:Number = 1;
var collectionWidth:Number = 1;
var buffer:Number = 135*2;
this.createEmptyMovieClip("video_txt",this.getNextHighestDepth());
video_txt.createTextField("theText",video_txt.getNextHighestDepth(),0,0,584,36);
video_txt.theText.selectable = false;
video_txt.theText.autoSize = "left";
//The Format
myFormat = new TextFormat();
myFormat.font = _root.font_format;
myFormat.size = _root.font_size;
myFormat.color = _root.font_color;
myFormat.align = "center";
video_txt.theText.setNewTextFormat(myFormat);
// Create a new movieclip to load the thumbs
var thumbLoader:MovieClipLoader = new MovieClipLoader();
var thumbListener:Object = new Object();
thumbLoader.addListener(thumbListener);
thumbListener.onLoadInit = function(target_mc:MovieClip, httpStatus:Number)
new Tween(target_mc, "_alpha", Regular.easeOut, 0, 100, 1, true);
target_mc._parent.preloader_mc._alpha = 0;
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = xmlLoaded;
xml.load(xmlFileUrl);
// Load the xml file into the player
function xmlLoaded(b:Boolean) {
if (b) {
auto_play = this.firstChild.firstChild.attributes.auto_play;
scrollSpeed = parseInt(this.firstChild.firstChild.attributes.scrollSpeed);
totalItems = this.firstChild.firstChild.childNodes;
numOfItems = totalItems.length;
for (j=0; j<numOfItems; j++) {
var i = player_mc.main_mc.collection_mc.attachMovie("mc_Thumb", "thumb_"+j, j);
i._x = itemDistance*j;
thumbLoader.loadClip(totalItems[j].attributes.thumb,i.loader_mc);
i.id = j;
i.videoTitle = totalItems[j].attributes.title;
i.videoUrl = totalItems[j].attributes.src;
// Create an event for thumb rollover
i.onRollOver = iRoll;
i.onRollOut = i.onReleaseOutside=iOut;
i.onRelease = iRelease;
thuArray[j] = i;
// default first video
collectionWidth = player_mc.main_mc.collection_mc._width;
currentVideo = 0;
V_SRC = thuArray[0].videoUrl;
changeVideo();
//scope._alpha = 100;
new Tween(scope, "_alpha", Regular.easeOut, 0, 100, 0.5, true);
else
trace("Error! xml file not loaded");
// onRollOver Events
function iRoll() {
player_mc.mc_title.title_txt.htmlText = totalItems[this.id].attributes.title;
this.light_mc.play();
function iRelease() {
currentVideo = this.id;
changeVideo();
function changeVideo() {
V_SRC = thuArray[currentVideo].videoUrl;
player_mc.loadVideo();
currentThumb();
player_mc.mc_title.title_txt.htmlText = thuArray[currentVideo].videoTitle;
video_txt.theText.text = totalItems[currentVideo].attributes.title;
player_mc.so.getVolume();
player_mc.playStatus = 1;
player_mc.checkStatus();
function nextVideo() {
if (currentVideo<(numOfItems-1)) {
currentVideo++;
} else {
currentVideo = 0;
changeVideo();
function currentThumb() {
for (i=0; i<thuArray.length; i++) {
if (i == currentVideo) {
thuArray[i].enabled = true;
// Mouse movement on rollover
this.onMouseMove = function() {
collectionWidth = player_mc.main_mc.collection_mc._width;
boundry = player_mc.main_mc.area_mc._width;
if ((player_mc.main_mc._ymouse>0) && (player_mc.main_mc._ymouse<itemHeight)) {
if ((player_mc.main_mc._xmouse>0) && (player_mc.main_mc._xmouse<boundry)) {
ratio = player_mc.main_mc._xmouse/boundry;
diff = (collectionWidth-boundry)+buffer;
Value = Math.floor((-ratio)*diff)+(buffer/2);
updateAfterEvent();
this.onEnterFrame = function() {
// Define movement area and speed
if (player_mc.main_mc.collection_mc._width>player_mc.main_mc.area_mc._width) {
player_mc.main_mc.collection_mc._x = Math.round((player_mc.main_mc.collection_mc._x)+((Value-player_mc.main_mc.colle ction_mc._x)/scrollSpeed));
if (player_mc.main_mc.collection_mc._x>0) {
player_mc.main_mc.collection_mc._x = 0;
} else if (player_mc.main_mc.collection_mc._x<(player_mc.main_mc.area_mc._width-(player_m c.main_mc.collection_mc._width))) {
player_mc.main_mc.collection_mc._x = Math.round(player_mc.main_mc.area_mc._width-(player_mc.main_mc.collection_mc._w idth));
} else {
player_mc.main_mc.collection_mc._x = 0;
updateAfterEvent();
part two:
// Define flash variables
var video_url:String = "";
var tempx:Number = this._parent._x;
var tempy:Number = this._parent._y;
var timeCounter:Number = 0;
var timeInSeconds:Number = _root.time_counter;
// Object to listen to onStage Event
videoObj = vid.videoObj;
// Setting up the connection
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
// Buffer time
ns.setBufferTime (10);
videoObj.attachVideo (ns);
function loadVideo () {
video_url = _parent.V_SRC;
trace(video_url);
ns.play (video_url);
function checkStatus()
if (playStatus == 1)
controls_mc.playPause.gotoAndStop("pause");
mc_playAgain._visible = false;
thumbs_out = false;
title_out = false;
else
controls_mc.playPause.gotoAndStop("play");
mc_playAgain._visible = true;
} // end else if
if (so.getVolume() == 0)
controls_mc.mute_mc.gotoAndStop("mute");
else
controls_mc.mute_mc.gotoAndStop("on");
}; // End of the function
mc_playAgain._visible = false;
// Check Status of video
ns.onStatus = function (info)
if (info.code == "NetStream.Buffer.Empty")
mc_buffer._visible = true;
else if (info.code == "NetStream.Buffer.Full")
mc_buffer._visible = false;
else if (info.code == "NetStream.Play.Stop")
ns.seek(0);
if (playStatus == 1)
ns.pause();
playStatus = 0;
else
trace;
} // end else if
mc_playAgain._visible = true;
mc_buffer._visible = false;
thumbs_out = true;
title_out = true;
checkStatus();
} // end else if
// Get info about video
ns.onMetaData = function(infoObject:Object)
FLVduration = infoObject["duration"];
relationshipW = infoObject.height / infoObject.width;
relationshipH = infoObject.width / infoObject.height;
if (Stage["displayState"] == "fullScreen")
largeSize ();
else
regularSize ();
if (_parent.auto_play == "false")
ns.seek(0);
if (playStatus == 1)
ns.pause();
playStatus = 0;
mc_buffer._visible = false;
controls_mc.playPause.gotoAndStop("play");
mc_playAgain._visible = true;
thumbs_out = true;
title_out = true;
_parent.auto_play = "true";
}// end else if
var videoInterval = setInterval(videoStatus, 100);
var amountLoaded;
var duration;
// videoStatus on load Event
function videoStatus()
amountLoaded = ns.bytesLoaded / ns.bytesTotal;
controls_mc.mc_progress.mc_buff._width = amountLoaded * 250;
controls_mc.mc_progress.mc_played._x = ns.time / duration * 250;
controls_mc.mc_progress.mc_played._xscale = Math.round(ns.time*100/FLVduration);
}; // End of the function
function scrubIt()
ns.seek(Math.floor(controls_mc.mc_progress.mc_played._x / 250 * duration));
}; // End of the function
// video time
var time_interval:Number = setInterval(checkTime, 500, ns);
function checkTime(ns:NetStream) {
//current time
var ns_seconds:Number = ns.time;
var minutes:Number = Math.floor(ns_seconds/60);
var seconds = Math.floor(ns_seconds%60);
sec = seconds;
min = minutes;
if (sec<10) {
sec = "0"+sec;
if (min<10) {
min = "0"+min;
controls_mc.time_txt.time_1.text = min+":"+sec;
//total time
var minutes2:Number = Math.floor(FLVduration/60);
var seconds2 = Math.floor(FLVduration%60);
sec2 = seconds2;
min2 = minutes2;
if (sec2<10) {
sec2 = "0"+sec2;
if (min2<10) {
min2 = "0"+min2;
controls_mc.time_txt.time_2.text = min2+":"+sec2;
if (controls_mc.time_txt.time_2.text == "NaN:NaN") {
controls_mc.time_txt.time_2.text = "00:00";
setStage ();
// Object to listen onStage Event
var stageL:Object = new Object ();
// function respnsible for content alignment
function setStage ()
if (Stage["displayState"] == "fullScreen") {
tempx = this._parent._x;
tempy = this._parent._y;
this._parent._x = 0;
this._parent._y = 0;
vidBg_mc._x = 0;
vidBg_mc._y = 0;
mc_title._x = 0;
mc_title._y = -30;
slide_me._x = 0;
slide_me._y = 0;
vidBg_mc._width = Stage.width;
vidBg_mc._height = Stage.height;
mc_title._width = Stage.width;
mc_title._height = Stage.height / 20;
slide_me._width = Stage.width;
slide_me._height = Stage.height / 20;
vid._x = vid._y = 0;
largeSize ();
controls_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));
controls_mc._y = Math.round (Stage.height - 36);
mc_playAgain._x = Math.round ((Stage.width / 2) - (mc_playAgain._width / 2));
mc_playAgain._y = Math.round (Stage.height - 572);
thumbs_mc._x = Math.round ((Stage.width / 2) - (thumbs_mc._width / 2));
thumbs_mc._y = Math.round (Stage.height - 115);
main_mc._x = Math.round ((Stage.width / 2) - (controls_mc._width / 2));;
hide_mc.onEnterFrame = function () {
timeCounter = timeCounter + 1;
if (timeCounter >= timeInSeconds * 30) {
timeCounter = 0;
controls_mc._alpha = 0;
this.onMouseMove = function () {
timeCounter = 0;
controls_mc._alpha = 100;
else
delete hide_mc.onEnterFrame;
delete this.onMouseMove;
controls_mc._alpha = 100;
this._parent._x = tempx;
this._parent._y = tempy;
vidBg_mc._width = 600;
vidBg_mc._height = 360;
mc_title._width = 600;
mc_title._height = 30;
slide_me._width = 600;
slide_me._height = 30;
vidBg_mc._x = vid._x = 0;
vidBg_mc._y = vid._y = 35;
mc_title._x = vid._x = 0;
mc_title._y = vid._x = -30;
slide_me._x = vid._x = 0;
slide_me._y = vid._y = 35;
regularSize ();
controls_mc._x = 0;
controls_mc._y = 395;
mc_playAgain._x = 243;
mc_playAgain._y = 158;
thumbs_mc._x = 0;
thumbs_mc._y = 316;
main_mc._x = 0;
main_mc._y = 406;
mc_buffer._x = Math.round (vidBg_mc._x + (vidBg_mc._width / 2));
mc_buffer._y = Math.round (vidBg_mc._y + (vidBg_mc._height / 2));
// to apply when stage (browser window) is resized or modified
stageL.onResize = function () {
setStage ();
// attaching object to the stage
Stage.addListener (stageL);
MovieClip.prototype.slide = function(yPos) {
this._y -= (this._y-yPos)/5;
// tilte actions
mc_title.onEnterFrame = function()
if (Stage["displayState"] == "normal" && title_out == false)
this.slide(5);
else if (Stage["displayState"] == "normal" && title_out == true)
this.slide(35);
if (Stage["displayState"] == "fullScreen" && title_out == false)
this._y -= (this._y+106)/5;
else if (Stage["displayState"] == "fullScreen" && title_out == true)
this.slide(0);
// thumbs actions
main_mc.onEnterFrame = function()
if (Stage["displayState"] == "normal" && thumbs_out == false)
this.slide(406);
else if (Stage["displayState"] == "normal" && thumbs_out == true)
this.slide(299);
if (Stage["displayState"] == "fullScreen" && thumbs_out == false)
this._y = Math.round (Stage.height - 0);
else if (Stage["displayState"] == "fullScreen" && thumbs_out == true)
this._y = Math.round (Stage.height - 133);
// Playlist button
controls_mc.playlist_mc.onRollOver = function ()
this.gotoAndStop("playlistOver");
controls_mc.playlist_mc.onRollOut = controls_mc.playlist_mc.onReleaseOutside = function ()
this.gotoAndStop("playlist");
// Toggle playlist button
controls_mc.playlist_mc.onRelease = function ()
if (thumbs_out == false)
thumbs_out = true;
title_out = true;
else if (thumbs_out == true)
thumbs_out = false;
title_out = false;
} // end if else
// Define hit area for playPause button
vid.onPress = controls_mc.playPause.onRelease = function ()
ns.pause();
if (playStatus == 1)
controls_mc.playPause.gotoAndStop("play")
playStatus = 0;
checkStatus();
else if (playStatus == 0)
controls_mc.playPause.gotoAndStop("pause");
playStatus = 1;
checkStatus();
// playPause button
controls_mc.playPause.onRollOver = function ()
if (playStatus == 1)
this.gotoAndStop("pauseOver");
else
this.gotoAndStop("playOver");
} // end else if
controls_mc.playPause.onRollOut = controls_mc.playPause.onReleaseOutside = function ()
if (playStatus == 1)
this.gotoAndStop("pause");
else
this.gotoAndStop("play");
} // end else if
// Toggle playPause button
controls_mc.playPause.onRelease = function ()
ns.pause();
if (playStatus == 1)
this.gotoAndStop("play");
playStatus = 0;
checkStatus();
else if (playStatus == 0)
this.gotoAndStop("pause");
playStatus = 1;
checkStatus();
controls_mc.skip_mc.onRollOver = function ()
this.gotoAndStop("skipOver");
controls_mc.skip_mc.onRollOut = controls_mc.skip_mc.onReleaseOutside = function ()
this.gotoAndStop("skip");
controls_mc.skip_mc.onRelease = function ()
_parent.nextVideo()
// Play Again button
mc_playAgain.onRollOver = function ()
this.gotoAndStop("playAgainOver");
mc_playAgain.onRollOut = mc_playAgain.onReleaseOutside = function ()
this.gotoAndStop("playAgain");
// Toggle Play Again button
mc_playAgain.onRelease = function ()
this._visible = false;
ns.pause();
playStatus = 1;
checkStatus();
// make the seek bar clickable
controls_mc.mc_progress.mc_buff.onPress = function()
xpos = controls_mc.mc_progress._xmouse;
percent = Math.round(xpos/controls_mc.mc_progress._width*100);
seekTime = percent/100*FLVduration;
seekTime = Math.round(seekTime*100)/100;
ns.seek(seekTime);
// Set volume level
var s:Sound = new Sound(this);
s.setVolume(_root.volume_value);
controls_mc.mc_soundLevel.mc_volume._xscale = _root.volume_value;
// Volume control
controls_mc.mc_soundLevel.onPress = function()
volumeTo = (this._xmouse / this._width)*100;
this.mc_volume._xscale = volumeTo;
s.setVolume(volumeTo);
// Volume
_parent.createEmptyMovieClip("vSound", _parent.getNextHighestDepth());
vSound.attachAudio(ns);
var so = new Sound(vSound);
so.setVolume(_root.volume_value);
// Mute button
controls_mc.mute_mc.onRollOver = function ()
if (so.getVolume() >= 1)
this.gotoAndStop("onOver");
else
this.gotoAndStop("muteOver");
} // end else if
controls_mc.mute_mc.onRollOut = controls_mc.mute_mc.onReleaseOutside = function ()
if (so.getVolume() >= 1)
this.gotoAndStop("on");
else
this.gotoAndStop("mute");
} // end else if
// Toggle mute button
controls_mc.mute_mc.onRelease = function ()
if (so.getVolume() >= 1)
controls_mc.mc_soundLevel.mc_volume._xscale = 0;
so.setVolume(0);
this.gotoAndStop("muteOver");
else
controls_mc.mc_soundLevel.mc_volume._xscale = 70;
so.setVolume(_root.volume_value);
this.gotoAndStop("onOver");
} // end else if
// Resize video proportionaly
function regularSize ()
videoObj._width = 600;
videoObj._height = videoObj._width * relationshipW;
if (videoObj._height > 360)
videoObj._height = 360;
videoObj._width = videoObj._height * relationshipH;
videoObj.smoothing = true;
//var scale:Number;
videoObj._x = (600 - videoObj._width) / 2;
videoObj._y = (360 - videoObj._height) / 2;
function largeSize ()
videoObj._width = Stage.width;
videoObj._height = videoObj._width * relationshipW;
if (videoObj._height > Stage.height)
videoObj._height = Stage.height;
videoObj._width = videoObj._height * relationshipH;
videoObj.smoothing = true;
//var scale:Number;
videoObj._x = (Stage.width - videoObj._width) / 2;
videoObj._y = (Stage.height - videoObj._height) / 2;
// Fullscreen button
controls_mc.fullscreen_mc.onRollOver = function ()
if (Stage["displayState"] == "normal")
this.gotoAndStop("fullOver");
else
this.gotoAndStop("fullCloseOver");
} // end else if
controls_mc.fullscreen_mc.onRollOut = controls_mc.fullscreen_mc.onReleaseOutside = function ()
if (Stage["displayState"] == "normal")
this.gotoAndStop("full");
else
this.gotoAndStop("fullClose");
} // end else if
// Toggle fullscreen button
controls_mc.fullscreen_mc.onRelease = function ()
if (Stage["displayState"] == "normal")
Stage["displayState"] = "fullscreen";
_parent.video_txt.theText._visible = false;
else
Stage["displayState"] = "normal";
_parent.video_txt.theText._visible = true;
Maybe you are looking for
-
Benifits of XSLT Mapping.
Hi Experts, Benfits of XSLT Mapping and when it is used.
-
Vietnamese font for Premiere CS6
Hi all! I think it is quite normal question but unfortunately I have not been able to find answer. Basically, I would like to have Vietnamese title for my video. I search through Internet and it seems I need to have Unicode font (VNI) available in th
-
Create a PDF of each state of my MSO
To facilitate the corrections on the client's side, I would like to create a PDF of each state of my MSO. But ... in some states, I have a scrollable frame. How can I make the text from the scrollable frame appear in the pdf? I started to write an Ap
-
Clearview reader highlight save used on 2 macs
i have a NAS i save all my files on and i have some epubs saved there. i was on my mac laptop and highlighted some text and when i went to my other mac the text is not highlighted. can someone help. ive tried using the epub file on my macbook then co
-
Lost ibooks icon on iphone5S-IOS8.1.3
I have lost ibooks icon on my iphone 5S-IOS8.1.3. I have tried to redownload from app store but it does not work. Please help me to retrieve the ibooks icon on my iphone screen. Thank you