Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 30-01-2006, 13:26   #1 (permalink)
Neuer User
 
Registriert seit: Dec 2001
Beiträge: 144
hilfe es will nicht...funktion müsste klappen!

hi leute.
häng seit 2 tagen an diesen paar zeilen und komm nicht weiter.
von meiner logik her, müsste es eigentlich funktionieren, tut es aber nicht.

kurze beschreibung:
auf root wir ein emptyMC erstellt (holder) um in der funktion (holen) dort den clip (hal) zu attachen. diese funktion wird beim start ausgeführt und wenn man auf einen button drückt, erhöht dieser die var i um eins und führt erneut (holen) aus.

letzten endes will ich das sich die flächen an einander positionieren wie in einer liste und wenn sich die größe des 2. zB verändert, sollen die oberen runterrücken.

hier das skriptliegt im ersten frame)
Code:
_global.i = 1;

_root.createEmptyMovieClip("holder",100);
holder._x= 100;
holder._y = 400;

holder.createEmptyMovieClip("hal0",100);
holder.hal0._x= 30;
holder.hal0._y = 0;

holen();

function holen(){
	
	_root.holder.attachMovie("hal",["hal"+i],300+i);
	_root.holder["hal"+i]._x = 30;
	_root.holder["hal"+i].onEnterFrame = function(){
		this._y += ((_root.holder["hal"+(i-1)]._y-_root.holder["hal"+(i-1)]._height)-this._y)/2;	
		this.onRollOver = function(){
				this.onEnterFrame = function(){
					this._yscale += (50-this._yscale)/2;
				}
			}
		this.onRollOut = function(){
				this.onEnterFrame = function(){
					this._yscale += (100-this._yscale)/2;
				}
			}
		}	
	
}
aeon_g ist offline   Mit Zitat antworten
Alt 30-01-2006, 15:38   #2 (permalink)
All-rounder
 
Benutzerbild von thebiz
 
Registriert seit: Mar 2004
Ort: Bayerische Rhön
Beiträge: 2.507
Ich habe hier mal was gebastelt.

info:
Der Code ist nicht optimiert,
er soll lediglich die Funktionsweise
veranschaulichen.


PHP-Code:
var mouseOverBox:String;
var 
b1Ursprung:Number this.b1._y;
var 
b2Ursprung:Number this.b2._y;
var 
b3Ursprung:Number this.b3._y;
//
function box_size_check() {
    if (
mouseOverBox == "b1") {
        
b2._y b1._y + (b1._height 10 b2._height) / 2;
        
b3._y b2._y + (b2._height 10 b3._height) / 2;
    }
    if (
mouseOverBox == "b2") {
        
b1._y b2._y - (b2._height 10 b1._height) / 2;
        
b3._y b2._y + (b2._height 10 b3._height) / 2;
    }
    if (
mouseOverBox == "b3") {
        
b2._y b3._y - (b2._height 10 b3._height) / 2;
        
b1._y b2._y - (b2._height 10 b1._height) / 2;
    }
    
//       
    
b1._y += (b1Ursprung b1._y) / 10;
    
b2._y += (b2Ursprung b2._y) / 10;
    
b3._y += (b3Ursprung b3._y) / 10;
    
updateAfterEvent();
}
this.b1.onRollOver = function() {
    
mouseOverBox "b1";
    
this.onEnterFrame = function() {
        
this._xscale += (200 this._xscale) / 10;
        
this._yscale += (200 this._xscale) / 10;
        
updateAfterEvent();
    };
};
this.b1.onRollOut = function() {
    
this.onEnterFrame = function() {
        
this._xscale += (100 this._xscale) / 10;
        
this._yscale += (100 this._xscale) / 10;
    };
};
this.b2.onRollOver = function() {
    
mouseOverBox "b2";
    
this.onEnterFrame = function() {
        
this._xscale += (200 this._xscale) / 10;
        
this._yscale += (200 this._xscale) / 10;
        
updateAfterEvent();
    };
};
this.b2.onRollOut = function() {
    
this.onEnterFrame = function() {
        
this._xscale += (100 this._xscale) / 10;
        
this._yscale += (100 this._xscale) / 10;
    };
};
this.b3.onRollOver = function() {
    
mouseOverBox "b3";
    
this.onEnterFrame = function() {
        
this._xscale += (200 this._xscale) / 10;
        
this._yscale += (200 this._xscale) / 10;
        
updateAfterEvent();
    };
};
this.b3.onRollOut = function() {
    
this.onEnterFrame = function() {
        
this._xscale += (100 this._xscale) / 10;
        
this._yscale += (100 this._xscale) / 10;
    };
};
setInterval(box_size_check10); 
Angehängte Dateien
Dateityp: rar dynamisches_menu.rar (683 Bytes, 3x aufgerufen)
__________________

