Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript (http://www.flasher.ru/forum/forumdisplay.php?f=5)
-   -   И сново я с новым вопросом :) (http://www.flasher.ru/forum/showthread.php?t=50863)

rojok-online 02.11.2003 21:04

И сново я с новым вопросом :)
 
:) И сново я с новым вопросом :)
У меня есть куча картинок которые загружаются в swf, все работает прекрасно, но единственный недостаток это то что нет загрузки к ним. Я пытался это долго сделать, но ни чего не получается. Подскажи как мне это сделать. Буду благодарен очень. :rolleyes:

Код:

//frame 1
x = 0;
images = x; // это числовой порядок картинок
y = 1; // это числовой порядок папок
//frame 2
next1.onRelease = function() {
        images = ++x;
        loadMovie("" add y add "/image" add images add ".jpg", "fotos");
}
back1.onRelease = function() {
        images = --x;
        loadMovie("" add y add "/image" add images add ".jpg", "fotos");
}
//frame 3
gotoAndPlay(2);

так то оно работает, но если loadMovie("" add y add "/image" add images add ".jpg", "fotos"); заменить на
Код:

function start() {
        _root.fotos.loadMovie("" add y add "/image" add images add ".jpg", "fotos");
        initialSize = _root.fotos.getBytesTotal();
        loadStarted = false;
        loaded;
        percent = 0;
        cont();
}
function () {
        if (_root.fotos.getBytesTotal()>0) {
                percent = Math.round((_root.fotos.getBytesLoaded()/_root.fotos.getBytesTotal())*100);
                _root.percentfield = percent+"%";
                _root.indicator.bar._xscale = percent;
        }
        if (!loadStarted) {
                if (percent<100 || _root.fotos.getBytesTotal()>initialSize) {
                        loadStarted = true;
                }
        }
};
next1.onRelease = function() {
        images = ++x;
        start();
};
back1.onRelease = function() {
        images = --x;
        start();
};

то не фурычит..., я заню что тут че-то не то..., но не как не могу понять что...

rojok-online 03.11.2003 19:31

ваще чтоль не кто не знает ? :(

Techmaker 04.11.2003 02:32

извени, думать лень :)
може попозже :)

rojok-online 04.11.2003 19:36

Techmaker
Я думаю что не ты один тут проф. Flash'a :)))

Ну плиз подскажитете как ?

fiot 05.11.2003 01:39

1. создаём папку img в неё кидаем те jpg которые тебе нужны...
2. воздаём файл data.txt, в нём пишем

Код:

img0=flower&img1=liliya&img2=rouse&img3=tulpan&img4=vetochka


причём flower, liliya это названия файлов без разширения.
3. создаём flash->file->new и впервом фрейве пишем
Код:

System.useCodepage = 1;
var _url_ = "data.txt",
    n = 5,
    t,
    image_path;
//ImageViewer = function (target,depth, x, y, w, h, borderThickness, borderColor) {
var img_ = new ImageViewer(this, 3, 60, 20, 150, 30, 2, 0x000000);
_root.createEmptyMovieClip('temp', 1);
with (_root.temp) {_x = 50;_y = 20;}
data_ = new LoadVars();
data_.load(_url_);
data_.onLoad = function(success) {
if (success) {
with (_root.data_) {
t = random(n);
image_path="img/"+eval("img"+t)+".jpg";
}
trace(image_path+"\r"+t);
img_.loadImage(image_path);
}
};
MovieClip.prototype.drawRect = function (x, y, w, h, RGB, alpha) {
  this.moveTo(x, y);
  this.beginFill(RGB, alpha);
  this.lineTo(x+w, y);
  this.lineTo(x+w, y+h);
  this.lineTo(x, y+h);
  this.lineTo(x, y);
  this.endFill;
};
 
_global.ImageViewer = function (target, depth, x, y, w, h, borderThickness, borderColor){
  this.borderThickness = borderThickness;
  this.borderColor = borderColor;
  this.target_mc = target;
  var imgViewer = this;
  this.target_mc.createEmptyMovieClip("container_mc" + depth, depth);
  this.container = this.target_mc["container_mc" + depth];
  with(this.container){
  _x = x;
  _y = y;
  createEmptyMovieClip("imageHolder_mc", 0);
  imageHolder_mc._visible = false;
  createEmptyMovieClip("border_mc", 1);
  border_mc.lineStyle(borderThickness, borderColor);
  border_mc.drawRect(0, 0, w, h);
  createEmptyMovieClip("mask_mc", 2);
  mask_mc.drawRect(0, 0, w, h, 0x0000FF, 100);
  mask_mc._visible = false;
  }
}
 
 
_global.ImageViewer.prototype.loadImage = function (URL) {
  if (typeof this.container.imageHolder_mc.image_mc != "movieclip") {
    this.container.imageHolder_mc.image_mc.removeMovieClip();
  }
  this.container.imageHolder_mc.createEmptyMovieClip("image_mc", 1);
  var imgViewer = this;
  var image = this.container.imageHolder_mc.image_mc;
  var loadCheckID;
  image.loadMovie(URL);
  loadCheckID = setInterval(preloadImage, 100, getTimer());
  this.container.createTextField("loadStatus_txt", 3, 0, 0, 0, 0);
  with(this.container.loadStatus_txt){
  background = true;
  border = true;
  setNewTextFormat(new TextFormat("Arial, Helvetica, _sans", 10, imgViewer.borderColor, false, false, false, null, null, "right"));
  autoSize = "left";
  text = "LOADING";
  _y = 3;
  _x = 3;
  }
  function preloadImage (startLoadTime) {
    var largestBorderDimension;
    var imageScaleFactor;
    if (image.getBytesTotal() > 4) {
      imgViewer.container.loadStatus_txt.text = "LOADING: " 
        + Math.floor(image.getBytesLoaded() / 1024)
        + "/" + Math.floor(image.getBytesTotal() / 1024) + " KB";
    }
    if (image.getBytesTotal() > 4 && image.getBytesLoaded() == image.getBytesTotal()) {
      clearInterval(loadCheckID);
      with(imgViewer.container){
      loadStatus_txt.removeTextField();
      border_mc.clear();
      border_mc.lineStyle(imgViewer.borderThickness, imgViewer.borderColor);
      border_mc.drawRect(0, 0, image._width, image._height);
      mask_mc.drawRect(0, 0, image._width, image._height, 0xFFFFFF, 100);     
      imageHolder_mc.setMask(imgViewer.container.mask_mc);
      imageHolder_mc._visible = true;
      }
      } else if ((image.getBytesTotal() < 4)
              && (getTimer() - startLoadTime > 7000)) {
      imgViewer.container.loadStatus_txt.text = "ERROR LOADING IMAGE";
      clearInterval(loadCheckID);
    }
  }
}


2K WebStudio 05.11.2003 02:01

Салют любителям длинных скриптов!!!
:D

rojok-online 05.11.2003 02:15

fiot
Я очень благодарен за хелп, но как нить то что я наисал это можно сделать ? Потому как я не очень понимаю что у тебя там написано :(
Даже точнее я не знаю как мне применить в моему мувику :(

rojok-online 05.11.2003 08:30

fiot
чет не фурычит...


Часовой пояс GMT +4, время: 06:18.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.