I you call your php page directly from your browser does it return the
desired XML file? And with your ID parameter?
A+
Sibrand Hoekstra wrote:
Hello list,
First off, hi all. I subscribed to this list yesterday and ive seen
alot of good posts already, so there's little doubt that anyone can
help me out ;)
A little introduction:
Since a few weeks i'm hired at an Internet Development company in
town, and my job is primarily xhtml/css development.
Yet, the very first project I am doing requires a jpg-viewer flash
app. Last week ive been studying books, and code of friends to build
what i am building right now, and one of the final steps has got me
stuck.
so, here we are:
[actionscript is in the bottom of this email]
I am making a flash movie that loads 10 jpeg files from a xml feed,
generated by a phpfile.
Its purpose is to act as a carrousel that loops the jpegs over the
screen.
The feed shows the last 10 uploaded jpegs if no parameters are set. If
you pass it a parameter called PictureID, it'll give you the jpeg
with the given ID plus the 9 jpegs uploaded prior to that.
(ie. feed.php?PictureID=20)
i am having php echo the given PictureID to html as in this:
<params name="flashvars" value="PictureID=20">
in the actionscript i am retrieving that with _root.PictureID.
Next step is to load the 10 jpegs that come before(10-1) the
curently(20-11) loaded jpegs.
And here i am having trouble, please checkout the function attached to
the button, in the bottom of the script.
First i'm emptying the arrays and unloading currently loaded jpegs.
I then want to reset the PictureID to 10 lower than the current value
and 'start all over again' with the new range of jpegs.
Except, at 'loadXML' nothing happens.
So can anyone please help me, or give any insights on how this should
be solved?
[p.s. i could also do a getURL() to the page itself and pass the
feed.php a new parameter, but we dont want to make it look smooth.. ]
Many thanks in advance,
Sibrand Hoekstra
----------------------------------------------------------------------------------------------------------------------------------------
var speed:Number = 1.5;
var picSpace:Number = 120;
var xmlfeed:String = 'feed.php';
var picturePath:String = 'path/to/picturefolders/;
var picHeight = 90;
var picWidth = 108;
if(_root.PictureID){
xmlfeed = xmlfeed + '?PictureID=' + _root.PictureID;
}
var currentPic = -1;
var xml:XML = new XML();
var pictures:Array = new Array();
var picFileNames:Array = new Array();
var picIds:Array = new Array();
function pictureScroll() {
for (i in pictures) {
pictures[i]._x += speed;
if (pictures[i]._x-1>((pictures.length-1)*picSpace)) {
pictures[i]._x -= ((pictures.length)*picSpace);
}
if (pictures[i]._x > 260 and pictures[i]._x < 360 and
currentPic!=i) {
currentPic = i; var listener:Object = new
Object();
var mcLoader = new MovieClipLoader();
listener.onLoadInit = middlePicLoaded;
mcLoader.addListener(listener);
mcLoader.loadClip(picFileNames[i],
_root.middlePicture_mc.middlePic_mc); }
}
}
function loadXML() {
xml.load(xmlfeed);
xmlObj.ignoreWhite = true;
xml.onLoad = xmlLoaded;
}
function picLoaded(mc) {
mc._width = picWidth;
mc._height = picHeight;
}
function middlePicLoaded(mc) {
mc._width = 196;
mc._height = 153;
}
function xmlLoaded(success:Boolean) {
import mx.xpath.XPathAPI;
if (success) { nodes =
XPathAPI.selectNodeList(xml.lastChild,
'feed/picture/file/*'); ids =
XPathAPI.selectNodeList(xml.lastChild, 'feed/picture/id/*');
for (i in nodes) {
var listener:Object = new Object();
listener.onLoadInit = picLoaded; var
mcLoader = new MovieClipLoader();
mcLoader.addListener(listener);
newPic =
pictureScrollContainer.picture_mc.duplicateMovieClip('node'+i,
pictureScrollContainer.getNextHighestDepth());
mcLoader.loadClip(picturePath + nodes[i].toString(), newPic);
newPic._alpha = 100;
id = pictures.push(newPic);
picFileNames.push(picturePath +
nodes[i].toString()); newPic._x = id * picSpace;
}
_root.onEnterFrame = pictureScroll; }
}
pictureScrollContainer.picture_mc._alpha = 0;
loadXML();
_root.prev_btn.onRelease = function(){
_level0.pictureScrollContainer.unloadMovie();
_level0.middlePicture_mc.unloadMovie();
for(i in pictures){
pictures.shift(); picFileNames.shift();
}
trace(_root.PictureID);
set("_root.PictureID", (_root.PictureID - 10));
trace(_root.PictureID);
loadXML();
trace('hmm');
}
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
--
===============================================================
Éric Thibault
Programmeur analyste
Réseau de valorisation de l'enseignement
Université Laval, pavillon Félix-Antoine Savard
Québec, Canada
Tel.: 656-2131 poste 18015
Courriel : [EMAIL PROTECTED]
===============================================================
Avis relatif à la confidentialité / Notice of Confidentiality / Advertencia de
confidencialidad <http://www.rec.ulaval.ca/lce/securite/confidentialite.htm>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com