--------------------------------
Ich klicke, ergo bin ich. (me)
--------------------------------

Geändert von thebiz (30-01-2006 um 15:39 Uhr)
thebiz ist offline   Mit Zitat antworten
Alt 30-01-2006, 15:59   #3 (permalink)
Neuer User
 
Registriert seit: Dec 2001
Beiträge: 144
thx theBiz für den anreiz.

aber...

ich glaub du hast mich da nicht ganz verstanden. ich möchte, das die objekte attached werden und das ganze mit einem dynamischen skript. heisst ich möchte nicht für jedes objekt dieses skript einzeln schreiben, da es keine begrenzung gibt.

ist nich wirklich ein menü.

vielleicht hättest du ja dafür eine idee

greez
aeon_g ist offline   Mit Zitat antworten
Alt 30-01-2006, 16:45   #4 (permalink)
All-rounder
 
Benutzerbild von thebiz
 
Registriert seit: Mar 2004
Ort: Bayerische Rhön
Beiträge: 2.507
Gut, dann erstelle einen neuen Film
und pack den Code hier ins 1. Keyframe.

PHP-Code:
this.createEmptyMovieClip("b1"1);
b1.beginFill(0xFF0000);
b1.moveTo(-25, -25);
b1.lineTo(25, -25);
b1.lineTo(2525);
b1.lineTo(-2525);
b1.lineTo(-25, -25);
b1.endFill();
b1._x 100;
b1._y 100;
//
b1.duplicateMovieClip("b2"2, {_x:b1._x_y:b1._y b1._height 10});
b2.duplicateMovieClip("b3"3, {_x:b2._x_y:b2._y b2._height 10});
//
var mouseOverBox:String;
var 
b1Ursprung:Number this.b1._y;
var 
b2Ursprung:Number this.b2._y;
var 
b3Ursprung:Number this.b3._y;
//
function box_size_check() {
    if (
mouseOverBox == "b1") {
        
b2._y b1._y + (b1._height 10 b2._height) / 2;
        
b3._y b2._y + (b2._height 10 b3._height) / 2;
    }
    if (
mouseOverBox == "b2") {
        
b1._y b2._y - (b2._height 10 b1._height) / 2;
        
b3._y b2._y + (b2._height 10 b3._height) / 2;
    }
    if (
mouseOverBox == "b3") {
        
b2._y b3._y - (b2._height 10 b3._height) / 2;
        
b1._y b2._y - (b2._height 10 b1._height) / 2;
    }
    
//           
    
b1._y += (b1Ursprung b1._y) / 10;
    
b2._y += (b2Ursprung b2._y) / 10;
    
b3._y += (b3Ursprung b3._y) / 10;
    
updateAfterEvent();
}
this.b1.onRollOver = function() {
    
mouseOverBox "b1";
    
this.onEnterFrame = function() {
        
this._xscale += (200 this._xscale) / 10;
        
this._yscale += (200 this._xscale) / 10;
        
updateAfterEvent();
    };
};
this.b1.onRollOut = function() {
    
this.onEnterFrame = function() {
        
this._xscale += (100 this._xscale) / 10;
        
this._yscale += (100 this._xscale) / 10;
    };
};
this.b2.onRollOver = function() {
    
mouseOverBox "b2";
    
this.onEnterFrame = function() {
        
this._xscale += (200 this._xscale) / 10;
        
this._yscale += (200 this._xscale) / 10;
        
updateAfterEvent();
    };
};
this.b2.onRollOut = function() {
    
this.onEnterFrame = function() {
        
this._xscale += (100 this._xscale) / 10;
        
this._yscale += (100 this._xscale) / 10;
    };
};
this.b3.onRollOver = function() {
    
mouseOverBox "b3";
    
this.onEnterFrame = function() {
        
this._xscale += (200 this._xscale) / 10;
        
this._yscale += (200 this._xscale) / 10;
        
updateAfterEvent();
    };
};
this.b3.onRollOut = function() {
    
this.onEnterFrame = function() {
        
this._xscale += (100 this._xscale) / 10;
        
this._yscale += (100 this._xscale) / 10;
    };
};
setInterval(box_size_check10); 
__________________

--------------------------------
Ich klicke, ergo bin ich. (me)
--------------------------------
thebiz 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 15:27 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele