first of all, I'm using Flash CS4, and Actionscript2.0. Here's the website : rvr3d.pcriot.com
There are just 2 parts that are working right now, the "stills" section, and the "SMC" section. I'm currently working on the "animation" section.
I try to use the same template as for the other two working sections, except that i'm now showing FLV files, not images.
In my XML file, i have this
I'm using the name in the "image" tag to find both the thumbnails (anim01.jpg), and the animation (anim01.flv). The only difference is the folder where flash is going to look at them.
Now the problem :
The thumbnails are loading correctly, but not the videos. In this case, i have 3 "piece" tags, the displayed FLV is always the last one (anim03.flv in this case). It worked well with images in the other sections of my website, but not here anymore, so i might have made something wrong in my actionscript.
For the images in the working sections, i used this code, and it works fine :
note : the trace i put after the button's onrelease function works well right now !
Now, the same wit the FLV's instead of the Images :
When I trace the flv, i always get the one of the last piece of my XML file, in this example it's anim03.flv
Why does it work with images, but not with FLV's ?
I think i must have done something wrong in my code, but what ?
It's the very last error i have on my website, i've tried to get some help on "actionscript.org", but no one could help me.
Any hint, solution or other helpfull advise will be very much appreciated
Cheers,
rvr
There are just 2 parts that are working right now, the "stills" section, and the "SMC" section. I'm currently working on the "animation" section.
I try to use the same template as for the other two working sections, except that i'm now showing FLV files, not images.
In my XML file, i have this
HTML:
<?xml version="1.0" encoding="utf-8"?>
<gallery heading="SMC">
<piece>
<heading>title01</heading>
<desc>description01</desc>
<image>anim01</image>
</piece>
<piece>
<heading>title02</heading>
<desc>description02</desc>
<image>anim02</image>
</piece>
<piece>
<heading>title03</heading>
<desc>description03</desc>
<image>anim03</image>
</piece>
</gallery>
Now the problem :
The thumbnails are loading correctly, but not the videos. In this case, i have 3 "piece" tags, the displayed FLV is always the last one (anim03.flv in this case). It worked well with images in the other sections of my website, but not here anymore, so i might have made something wrong in my actionscript.
For the images in the working sections, i used this code, and it works fine :
Code:
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(ok) {
if (ok) {
allGalleryData = this.firstChild.childNodes;
for (i=0; i<allGalleryData.length; i++) {
// ----> this is the part that i'm going to change for the FLV's to display instead of the images
newPiece = sliderHolder_mc.slider_mc.attachMovie('template', 'piece'+i, i);
newPiece._x = i*newPiece._width;
newPiece.heading_txt.text = allGalleryData[i].firstChild.firstChild;
newPiece.desc_txt.text = allGalleryData[i].firstChild.nextSibling.firstChild;
newPiece.load_btn.imageName = allGalleryData[i].firstChild.nextSibling.nextSibling.firstChild;
newPiece.holder_mc.loadMovie('thumbs/'+newPiece.load_btn.imageName);
newPiece.load_btn.onRelease = function() {
loadNewImage('images/'+this.imageName);
globalContent_mc._visible=false;
trace('images/'+this.imageName);
// ----> end of the part i'm changing for the FLV's to load
};
newBut = attachMovie('numTemplate', 'num'+i, i);
newBut._y = -2;
newBut._x = (i*27)+sliderHolder_mc._x;
newBut.myNum = i;
newBut.num_txt.text = i+1;
newBut.onRelease = function() {
targX = 0-(this.myNum*133);
};
}
targX = 0;
sliderHolder_mc.slider_mc.onEnterFrame = function() {
this._x -= (this._x-targX)/5;
};
} else {
trace('what file?');
}
};
myXML.load('xml/Stills.xml');
note : the trace i put after the button's onrelease function works well right now !
Now, the same wit the FLV's instead of the Images :
Code:
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(ok) {
if (ok) {
allGalleryData = this.firstChild.childNodes;
for (i=0; i<allGalleryData.length; i++) {
newPiece = sliderHolder_mc.slider_mc.attachMovie('template', 'piece'+i, i);
newPiece._x = i*newPiece._width;
newPiece.heading_txt.text = allGalleryData[i].firstChild.firstChild;
newPiece.desc_txt.text = allGalleryData[i].firstChild.nextSibling.firstChild;
newPiece.load_btn.imageName = allGalleryData[i].firstChild.nextSibling.nextSibling.firstChild;
newPiece.holder_mc.loadMovie('thumbs/'+newPiece.load_btn.imageName+'.jpg');
// -----> here i introduce the variable that allows me to load FLV's
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
// -----> theVideo is the instance name of a New Video container from the library
theVideo.attachVideo(ns);
// -----> from now on, flash will always consider that i = last piece of my XML file ! ... but why ?
newPiece.load_btn.onRelease = function() {
ns.play('animation/'+newPiece.load_btn.imageName+'.flv');
globalContent_mc._visible=false;
trace('animation/'+newPiece.load_btn.imageName+'.flv');
};
// ------> the rest has not changed, so i did not copied it again
When I trace the flv, i always get the one of the last piece of my XML file, in this example it's anim03.flv
Why does it work with images, but not with FLV's ?
I think i must have done something wrong in my code, but what ?
It's the very last error i have on my website, i've tried to get some help on "actionscript.org", but no one could help me.
Any hint, solution or other helpfull advise will be very much appreciated
Cheers,
rvr