Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 11-07-2006, 11:52   #1 (permalink)
Neuer User
 
Benutzerbild von MICKtheBIG
 
Registriert seit: Feb 2004
Ort: Hamburg
Beiträge: 88
Scrollbar will nicht

Hi,

ich habe einen komischen Fehler bei meinen Scrollbalken. Wenn ich mittels loadVariables einen Text einlese, kann ich ihn mit dem Mausrad scrollen, wenn ich die Scrollbar benutzte funktioniert es anscheinend auch, aber der Text ist nicht vollständig, denn er wird am Ende, des sichtbaren Textfeldes abgeschnitten, aber halt nur wenn ich meine gebastelten Scrollbalken benutze. Ich dachte zuerst, dass es an der Länge des Textfelds liegt, aber ich weiß es nicht....


PHP-Code:
loadVariables("ein_ausgabe.php?"+new Date().getTime(), this"Post");
    
this.onData = function() {        
        if (
antwort!="") {
            
text_feld_mc.text_feld.multiline true;
            
text_feld_mc.text_feld.wordWrap true
            
text_feld_mc.text_feld.text=antwort;

            if(
text_feld_mc.text_feld.textHeight text_feld_mc.text_feld._height){
                
scrollbar_mc._visible true
            }else{
                
scrollbar_mc._visible false
            }
}
starty this.text_feld_mc.text_feld._y;
scrollbar_mc.scroller.onPress = function(){
    if(
text_feld_mc.text_feld.textHeight text_feld_mc.text_feld._height){
        
this.startDrag(false9259100);    
        
this.onEnterFrame = function(){
            if((
this._y-25) >= && (this._y-25) <=75){
                
//128 = Höhe des Textfelds
                //(this._y-25), da ansonsten der anfang des textes weg ist
                
                
gesamthoehe text_feld_mc.text_feld.textHeight;
                
                
diff gesamthoehe 128;

                
                if((
this._y-25) == 0){
                    
this._parent._parent.text_feld_mc.text_feld._y starty;
                }else{
                    
//Hier geschied das wirkliche Scrollen
                    
scrollwert Math.round(((this._y-25)/75)*100);//this._y kann nur max. 75 erreichen. Deshalb wird auch durch 75 geteilt, da dies 100% sind!
                    
diffwert Math.round(-(diff*scrollwert)/100);
                    
this._parent._parent.text_feld_mc.text_feld._y diffwert+starty;
                }
            }            
        }
    }
};
scrollbar_mc.scroller.onMouseUp= function(){
    
//trace('release');
    
this.stopDrag();
    
delete this.onEnterFrame;
    
};

scrollbar_mc.scroll_up.onPress = function() {
    if(
text_feld_mc.text_feld.textHeight text_feld_mc.text_feld._height){

        
this.onEnterFrame = function(){
            if(
this._parent._parent.text_feld_mc.text_feld._y<-34){
                
this._parent._parent.text_feld_mc.text_feld._y += 6;
                
            }
        }            
    }
}
scrollbar_mc.scroll_up.onMouseUp= function(){
    
delete this.onEnterFrame;
};
scrollbar_mc.scroll_down.onPress = function() {
    if(
text_feld_mc.text_feld.textHeight text_feld_mc.text_feld._height){
        
zu_scrollen = -1*(this._parent._parent.text_feld_mc.text_feld._height);
        
this.onEnterFrame = function(){
            if(
this._parent._parent.text_feld_mc.text_feld._y>zu_scrollen){
            
this._parent._parent.text_feld_mc.text_feld._y -= 6;

            }
        }            
    }
}
scrollbar_mc.scroll_down.onMouseUp= function(){
    
delete this.onEnterFrame;
}; 
MICKtheBIG ist offline   Mit Zitat antworten
Alt 11-07-2006, 12:42   #2 (permalink)
Neuer User
 
Benutzerbild von MICKtheBIG
 
Registriert seit: Feb 2004
Ort: Hamburg
Beiträge: 88
ok,

ich habe dies eingefügt:
PHP-Code:
this.text_feld_mc.text_feld.autoSize"left"
Nun hat der Text mit der geladenen Varibalen die richtige Länge, aber wenn ich nun danach die Höhe des Textes bestimmen möchte nimmt er immer die Anfangshöhe und nicht die Höhe, die mit
PHP-Code:
this.text_feld_mc.text_feld.autoSize"left"
erzeugt wurde,

Das laden der Variable noch einmal:
PHP-Code:
loadVariables("ein_ausgabe.php?"+new Date().getTime(), this"Post");
    
this.onData = function() {        
        if (
antwort!="") {
            
text_feld_mc.text_feld.multiline true;
            
text_feld_mc.text_feld.wordWrap true;
            
this.text_feld_mc.text_feld.autoSize"left";
            
text_feld_mc.text_feld.text="4"+antwort;
            
            if(
text_feld_mc.text_feld._height 128){//(text_feld_mc.text_feld.textHeight > text_feld_mc._height){
                //trace("texthöhe: "+text_feld_mc.text_feld._height);
                //trace("texthöhe2: "+text_feld_mc.text_feld.textHeight);
                
scrollbar_mc._visible true
            }else{
                
scrollbar_mc._visible false
            }
... 
Kann man denn nicht die neue Höhe ermitteln????
MICKtheBIG ist offline   Mit Zitat antworten
Alt 11-07-2006, 12:53   #3 (permalink)
Neuer User
 
Benutzerbild von MICKtheBIG
 
Registriert seit: Feb 2004
Ort: Hamburg
Beiträge: 88
Anwort, ist hier:

Variable Höhe eines Textfeldes

Man muss dann die Höhe vom MC ermitteln, indem das Textfeld eingebettet ist, alles ein wenig bugy, wenn ihr mich fragt....

Also hier noch mal das funktionierenden LoadVars. Die simple Scrollbalkenfunktion seht ihr oben.
PHP-Code:
loadVariables("ein_ausgabe.php?"+new Date().getTime(), this"Post");
    
this.onData = function() {        
        if (
antwort!="") {

            
text_feld_mc.text_feld.multiline true;
            
text_feld_mc.text_feld.wordWrap true;
            
this.text_feld_mc.text_feld.autoSize"left";
            
text_feld_mc.text_feld.text="5"+antwort;
            
            if(
text_feld_mc._height 128){
                
scrollbar_mc._visible true
            }else{
                
scrollbar_mc._visible false
            }
            
.... 
Ich versuche nun noch mal, dass sich der Scrollbalken in Abhängigkeit zu den Scrollbuttons bewegt....

Geändert von MICKtheBIG (11-07-2006 um 12:54 Uhr)
MICKtheBIG ist offline   Mit Zitat antworten
Alt 11-07-2006, 15:32   #4 (permalink)
Neuer User
 
Benutzerbild von MICKtheBIG
 
Registriert seit: Feb 2004
Ort: Hamburg
Beiträge: 88
Die Abhängigkeit von Scrollbutton und Scrollbar könnte so realisiert werden: Nicht chic, aber läuft....

PHP-Code:
move_scrollbar = function(){
                
gesamthoehe_scrollbar = (scrollbar_mc._height-45);
                
gesamthoehe_text text_feld_mc.text_feld.textHeight+50;

                
//Hier geschied das wirkliche Scrollen
                
scrollwert = -1*((text_feld_mc.text_feld._y+21)/gesamthoehe_text);

                
diffwert Math.round(gesamthoehe_scrollbar*scrollwert)+20;

                
scrollbar_mc.scroller._y diffwert;


und die Funktion wird beim drücken auf die Scrollbuttons aufgerufen....
MICKtheBIG 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 06:16 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele