Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 08-11-2003, 10:47   #1 (permalink)
Neuer User
 
Registriert seit: Aug 2003
Beiträge: 12
externe jpgs laden und positionieren - mac problem

Tag,

ich baue einen Movieclip, lade jpegs rein, wenn sie geladen sind, positioniere ich sie und zeige sie an. Das funktioniert auch blendend, nur nicht aufm Mac. Leider fehlt mirn mac zum ausprobieren. Hier erst mal das Skript(gekürzt):

ActionScript:
  1. //bildcontainer bauen
  2. _level30.createEmptyMovieClip("container", 335);
  3. //bild in den container laden
  4. loadMovie("../bilder/works/"+inhalt+".jpg", "_level30.container");
  5. //bild transparent machen
  6. _level30.container._alpha = 0;
  7. //Ladefunktion:
  8. bildPre();

Die Methode bildPre:

ActionScript:
  1. balken_mc.onEnterFrame = function() {
  2. with (this) {
  3. var gesamt = _level30.container.getBytesTotal();
  4. var bereits = _level30.container.getBytesLoaded();
  5. //wenn das bild vollständig geladen ist:
  6. if (bereits>=gesamt && bereits>300) {
  7. //bildgröße abfragen und bild positionieren
  8. _level30.container._x = (479.5-(_level30.container._width/2));
  9. _level30.container._y = (296-(_level30.container._height/2));
  10. //bild einfaden
  11. _level30.container.timeTween("_alpha", 100, 1000, Math.easeInCubic);
  12. delete this.onEnterFrame;
  13. }
  14. };

Das Problem: Beim Mac wird das erste Bild (also direkt nach dem containerbauen) nicht richtig(sondern auf 0/0) positioniert.
Flash liest also scheinbar die bildmaße nicht ein.

Wie kommtn das? Ideen?

Dank.

fabian
fabomann ist offline   Mit Zitat antworten
Alt 08-11-2003, 10:56   #2 (permalink)
über oder unter dir...
 
Benutzerbild von merlin0815
 
Registriert seit: Dec 2001
Ort: Dulsmountain
Beiträge: 1.657
aloha!
komisches problem, wir wäre es denn mal mit dem ganzen skript?!
evtl. sogar die fla - kein bock lange zu basteln...
__________________
gruss merlin & peace 4 @ll

eBay -> Erfolgreicher Verkaufen - MotionSell - Die andere Auktionsgalerie für eBay <- VÖLLIG KOSTENLOS
merlin0815 ist offline   Mit Zitat antworten
Alt 08-11-2003, 12:08   #3 (permalink)
Neuer User
 
Registriert seit: Aug 2003
Beiträge: 12
Danke schonmal fürs Interesse.
Du hast es nicht anders gewollt:

Hier wirdn Thumbnail geladen und zum button gemacht.
(Der gefragte Modus ist "works",medium"bilder").

ActionScript:
  1. //füllt ein Quadrat mit einem neuen Bild.
  2. MovieClip.prototype.neuerInhalt = function(inhalt, modus, medium, textinhalt) {
  3.     this.enabled = false;
  4.     this.audio_mc.removeMovieClip();
  5.     this.video_mc.removeMovieClip();
  6.     this.containerA.swapDepths(this.containerB);
  7.     (this.containerA.getDepth()>this.containerB.getDepth()) ? this.c=this.containerA : this.c=this.containerB;
  8.     this.c._alpha = 0;
  9.     this.onEnterFrame = function() {
  10.         if (this.c.getBytesLoaded()>=this.c.getBytesTotal() && this.c.getBytesLoaded()>200) {
  11.             this.c.timeTween("_alpha", 100, 1000, Math.easeInCubic);
  12.             this.enabled = true;
  13.             delete this.onEnterFrame;
  14.         }
  15.     };
  16.     if (modus == "clients" || modus == undefined) {
  17.         this.c.loadMovie("../bilder/thumbs/clients/"+inhalt+"1.jpg");
  18.     }
  19. //Hier isser !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  20.     if (modus == "works") {
  21.         this.c.loadMovie("../bilder/thumbs/clients/"+inhalt+".jpg");
  22.         //Buttonfunktionen
  23.         this.onRollOver = function() {
  24.             this.rahmenFett();
  25.         };
  26.         this.onRollOut = function() {
  27.             this.rahmenNormal();
  28.         };
  29.         this.onRelease = function() {
  30.             _level30.scrollingOff();
  31.             textBack(textinhalt);
  32.             stopAllSounds();
  33.             _level30.genTextBox("clients_txt", 340, 330, 146, 290, 312, 13, "");
  34.             _level30.preloader_mc.removeMovieClip();
  35.             _level30.transportfeld_mc.removeMovieClip();
  36.             unloadMovie("_level50");
  37.             if (medium == "audio") {
  38.                 _level30.createEmptyMovieClip("container", 335);
  39.                 //Grosses Bild in den Container laden
  40.                 loadMovie("../bilder/works/"+inhalt+".jpg", "_level30.container");
  41.                 _level30.container._alpha = 0;
  42.                 bildPre(true, inhalt);
  43.             }
  44.             if (medium == "video") {
  45.                 _level30.container.removeMovieClip();
  46.                 _level50.unloadMovie;
  47.                 loadMovie("../video/"+inhalt+".swf", "_level50");
  48.             }
  49.             if (medium == "bilder") {
  50.                 _level30.createEmptyMovieClip("container", 335);
  51.                 unloadMovie("_level50");
  52.                 loadMovie("../bilder/works/"+inhalt+".jpg", "_level30.container");
  53.                 _level30.container._alpha = 0;
  54.                 bildPre();
  55.             }
  56.         };
  57.     }
  58.     if (modus == "clients") {
  59.         this.onRollOver = function() {
  60.             trace("modus--clients");
  61.             this.rahmenFett();
  62.             with (this._parent) {
  63.                 createEmptyMovieClip("markierung_mc", 250);
  64.                 with (markierung_mc) {
  65.                     _x = (this._parent[inhalt+"_mc"][inhalt+"_txt"]._x)-15;
  66.                     _y = (this._parent[inhalt+"_mc"][inhalt+"_txt"]._y)+11;
  67.                     dreieck(0xFF0000);
  68.                 }
  69.             }
  70.         };
  71.         this.onRollOut = function() {
  72.             this.rahmenNormal();
  73.             this._parent.markierung_mc.removeMovieClip();
  74.         };
  75.         this.onRelease = function() {
  76.             this._parent.markierung_mc.removeMovieClip();
  77.             _level1.genText("inhalt_txt", 17, (_level1.rubrik_txt._x+_level1.rubrik_txt._width), 20, 14, eval(inhalt+"_obj.listenTitel"), "Helvetica 45 Light", "0xFFFFFF");
  78.             _level30.genTextBox("clients_txt", 340, 330, 146, 290, 312, 13, "<font color='#ff0000'>"+eval(inhalt+"_obj.textTitel")+"</font>&nbsp;<font color='#ffffff'>"+eval(inhalt+"_obj.fliesstext")+"</font>");
  79.             trace("hoehe: "+_level30.clients_txt.textHeight);
  80.             if (_level30.clients_txt.textHeight>312) {
  81.                 _level30.scrollingOn("clients");
  82.             }
  83.             loadWorks(inhalt, eval(inhalt+"_obj.bilder"), eval(inhalt+"_obj.audio"), eval(inhalt+"_obj.video"));
  84.             this._parent.createEmptyMovieClip("container", 335);
  85.             for (i=0; i<=clients_array.length; i++) {
  86.                 this._parent[clients_array[i]+"_mc"].removeMovieClip();
  87.             }
  88.             worksBackButtton();
  89.         };
  90.     }
  91. };

Die Mehtode bildPre:

ActionScript:
  1. MovieClip.prototype.bildPre = function(audio, audioziel) {
  2.     _level30.createEmptyMovieClip("preloader_mc", 360);
  3.     with (_level30.preloader_mc) {
  4.         //preloader positionieren
  5.         _x = 398;
  6.         _y = 290;
  7.         //rahmen zeichnen und positionieren
  8.         createEmptyMovieClip("rahmen_mc", 5);
  9.         with (rahmen_mc) {
  10.             lineStyle(1, "0x2B2B00");
  11.             moveTo(0, 10);
  12.             lineTo(160, 10);
  13.             lineTo(160, 0);
  14.             lineTo(0, 0);
  15.             lineTo(0, 10);
  16.             //ladebalken zeichnen und positionieren
  17.             createEmptyMovieClip("balken_mc", 10);
  18.             balken_mc.onEnterFrame = function() {
  19.                 trace("skript.swf,1,249");
  20.                 with (this) {
  21.                     var gesamt = _level30.container.getBytesTotal();
  22.                     var bereits = _level30.container.getBytesLoaded();
  23.                     beginFill("0x2B2B00");
  24.                     moveTo(2, 8);
  25.                     lineTo(1.59*(bereits/(gesamt/100)), 8);
  26.                     lineTo(1.59*(bereits/(gesamt/100)), 3);
  27.                     lineTo(2, 3);
  28.                     lineTo(2, 158);
  29.                     endFill("0x2B2B00");
  30.                     if (bereits>=gesamt && bereits>300) {
  31.                         _level30.container._x = (479.5-(_level30.container._width/2));
  32.                         _level30.container._y = (296-(_level30.container._height/2));
  33.                         _level30.container.timeTween("_alpha", 100, 1000, Math.easeInCubic);
  34.                         if (audio) {
  35.                             audioPre(audioziel);
  36.                         }
  37.                         _level30.preloader_mc.removeMovieClip();
  38.                         delete this.onEnterFrame;
  39.                     }
  40.                 }
  41.             };
  42.         }
  43.     }
  44. };

Ich hatte das Skript zusammengestrichen, weil ich gehofft hatte,
der fehler wäre offensichtlich(für jeden ausser mir).
Ich kann dir auch komplette dateien schicken, ist nur ein ziemlicher schrank voll, weil die bilder und daten auch von textdateien ausgelesen werden und so.....
wenn dus dir trotzdem antun willst, sag bescheid. dann kriegste auch flas und txts.

Neugierig

fabian
fabomann ist offline   Mit Zitat antworten
Alt 08-11-2003, 12:17   #4 (permalink)
Neuer User
 
Registriert seit: Aug 2003
Beiträge: 12
teil2 der schnitzeljagd. in neuerInhalt und bildPre erwähnte funktionen(wahrscheinlich uninteressant, aber der vollständigkeit halber...):

ActionScript:
  1. //verdoppelt die Rahmendicke (bei Rollover)
  2. MovieClip.prototype.rahmenFett = function() {
  3.     with (this.rahmen_mc) {
  4.         lineStyle(2, 0xFFFFFF, 100);
  5.         moveTo(0, 67);
  6.         lineTo(67, 67);
  7.         lineTo(67, 0);
  8.         lineTo(0, 0);
  9.         lineTo(0, 67);
  10.     }
  11. };
  12. //normalisiert die Rahmendicke (bei Rollout)
  13. MovieClip.prototype.rahmenNormal = function() {
  14.     with (this.rahmen_mc) {
  15.         clear();
  16.         lineStyle(1, 0xFFFFFF, 100);
  17.         moveTo(0, 67);
  18.         lineTo(67, 67);
  19.         lineTo(67, 0);
  20.         lineTo(0, 0);
  21.         lineTo(0, 67);
  22.     }
  23. };
ActionScript:
  1. //generiert den Button, der zum jeweiligen Kundendtext zurückführt
  2. textBack = function (kundenText) {
  3.     with (_level30) {
  4.         _level30.preloader_mc.removeMovieClip();
  5.         _level30.transportfeld_mc.removeMovieClip();
  6.         createEmptyMovieClip("textBack_mc", 310);
  7.         with (textBack_mc) {
  8.             _x = 650;
  9.             _y = 430;
  10.             createEmptyMovieClip("dreieck", 50);
  11.             dreieck.dreieck(0xFF0000);
  12.             genText("worksback_txt", 60, 8, -9, "12", "text", "h45", "0xFFFFFF");
  13.         }
  14.         textBack_mc.onRollOver = function() {
  15.             textBack_mc.dreieck._rotation = 180;
  16.         };
  17.         textBack_mc.onRollOut = function() {
  18.             textBack_mc.dreieck._rotation = 0;
  19.         };
  20.         textBack_mc.onRelease = function() {
  21.             stopAllSounds();
  22.             _level30.transportfeld_mc.removeMovieClip();
  23.             _level30.preloader_mc.removeMovieClip();
  24.             _level50.unloadMovie();
  25.             _level30.container.removeMovieClip();
  26.             _level30.genTextBox("clients_txt", 340, 330, 146, 290, 312, 13, "<font color='#ff0000'>"+eval(kundenText+"_obj.textTitel")+"</font>&nbsp;<font color='#ffffff'>"+eval(kundenText+"_obj.fliesstext")+"</font>");
  27.             trace("hoehe: "+_level30.clients_txt.textHeight);
  28.             if (_level30.clients_txt.textHeight>312) {
  29.                 _level30.scrollingOn("clients");
  30.             }
  31.             _level30.textBack_mc.removeMovieClip();
  32.         };
  33.     }
  34. };

ActionScript:
  1. //erzeugt die Textfelder für die Inhalte
  2. MovieClip.prototype.genTextBox = function(name, tiefe, posx, posy, hoehe, breite, msize, mInhalt) {
  3.     this.createTextField(name, tiefe, posx, posy, hoehe, breite);
  4.     formBox = new TextFormat();
  5.     formBox.size = msize;
  6.     //formBox.color = "0xFFFFFF";
  7.     if (msize == 13) {
  8.         formBox.leading = 6;
  9.     }
  10.     if (msize == 14) {
  11.         formBox.leading = 7;
  12.     }
  13.     this[name].onLoad = function() {
  14.         with (this) {
  15.             autoSize = false;
  16.             html = true;
  17.             type = "dynamic";
  18.             multiline = true;
  19.             _width = mbreite;
  20.             _height = mhoehe;
  21.             wordwrap = true;
  22.             selectable = false;
  23.             htmlText = mInhalt;
  24.             setTextFormat(formBox);
  25.         }
  26.     };
  27.     this[name].loadFont(mFont+".swf", tiefe);
  28. };
fabomann ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 08:54 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele