Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 08-06-2005, 19:22   #1 (permalink)
Neuer User
 
Registriert seit: Jun 2004
Beiträge: 23
Navigation (loadMovie) funktioniert nicht!

Hi,

ich habe ein Nettes "slide-in" Menü gefunden. Leider kann ich die Buttons nicht verlinken. Ich kann nicht so gut ActionScript damit ich mir das Script anpassen kann. Wäre super nett, wenn mir dabei jemand helfen kann. Ich habe es bisher nur hinbekommen, dass immer der gleiche Film geladen wird, egal auf welchen Button man klickt. Mein Ziel ist es sobald man auf einen Button drückt per LoadMovie ein neuer Film geladen wird, also z.B. bei but1 wird loadMovie("home.swf",2) und bei but2 dann loadMovie("links.swf",2) etc.

Hier das zugehörige AS

ActionScript:
  1. this._x -= (this._x-xPos)/5;
  2. };
  3. //initialise a variable
  4. out = false;
  5. //menu mc actions
  6. menu.onEnterFrame = function() {
  7. //check a variable
  8. //this is the same as if(out==true){
  9. if (out) {
  10. //call the prototype and provide a target x pos
  11. this.scrollme(20);
  12. } else {
  13. this.scrollme(-406);
  14. }
  15. };
  16. //the arrow button actions
  17. menu.arrowMC.arrowBut.onRelease = function() {
  18. //check our variable
  19. if (out) {
  20. //set variable
  21. out = false;
  22. //rotate the mc that contains the arrow button
  23. menu.arrowMC._rotation = 0;
  24. } else {
  25. //set variable
  26. out = true;
  27. //rotate the mc that contains the arrow button
  28. menu.arrowMC._rotation = 180;
  29. }
  30. };
  31.  
  32. //the bounce prototype
  33. Movieclip.prototype.elasticScale = function(targetS, accel, convert) {
  34. this.step = this.step * accel + (targetS - this._xscale) * convert
  35. this._xscale = this._yscale += this.step
  36. }
  37. //but actions
  38. //use a for loop to reduce repetition of the code
  39. for(i=1;i<6;i++){
  40. theButton=_root.menu["but"+i];
  41. //this variable stores what number button it is
  42. theButton.thisNum=i;
  43. theButton.onEnterFrame=function() {
  44. //if the mouse is over the but
  45. if (_root.menu["but"+this.thisNum].overMe) {
  46. //call the bounce prototype
  47. this.elasticScale(150, 0.7, 0.3)
  48. } else {
  49. this.elasticScale(100, 0.7, 0.3)
  50. }
  51. }
  52. theButton.onRollOver=function(){
  53. //set a variable
  54. _root.menu["but"+this.thisNum].overMe=true;
  55. //bring to the front
  56. _root.menu["but"+this.thisNum].swapDepths(5000)
  57. }
  58. theButton.onRollOut=function(){
  59. //set a variable
  60. _root.menu["but"+this.thisNum].overMe=false;
  61. }
  62. }

Anbei die fla
Angehängte Dateien
Dateityp: zip slideIn_menu.fla.zip (3,6 KB, 14x aufgerufen)

Geändert von McCoy (08-06-2005 um 19:24 Uhr)
McCoy ist offline   Mit Zitat antworten
Alt 08-06-2005, 19:57   #2 (permalink)
Neuer User
 
Registriert seit: Jun 2004
Beiträge: 23
erledigt!

oh, mann sorry leute...

ich bin heute nicht so gut drauf...

ich konnte es lösen... ganz billig...

Im jeweiligen Schlüssebild wo die buttons liegen folgender Code:
but1.onRelease = function() {
trace("tu was")
};

Typischer Fall von ERST LAAAANGE Googlen dann Posten...

Sry...
McCoy ist offline   Mit Zitat antworten
Alt 08-06-2005, 20:32   #3 (permalink)
tracer
 
Benutzerbild von andretti
 
Registriert seit: Jun 2004
Beiträge: 4.415
es ginge auch so:
ActionScript:
  1. buttonNames = [["Home", "home.swf"], ["About", "about.swf"], ["Service", "service.swf"], ["Links", "service.swf"], ["Contact", "contact.swf"]];
  2. for (n=0; n<buttonNames.length; n++) {
  3.     var a = buttonNames[n];
  4.     var bezeichner = a[0];
  5.     var datei = a[1];
  6.     _root.menu["but"+n].T_tf.autoSize = "center";
  7.     _root.menu["but"+n].T_tf.text = bezeichner;
  8.     for (z=0; z<buttonNames.length; z++) {
  9.         _root.menu["but"+z].onRelease = function() {
  10.             _root.MC_siteHolder.loadMovie(datei);
  11.         };
  12.     }
  13. }

wermuthstropfen:

WARUM WERDEN NICHT ALLE MC's mit namen befüllt & verlinkt?

der erste mc wird immer ausgelassen......
__________________
Viola per Sempre
Alle Angaben ohne Gewehr!
trace your open mind in variables !
andretti
ActionScript Dictionary

Geändert von andretti (09-06-2005 um 06:25 Uhr)
andretti ist offline   Mit Zitat antworten
Alt 09-06-2005, 07:05   #4 (permalink)
tracer
 
Benutzerbild von andretti
 
Registriert seit: Jun 2004
Beiträge: 4.415
ActionScript:
  1. buttonNames = [["Home", "home.swf"], ["About", "about.swf"], ["Service", "service.swf"], ["Links", "links.swf"], ["Contact", "contact.swf"]];
  2. for (n=0; n<buttonNames.length; n++) {
  3.     var a = buttonNames[n];
  4.     var bezeichner = a[0];
  5.     var datei = a[1];
  6.     _root.menue["but"+(n+1)].T_tf.autoSize = "center";
  7.     _root.menue["but"+(n+1)].T_tf.text = bezeichner;
  8.     _root.menue["but"+(n+1)].datei = datei;
  9.     for (z=0; z<buttonNames.length; z++) {
  10.         _root.menue["but"+(z+1)].onRelease = function() {
  11.             _root.MC_siteHolder.loadMovie(this.datei);
  12.         };
  13.     }
  14. }
  15.  
  16. //so funganiert des !
  17.  
__________________
Viola per Sempre
Alle Angaben ohne Gewehr!
trace your open mind in variables !
andretti
ActionScript Dictionary

Geändert von andretti (09-06-2005 um 07:07 Uhr)
andretti ist offline   Mit Zitat antworten
Alt 09-06-2005, 10:44   #5 (permalink)
Pending…
 
Benutzerbild von psyk
 
Registriert seit: Jul 2002
Ort: Hamburg
Beiträge: 3.866
@ andretti: Da kann ich mich nur selbst zitieren:
"Warum einfach wenn es auch kompliziert geht!"

Was soll denn die zweite for-Schleife?
ActionScript:
  1. var buttonNames = ["Home", "About", "Service", "Links", "Contact"];
  2. for (n=0; n<buttonNames.length; n++) {
  3.         _root.menue["but"+(n+1)].T_tf.autoSize = "center";
  4.         _root.menue["but"+(n+1)].T_tf.text = buttonNames[n];
  5.         _root.menue["but"+(n+1)].datei =n;
  6.         _root.menue["but"+(n+1)].onRelease = function() {
  7.                 _root.MC_siteHolder.loadMovie(buttonNames[this.datei]+".swf");
  8. trace("lade Datei "+buttonNames[this.datei]+".swf")
  9.         }
  10. }
__________________
:: Warum einfach, wenn's auch kompliziert geht! ::
psyk ist offline   Mit Zitat antworten
Alt 13-06-2005, 10:44   #6 (permalink)
tracer
 
Benutzerbild von andretti
 
Registriert seit: Jun 2004
Beiträge: 4.415
jo, is schon was wahres dran;
aber groß-kleinschreibung? button-name versus dateiname?
__________________
Viola per Sempre
Alle Angaben ohne Gewehr!
trace your open mind in variables !
andretti
ActionScript Dictionary
andretti ist offline   Mit Zitat antworten
Alt 13-06-2005, 15:21   #7 (permalink)
Pending…
 
Benutzerbild von psyk
 
Registriert seit: Jul 2002
Ort: Hamburg
Beiträge: 3.866
Geht alles, guckst du hier.
ActionScript:
  1. ...
  2. _root.MC_siteHolder.loadMovie(buttonNames[this.datei].toLowerCase()+".swf");
  3. trace("lade Datei "+buttonNames[this.datei].toLowerCase()+".swf")
  4. ...
__________________
:: Warum einfach, wenn's auch kompliziert geht! ::
psyk ist offline   Mit Zitat antworten
Alt 13-06-2005, 18:40   #8 (permalink)
tracer
 
Benutzerbild von andretti
 
Registriert seit: Jun 2004
Beiträge: 4.415
__________________
Viola per Sempre
Alle Angaben ohne Gewehr!
trace your open mind in variables !
andretti
ActionScript Dictionary

Geändert von andretti (13-06-2005 um 18:41 Uhr)
andretti 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 01:46 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele