| |||||||
Du magst keine Werbung? Wir auch nicht!
Einfach registrieren und die Werbung ist weg. Diese Nachricht sehen nur nicht registrierte Nutzer.
![]() |
| | LinkBack | Themen-Optionen | Ansicht |
| | #1 (permalink) |
| Neuer User Registriert seit: Mar 2003
Beiträge: 8
| [noob] Film per Taste vor / zurück statt Timer
Hallo, bastele gerade an einer Bildergalerie... Das Original-Teil hab ich bei Flashkit gesaugt, und ein wenig angepasst. Funzt auch prima. Nur habe ich noch die Anforderung, daß das Ganze auch per Pfeiltasten links / rechts zu bedienen sein soll, und nicht nur per Timer abläuft. Ich hoffe ich habe mich verständlich ausgedrückt... Flash + Actionscript gehören nicht gerade zu meinen Spezialitäten. Mein Kram ist der, der unter :ADDED: steht. Der Codeblock aus dem entspr. Frame: Code: // Loop through all the images that have been loaded into the
// slideshow
Key.addListener(_root.image_dropzone);
for(var i=1; i<=numImages; i++){
// Check to see if see if 'i' matches the current image to be shown
if(i == _root.currentImage){
// Check to see if the image to be shown is loaded or not
if(_root["image_dropzone" + _root.currentImage].getBytesLoaded() >= _root["image_dropzone" + _root.currentImage].getBytesTotal()){
// Check to see if the image to be shown is to high for the slideshow
if(this["image_dropzone" + _root.currentImage]._height > (_root.movie_height - 20)){
// Resize the image, by measuring height, to fit the slideshow
var percent = 100 * ((_root.movie_height - 20) / this["image_dropzone" + _root.currentImage]._height);
this["image_dropzone" + _root.currentImage]._xscale = percent;
this["image_dropzone" + _root.currentImage]._yscale = percent;
}
// Check to see if the image to be shown is to wide for the slideshow
if(this["image_dropzone" + _root.currentImage]._width > (_root.movie_width - 20)){
// Resize the image, by measuring width, to fit the slideshow
var percent = 100 * ((_root.movie_width - 20) / this["image_dropzone" + _root.currentImage]._width);
this["image_dropzone" + _root.currentImage]._xscale = percent;
this["image_dropzone" + _root.currentImage]._yscale = percent;
}
// Check to see if the image has been shown yet
if(_root.imageShown == 0 && _root.currentImage != _root.oldImage){
// Show the image and prep it for fading
this["image_dropzone" + _root.currentImage]._visible = true;
this["image_dropzone" + _root.currentImage]._alpha = 0;
_root.imageShown = 1;
// If the image has already been shown and preped
} else {
// Check to see if the images needs to be faded in
if(_root.currentImage != _root.oldImage && _root.fade > 0){
// Fade in the image
this["image_dropzone" + _root.currentImage]._alpha = 100 * (_root.counter / (_root.fade * _root.second));
// If the image does not need to be faded in
} else {
// Show the image
this["image_dropzone" + _root.currentImage]._alpha = 100;
}
// Move the image to the middle of the slideshow screen
this["image_dropzone" + _root.currentImage]._x = (_root.movie_width - this["image_dropzone" + _root.currentImage]._width) / 2;
this["image_dropzone" + _root.currentImage]._y = (_root.movie_height - this["image_dropzone" + _root.currentImage]._height) / 2;
// Check to see if captions should be shown
if(_root.captions == true || _root.captions == "true"){
// Make the captions box visible and load the caption text for the current image
_root.caption._visible = true;
_root.caption.tb_caption.text = xmlData.slideshow[1].images[i-1].image[1].caption.value;
// If captions should not be shown
} else {
// Hide the captions box
_root.caption._visible = false;
}
// Swap depths of caption box to make sure its on top of the current image shown
_root.caption.swapDepths(numImages + 3);
}
// If the current image has not been fully loaded, hide it
} else {
this["image_dropzone" + i]._visible = false;
}
// Check to see if 'i' is the old image
} else if(i == _root.oldImage && _root.fade > 0){
// Fade the old image out
this["image_dropzone" + _root.oldImage]._alpha = 100 - (100 * (_root.counter / (_root.fade * _root.second)));
// If 'i' is not the current image or the old image, hide image 'i'
} else {
this["image_dropzone" + i]._visible = false;
}
}
// Increment the counter
_root.counter++;
// Check to see if the counter has exceeded the fade and time to show the image
if(_root.counter > ((_root.time + _root.fade) * _root.second)){
//:ADDED:
_root.stop();
if (Key.isDown(Key.RIGHT)){
_root.playing = true;
_root.play();
}
if (Key.isDown(Key.LEFT)){
_root.currentImage--;
_root.playing = true;
_root.play();
}
// Reset the counter
_root.counter = 0;
// Set the current image as the old image
_root.oldImage = _root.currentImage;
// Increment the current image
_root.currentImage++;
// Check to see if the current image exceeds the number of images in the slideshow
if(_root.currentImage > numImages){
// Check to see if the slideshow should be repeated
if(_root.repeat){
// Set the current image back to the beginning
_root.currentImage = 1;
// If the slideshow is not to be repeated, hold on the last image
} else {
_root.currentImage = _root.numImages;
}
}
// Set the current image as not shown
_root.imageShown = 0;
} http://www.flashkit.com/downloads/mo.../Slideshow.zip Geändert von -Novalis- (23-06-2005 um 21:42 Uhr) |
| | |
| | #2 (permalink) |
| Gast
Beiträge: n/a
|
brainstorming: ActionScript:
edit: seh grad, das er so immer nur in eine richtung weitergeht, egal welche taste gedrügt wird, aber das zu beheben schaffste selber, oder? Geändert von robo kalkühl (23-06-2005 um 21:52 Uhr) |
|
| | #3 (permalink) |
| Neuer User Registriert seit: Mar 2003
Beiträge: 8
|
Hm, immerhin tut sich jetzt was Nur leider ist die Abfrage oben wichtig, damit das Bild rein und raus fadet... und die Keypress-Abfrage dürfte erst danach kommen. Ausserdem muss der Film auch dann stoppen, was er bei der Lösung halt nicht tut. Ich will die Fading-Effekte UND Tastenreaktion Trotzdem danke, zur Not mache ich es so... aber lieb wäre mir halt o.g. Gruß, Nov |
| | |
| | #5 (permalink) |
| Neuer User Registriert seit: Mar 2003
Beiträge: 8
|
Jep, das ist ne andere. Meine ist aber wirklich nur marginal angepasst... im wesentlichen habe ich nur paar MC gelöscht, und die XML angepasst. Danke für deine Hilfe :-) Gruß, nov Geändert von -Novalis- (23-06-2005 um 23:30 Uhr) |
| | |
| | #6 (permalink) |
| Gast
Beiträge: n/a
|
du, es tut mir ja echt leid, aber das ding ist mir ein bischen zu groß, um es mal eben durchzugucken. sorry. ich mag aber auch den stil nicht, in dem das programmiert ist, wegschmeißen... ich erlaube mir einfach mal zu vermuten, das für das was du vorhast, viel weniger code nötig ist... |
|
| | #8 (permalink) |
| Neuer User Registriert seit: Mar 2003
Beiträge: 8
|
Tjo, manchmal... sind es nur zwei Zeichen: Code: if ((_root.counter > ((_root.time + _root.fade) * _root.second))) _root.counter = ((_root.time + _root.fade) * _root.second+1);
if((_root.counter > ((_root.time + _root.fade) * _root.second)) && (Key.isDown(Key.RIGHT) || Key.isDown(Key.LEFT))) {...... Nov |
| | |
![]() |
| Lesezeichen |
| Themen-Optionen | |
| Ansicht | |
| |