Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 22-11-2005, 20:44   #1 (permalink)
Neuer User
 
Registriert seit: Nov 2005
Beiträge: 5
Anfänger bittet um Hilfe

Hallo,
bin sicher, ich unterfordere euch maßlos mit dieser Frage, aber irgendwas stimmt mit meinem Script nicht. Ich will 100 Pfeile erscheinen lassen, die sich alle nach dem Mauszeiger ausrichten. Klingt einfach (auch für mich), aber irgendwie klappt's nicht.
Hier das Script:

PHP-Code:
for (i=1i<101; ++i) {
    
attachMovie("pfeil""pfeil"+ii);
    if (
i<=10) {
        
setProperty("pfeil"+i_x20+50*i);
        
setProperty("pfeil"+i_y50);
    }
    if (
i>10 && i<=20) {
        
setProperty("pfeil"+i_x20+50*(i-10));
        
setProperty("pfeil"+i_y100);
    }
    if (
i>20 && i<=30) {
        
setProperty("pfeil"+i_x20+50*(i-20));
        
setProperty("pfeil"+i_y150);
    }
    if (
i>30 && i<=40) {
        
setProperty("pfeil"+i_x20+50*(i-30));
        
setProperty("pfeil"+i_y200);
    }
    if (
i>40 && i<=50) {
        
setProperty("pfeil"+i_x20+50*(i-40));
        
setProperty("pfeil"+i_y250);
    }
    if (
i>50 && i<=60) {
        
setProperty("pfeil"+i_x20+50*(i-50));
        
setProperty("pfeil"+i_y300);
    }
    if (
i>60 && i<=70) {
        
setProperty("pfeil"+i_x20+50*(i-60));
        
setProperty("pfeil"+i_y300);
    }
    if (
i>70 && i<=80) {
        
setProperty("pfeil"+i_x20+50*(i-70));
        
setProperty("pfeil"+i_y350);
    }
    if (
i>80 && i<=90) {
        
setProperty("pfeil"+i_x20+50*(i-80));
        
setProperty("pfeil"+i_y400);
    }
    if (
i>90 && i<=100) {
        
setProperty("pfeil"+i_x20+50*(i-90));
        
setProperty("pfeil"+i_y450);
    }
    
}
mcControl.onEnterFrame = function (i) {
    for (
ii<101; ++i) {
        [
"pfeil"+i]._rotation Math.atan2(_ymouse_xmouse);
        
trace (pfeil1._rotation);
}

Ich weiß, die Positionen hätte man auch einfacher angeben können...
Aber die Pfeile richten sich einfach nicht aus und die Ausgabe gibt immer 0 an.
fraufuchs ist offline   Mit Zitat antworten
Alt 22-11-2005, 20:48   #2 (permalink)
Neuer User
 
Benutzerbild von the binary
 
Registriert seit: Jul 2001
Ort: Berlin | Friedrichshain
Beiträge: 3.561
wo werden denn die mcs attached ?
versuchs doch erstmal mit der ausgabe für einen mc..
wenn die funktikoniert, machst du es für alle..

btw: so ist besser ..

PHP-Code:
 for (i=0i<101; ++i) { 
gruss
__________________
8bm | join ff@BOINC
formpackage.org | audiohunter.de | problematica.de | 8ball-media.de/blog | taikonauten.cn
the binary ist offline   Mit Zitat antworten
Alt 22-11-2005, 21:18   #3 (permalink)
Neuer User
 
Registriert seit: Nov 2005
Beiträge: 5
Die Formel für die Winkelberechnung war falsch!
Wenn ichs für einen Pfeil schreib, dann klappts:
PHP-Code:
attachMovie("pfeil""mcPfeil"1);
setProperty(mcPfeil_x100);
setProperty(mcPfeil_y100);
mcControl.onEnterFrame = function() {
    
mcPfeil._rotation = (Math.atan2((_ymouse-100), (_xmouse-100))*180)/Math.PI;
    
trace(mcPfeil._rotation);
}; 
Aber mit 100 Pfeilen gibts als _rotation immer 0 zurück und die Pfeile drehen sich nicht:
PHP-Code:
for (i=1i<101; ++i) {
    
_root.attachMovie("pfeil""pfeil"+ii);
    if (
i<=10) {
        
setProperty("pfeil"+i_x20+50*i);
        
setProperty("pfeil"+i_y50);
    }
    if (
i>10 && i<=20) {
        
setProperty("pfeil"+i_x20+50*(i-10));
        
setProperty("pfeil"+i_y100);
    }
    if (
i>20 && i<=30) {
        
setProperty("pfeil"+i_x20+50*(i-20));
        
setProperty("pfeil"+i_y150);
    }
    if (
i>30 && i<=40) {
        
setProperty("pfeil"+i_x20+50*(i-30));
        
setProperty("pfeil"+i_y200);
    }
    if (
i>40 && i<=50) {
        
setProperty("pfeil"+i_x20+50*(i-40));
        
setProperty("pfeil"+i_y250);
    }
    if (
i>50 && i<=60) {
        
setProperty("pfeil"+i_x20+50*(i-50));
        
setProperty("pfeil"+i_y300);
    }
    if (
i>60 && i<=70) {
        
setProperty("pfeil"+i_x20+50*(i-60));
        
setProperty("pfeil"+i_y300);
    }
    if (
i>70 && i<=80) {
        
setProperty("pfeil"+i_x20+50*(i-70));
        
setProperty("pfeil"+i_y350);
    }
    if (
i>80 && i<=90) {
        
setProperty("pfeil"+i_x20+50*(i-80));
        
setProperty("pfeil"+i_y400);
    }
    if (
i>90 && i<=100) {
        
setProperty("pfeil"+i_x20+50*(i-90));
        
setProperty("pfeil"+i_y450);
    }
}
mcControl.onEnterFrame = function(i) {
    for (
i=1i<101; ++i) {
        [
"pfeil"+i]._rotation = (Math.atan2((_ymouse-["pfeil"+i]._y), (_xmouse-["pfeil"+i]._x))*180)/Math.PI;
        
trace(pfeil1._rotation);
    }
}; 
fraufuchs ist offline   Mit Zitat antworten
Alt 22-11-2005, 21:40   #4 (permalink)
Neuer User
 
Registriert seit: Nov 2005
Beiträge: 5
Juhu! Hab den Fehler gefunden!
So funktionierts:
PHP-Code:
...
mcControl.onEnterFrame = function() {
    for (
i=1i<101; ++i) {
        
xwert getProperty ("pfeil" i_x);
        
ywert getProperty ("pfeil"i_y);
        
setProperty ("pfeil"+i_rotation, (Math.atan2((_ymouse-ywert), (_xmouse-xwert))*180)/Math.PI);
        
trace(pfeil1._rotation);
    }
}; 
fraufuchs ist offline   Mit Zitat antworten
Alt 22-11-2005, 21:48   #5 (permalink)
FlashKrieger
 
Benutzerbild von hadoken
 
Registriert seit: Apr 2004
Ort: Erde
Beiträge: 94
oder so funzt es auch, hattest _root vergessen

_root["pfeil"+i]._rotation = (Math.atan2((_ymouse-_root["pfeil"+i]._y), (_xmouse-_root["pfeil"+i]._x))*180)/Math.PI;

gruß hadoken
hadoken ist offline   Mit Zitat antworten
Alt 22-11-2005, 21:53   #6 (permalink)
Neuer User
 
Benutzerbild von the binary
 
Registriert seit: Jul 2001
Ort: Berlin | Friedrichshain
Beiträge: 3.561
PHP-Code:
mc.onEnterFrame = function(i)
{
    for( var 
i=1i<6i++ )
    {
        var 
_root['pfeil'+i]; // bzw. ziel in das die mcs attached wurden
            
a._rotation = (Math.atan2((_ymouse a._y), (_xmouse-a._x))*180)/Math.PI;
    
        
tracea._rotation );
    }
    
trace('---')
}; 
gruss
__________________
8bm | join ff@BOINC
formpackage.org | audiohunter.de | problematica.de | 8ball-media.de/blog | taikonauten.cn
the binary 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:28 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele