Volledige versie bekijken : foto script, wat is hier verkeerd aan???
thebeatman
%Europe/Berlin %415 %2005, 10:58
Hoi,
Ik heb op gotoandlearn.com een .fla bestand gedownload van een slideshow. Ik gebruik Flash MX version 6.0 en als ik het .fla bestand wil openen zegt hij "Unexpected file format". Dus had ik besloten de code over te type van het filmpje op de site. Nu heb ik dat gedaan maar doet hij het niet :( Weten jullie wat er fout is aan deze code?
var x:XML = new XML();
x.ignoreWhite = true;
var urls:Array = new Array();
var captions:Array = new Array();
var whoIsOn:Number;
x.onLoad = function() {
var photos:Array = this.firstChild.ChildNodes;
for(i=0;i<photos.length;+++) {
urls.push(photos[i].attributes.url);
captions.push(photos[i].attributes.caption);
}
holder.loadMovie(urls[0]);
caption.text = captions[0];
whoIsOn = 0;
}
x.load("lost.xml");
previous.onRelease = function() {
if(whoIsOn > 0) {
whoIsOn--;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
}
}
next.onRelease = function() {
if(whoIsOn < urls.length-1) {
whoIsOn++;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
}
}
Alvast bedankt!
Groeten,
TheBeatMan
pulletje
%Europe/Berlin %438 %2005, 11:30
x.onLoad = function() {
var photos:Array = this.firstChild.ChildNodes;
for(i=0;i<photos.length;+++) {
urls.push(photos[i].attributes.url);
captions.push(photos[i].attributes.caption);
}
dit zou moeten zijn:
x.onLoad = function() {
var photos:Array = this.firstChild.ChildNodes;
for(i=0;i<photos.length;i++) { //de plus hoort een i te zijn, waarom? zolang i //kleiner is als photos moet er 1 opgeteld worden bij i dus i++
urls.push(photos[i].attributes.url);
captions.push(photos[i].attributes.caption);
}
rackdoll
%Europe/Berlin %472 %2005, 12:20
wat ik niet zie is waar de xml vandaan geladen wordt..
pulletje
%Europe/Berlin %475 %2005, 12:24
wat ik niet zie is waar de xml vandaan geladen wordt..
var x:XML = new XML();
...
..
.
x.load("lost.xml");
daar word ie gehaald. hij zal dan wel in dezelfde directory moetens staan als de swf ;)
thebeatman
%Europe/Berlin %481 %2005, 12:33
Bedankt een deel werkt nu al! Alleen als ik de flash movie nu open. Dat laad hij de foto's niet in:S Dit is mijn XML bestand.
<?xml version="1.0" encoding="ISO-8859-1"?>
<slideshow>
<photo url="foto1.JPG" caption="Dj Rob" />
<photo url="foto2.JPG" caption="D-Vinity" />
<photo url="foto3.JPG" caption="Dj Ronald" />
</slideshow>
Weet iemand of hier wat fout aan is?
Groeten,
TheBeatMan
denzione
%Europe/Berlin %482 %2005, 12:35
check even of je jpg's niet progressief zijn opgeslagen, dit kan flash namelijk niet aan. Vaak ga je al het script uit zitten pluizen terwijl dat het probleem is.
groeten,
Denzione
thebeatman
%Europe/Berlin %483 %2005, 12:36
Sorry maar wat is progressief opgeslagen :$ Schaam schaam...
pulletje
%Europe/Berlin %488 %2005, 12:43
ik denk dat het in dit geval aan het script zal liggen dus:
check het volgende even:
1. heb je xml script 'lost.xml' genoemd. indien dit niet zo is moet je in de as van je flash ook lost.xml veranderen naar je nieuwe *.xml
2. heb je je xml file, je swf file en je foto's in een map zitten? zoniet --> doen!
Gerrit55
%Europe/Berlin %491 %2005, 12:48
je moet alle typecasting weghalen, dit werkt niet in Flash MX, dus alles (incl) de dubbele punt
dus bv. bij :
var urls:Array = new Array();
het deel :Array weghalen, wordt dus
var urls = new Array();
thebeatman
%Europe/Berlin %494 %2005, 12:51
Oké, nu is dit mijn script. maar hij werkt nog steeds niet....
var x:XML = new XML();
x.ignoreWhite = true;
var urls = new Array();
var captions = new Array();
var whoIsOn:Number;
x.onLoad = function() {
var photos = this.firstChild.ChildNodes;
for(i=0;i<photos.length;i++) {
urls.push(photos[i].attributes.url);
captions.push(photos[i].attributes.caption);
}
holder.loadMovie(urls[0]);
caption.text = captions[0];
whoIsOn = 0;
}
x.load("foto.xml");
previous.onRelease = function() {
if(whoIsOn > 0) {
whoIsOn--;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
}
}
next.onRelease = function() {
if(whoIsOn < urls.length-1) {
whoIsOn++;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
}
}
Groeten,
TheBeatMan
thebeatman
%Europe/Berlin %494 %2005, 12:52
Alles staat in 1 map trouwens, en het XML bestand heet ook foto.xml
theFlashWizard
%Europe/Berlin %510 %2005, 13:14
zet voortaan ff [ as ] [ /as ] om je script heen..
maar em.. gebruik je wel de foto's van de tuturial eigenlijk?
anders moet je dat ff proberen..
thebeatman
%Europe/Berlin %512 %2005, 13:17
Daar doet hij het ook niet mee...
pulletje
%Europe/Berlin %516 %2005, 13:24
Aangezien ik zelf (in het verleden) al veel hulp heb gehad van ol55, neem ik zijn post erg serieus daarom hetvolgende:
je moet alle typecasting weghalen, dit werkt niet in Flash MX, dus alles (incl) de dubbele punt
dus bv. bij :
var urls:Array = new Array();
het deel :Array weghalen, wordt dus
var urls = new Array();
bij jou in het AS staat aan het begin nog
var x:XML = new XML();
verander dat dus nog even in
var x = new XML();
en probeer het dan nog eens
succes
thebeatman
%Europe/Berlin %520 %2005, 13:29
Yep, hij doet het! Echt hartstikke bedankt!
pulletje
%Europe/Berlin %522 %2005, 13:32
graag gedaan...
thebeatman
%Europe/Berlin %589 %2005, 15:09
Nu had ik nog één vraagje... Nu heb ik hem in mn site verwerkt maar als ik hem dan laad, dan laad hij alleen de next en previous buttons. Dus er verschijnt geen foto. Weet iemand waar dat aan kan liggen?
Groeten,
TheBeatMan
pulletje
%Europe/Berlin %601 %2005, 15:26
laad hij wel de captions? (de tekst die boven onder naast of op de foto komt te staan)
thebeatman
%Europe/Berlin %615 %2005, 15:46
nee ook niet :s alleen de pijltjes van previous en next.
pulletje
%Europe/Berlin %616 %2005, 15:47
ik kan het me niet voorstellen maar ondersteund jou server misschien geen XML
thebeatman
%Europe/Berlin %618 %2005, 15:50
ja want als ik de flash apart laad. Dus gewoon .../foto.swf Dan laad hij de foto's enzovoort wel
pulletje
%Europe/Berlin %659 %2005, 16:49
geef effe het adres zodat ik kan kijken of hij het hier wel doet
thebeatman
%Europe/Berlin %706 %2005, 17:56
http://www.2r-events.nl/fototest.htm
Dit is de link. En de link apart is:
http://www.2r-events.nl/fotos/test/foto.swf
En daar doet hij het wel...
Groeten,
Ronald
pulletje
%Europe/Berlin %019 %2005, 01:28
ik zou als ik jouw was om nog eens je movie te publishen in flash en dan eens goed te kijken naar het tabblad html. ook even goed kijken of je de html code goed kopieert naar fototest.htm
dat lijkt mij het enige waar het aan kan liggen..
thebeatman
%Europe/Berlin %448 %2005, 11:46
Ja maar hij laad wel de pijltjes. En als ik hem apart openen opent hij wel alles. Dus de link code enz. zijn dan toch goed?
thebeatman
%Europe/Berlin %722 %2005, 18:20
Hier nog even het werkende script!
var x = new XML();
x.ignoreWhite = true;
var urls = new Array();
var captions = new Array();
var whoIsOn:Number;
x.onLoad = function() {
var photos = this.firstChild.ChildNodes;
for(i=0;i<photos.length;i++) {
urls.push(photos[i].attributes.url);
captions.push(photos[i].attributes.caption);
}
holder.loadMovie(urls[0]);
caption.text = captions[0];
whoIsOn = 0;
}
x.load("fotos/foto.xml");
previous.onRelease = function() {
if(whoIsOn > 0) {
whoIsOn--;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
}
}
next.onRelease = function() {
if(whoIsOn < urls.length-1) {
whoIsOn++;
holder.loadMovie(urls[whoIsOn]);
caption.text = captions[whoIsOn];
}
}
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.