Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 04-05-2006, 20:16   #1 (permalink)
Neuer User
 
Registriert seit: Mar 2006
Beiträge: 52
Post sorry for my language but need urgent help!!!!

hi all
I am trying to create sliding navi based on tutorial and stuck with following problem:

situation: mouseOver on button "hit" makes
"drop" sliding object slide in/slide out

I am trying to extend:
when clicked should stay open, until next button clicked.

first here the code on sliding object ( instance:drop)
ActionScript:
  1. onClipEvent (load) {
  2.     roll = false;
  3.     menu = false;
  4.     open = false;
  5.     this._visible = false;
  6.     y_start = this._y;
  7.     y_stop = 36;
  8.     y_max = y_stop+this._height;
  9. }
  10. onClipEvent (enterFrame) {
  11.     mouse_x = _parent._xmouse;
  12.     mouse_y = _parent._ymouse;
  13.     menu_left = this._x;
  14.     menu_right = this._x+this._width;
  15.     menu_top = 0;
  16.     menu_bottom = this._y+this._height;
  17.     if (menu_left<mouse_x && mouse_x<menu_right && menu_top<mouse_y && mouse_y<menu_bottom) {
  18.         menu = true;
  19.     } else {
  20.         menu = false;
  21.     }
  22.     if ((roll || open) && (!open || menu)) {
  23.         this._visible = true;
  24.         speed = (y_max-menu_bottom)*0.300000;
  25.         if (y_stop-1<this._y) {
  26.             this._y = y_stop;
  27.             open = true;
  28.             roll = false;
  29.         } else {
  30.             _y = _y+speed;
  31.         }
  32.     }
  33.     if (open && !menu) {
  34.         speed = (y_max-menu_bottom)*0.500000+1;
  35.         if (this._y<y_start+1) {
  36.             _y = y_start;
  37.             open = false;
  38.             _parent.hit.gotoAndStop(1);
  39.             this._visible = false;
  40.         } else {
  41.             _y = _y-speed;
  42.         }
  43.     }
  44. }

and button code
ActionScript:
  1. hit.onRollOver = function() {
  2.     if (!drop.roll) {
  3.         drop.roll = true;
  4.     } else {
  5.         drop.roll = false;
  6.     }
  7. };

I tried following way
ActionScript:
  1. hit.onRelease = function() {
  2.      _parent.drop.open = true;
  3. };
but my dilemma...
ActionScript:
  1. if (menu_left<mouse_x && mouse_x<menu_right && menu_top<mouse_y && mouse_y<menu_bottom) {
the sliding object reacts to mouse pos.....as soon as I leave the slidng area the object pushes back.

trouble..trouble...
how I do pass an argument when hit button is clicked sliding object to stay open by disabling the mousepos checker and slide up again when next button clicked??????


very urgent need help :-(

best regards
zooray
zooray ist offline   Mit Zitat antworten
Alt 04-05-2006, 22:05   #2 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
Hi
Can we have the fla, to play with pleace
Only the menue without the Content, with Content is maybe to big for upload
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake ist offline   Mit Zitat antworten
Alt 05-05-2006, 06:45   #3 (permalink)
Neuer User
 
Registriert seit: Mar 2006
Beiträge: 52
RustyCake
thanks for the reply...here is the file!!
Angehängte Dateien
Dateityp: rar slidemenu.rar (7,6 KB, 27x aufgerufen)
zooray ist offline   Mit Zitat antworten
Alt 05-05-2006, 15:39   #4 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
Can youn show me the Page where you find that tutorial
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake ist offline   Mit Zitat antworten
Alt 05-05-2006, 19:13   #5 (permalink)
Neuer User
 
Registriert seit: Mar 2006
Beiträge: 52
well rustycake I don`t remember...downloaded long time a go
zooray ist offline   Mit Zitat antworten
Alt 06-05-2006, 00:05   #6 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
@ zooray
This kind of script-style (the "enterFrame" runs the whole time, you can't stop it!! in Flash MX is this no problem) is not so comfortable, i try to find out a better way!
i hope you'r not under pressure, it will take a while
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake ist offline   Mit Zitat antworten
Alt 06-05-2006, 00:20   #7 (permalink)
Neuer User
 
Registriert seit: Mar 2006
Beiträge: 52
a bit of dilemma ...isn`t it ;-)
zooray ist offline   Mit Zitat antworten
Alt 06-05-2006, 00:50   #8 (permalink)
Banned
 
Registriert seit: Apr 2006
Beiträge: 246
hadent time to test... think od that solution

a general function on the main time line
PHP-Code:
openclose = function(TheInstance){
//just for the callback function
_global.firsttime=false

//the intervall
var intervalId:Number;
var 
duration:Number 20;
intervalId setInterval(this"executeCallback"duration);
}


function 
executeCallback():Void {

if (
_global.firsttime != true){
InstancePathArray //please here fill in the pathes to all sliding menues
_global.firsttime=true;
    
roll false;
    
menu false;
    
open false;
    
TheInstance._visible false;
    
y_start TheInstance._y;
    
y_stop 36;
    
y_max y_stop+this._height;
    }
    
//the functionas that are called by the interval during its opened or closed

    
mouse_x TheInstance._parent._xmouse;
    
mouse_y TheInstance._parent._ymouse;
    
menu_left TheInstance._x;
    
menu_right TheInstance._x+TheInstance._width;
    
menu_top 0;
    
menu_bottom TheInstance._y+TheInstance._height;

    
// end if
    
if (roll || open) {
        
TheInstance._visible true;
        
speed = (y_max-menu_bottom)*0.300000;
        if (
y_stop-1<TheInstance._y) {
            
TheInstance._y y_stop;
            
open true;
            
roll false;

_global.NowOpened=true
            
        
} else {
            
TheInstance._y TheInstance._y+speed;
            for (
i=0i<InstancePathArrayi++){
            
    
speed = (y_max-menu_bottom)*0.500000+1;//slinding in any menu that might be open
        
if (InstancePathArray[i]._y<y_start+1) {
            
InstancePathArray[i]._y y_start;
            
open false;
            
InstancePathArray[i]._parent.hit.gotoAndStop(1);
            
InstancePathArray[i]._visible false;
_global.Allclosed=true;

        } else {
            
InstancePathArray[i]._y InstancePathArray[i]._y-speed;
        }
//end if
        
}//end for i
            
            
        
if(_global.Allclosed && _global.NowOpened){
_global.Allclosed _global.NowOpened false;
clearInterval(intervalId);//deleting the intervall stoping the function
        
}
        
// end if
    
}
    
// end if 
    
    

called by each button reffering to its instance
PHP-Code:
hit.onRollOver = function() {
    if (!
drop.roll) {
        
drop.roll true;// here u wheter need to use a _global or a _root
        
this.gotoAndStop(3);
        
_root.openclose("hit");//if u would use the code on the button... u could use here      this.toString()          instead of "hit"
    
} else {
        
drop.roll false;
    }
}; 
not tested not ready to use but a hint maybe

greetz




EDIT: i changed some code in the callback function for the clearing of the interval

Geändert von ChickenWing (06-05-2006 um 02:28 Uhr)
ChickenWing ist offline   Mit Zitat antworten
Alt 06-05-2006, 01:53   #9 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
@ ChickenWing
Na Super, wenn des hinhaut brauch ich nicht
Aber hier fehlt eine Bedingung "if ((roll || open) && (!open || )) {" !
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake ist offline   Mit Zitat antworten
Alt 06-05-2006, 02:32   #10 (permalink)
Banned
 
Registriert seit: Apr 2006
Beiträge: 246
Zitat:
Zitat von RustyCake
@ ChickenWing
Na Super, wenn des hinhaut brauch ich nicht
Aber hier fehlt eine Bedingung "if ((roll || open) && (!open || )) {" !
ups du hast recht danke das unnötige menu hatte ich schon gelöscht und hatte den rest noch offen gelassen, ich arbeite immer mit multitasking, daher auch manchmal solce fehler, habs oben nun korrigiert

and to be a friendly forum user:

from Rusty: ... fine ChickkenWing if that works , i dont need to... but hthere is an condition left here "if ((roll || open) && (!open || )) {" open!

from me: .... ohh you are right, i deleted the not needed menu bevore an left that open, iam working in multitasking mode... that4 sometimes rhose mistake, fixed it up above

Geändert von ChickenWing (06-05-2006 um 02:36 Uhr)
ChickenWing ist offline   Mit Zitat antworten
Alt 06-05-2006, 10:32   #11 (permalink)
Neuer User
 
Registriert seit: Mar 2006
Beiträge: 52
Hi RustyCake,ChickenWing
thanks for your reply!

I will try the method as ChickenWing replied but didn`t get the part "if ((roll || open) && (!open || )) {" open!"

is this correct way?
ActionScript:
  1. if ((roll || open) && (!open || )) {" open!
  2.         TheInstance._visible = true;
  3.         speed = (y_max-menu_bottom)*0.300000;
  4.         if (y_stop-1<TheInstance._y) {
  5.             TheInstance._y = y_stop;
  6.             open = true;
  7.             roll = false;
  8. _global.NowOpened=true
@ ChickenWing...could you please give me an example on how to use this.toString() instead of hit.

many thanks guys....I will post the fla as soon as I get this to work
zooray ist offline   Mit Zitat antworten
Alt 06-05-2006, 10:58   #12 (permalink)
Banned
 
Registriert seit: Apr 2006
Beiträge: 246
ok i changed/editetd the above code last night b4 my second post here...

change this:

PHP-Code:
if ((roll || open) && (!open || )) {" open! 
to this
PHP-Code:
if ((roll || open) { 
lika also up above in the code

an example of the button code would be:


PHP-Code:
on(RollOver) {
    if (!
drop.roll) {
        
drop.roll true;// here u wheter need to use a _global or a _root
        
this.gotoAndStop(3);
        
_root.openclose(this.toString());//here u could use this to string, because this will send the full path to the movie but not as string so toString is added.
    
} else {
        
drop.roll false;
    }
}; 
if u need to affect only a click u should use Release or Press instead of RollOver

that belongs to u

dont forget to make the array for all buttons means u need to make an array witch holds the full path to each sliding menu... and i actually found annother trap while writing here...


PHP-Code:
openclose = function(TheInstance){
//just for the callback function
_global.firsttime=false;

//the intervall
var intervalId:Number;
var 
duration:Number 20;
intervalId setInterval(this"executeCallback"duration);
}


function 
executeCallback():Void {

if (
_global.firsttime != true){
InstancePathArray //please here fill in the full pathes to all sliding menues
_global.firsttime=true;
    
roll false;
    
menu false;
    
open false;
    
TheInstance._visible false;
    
y_start TheInstance._y;
    
y_stop 36;
    
y_max y_stop+this._height;
    }
    
//the functionas that are called by the interval during its opened or closed

    
mouse_x TheInstance._parent._xmouse;
    
mouse_y TheInstance._parent._ymouse;
    
menu_left TheInstance._x;
    
menu_right TheInstance._x+TheInstance._width;
    
menu_top 0;
    
menu_bottom TheInstance._y+TheInstance._height;

    
// end if
    
if (roll || open) {
        
TheInstance._visible true;
        
speed = (y_max-menu_bottom)*0.300000;
        if (
y_stop-1<TheInstance._y) {
            
TheInstance._y y_stop;
            
open true;
            
roll false;

_global.NowOpened=true
            
        
} else {
            
TheInstance._y TheInstance._y+speed;
            for (
i=0i<InstancePathArrayi++){
            if (
InstancePathArray[i] != TheInstance){ //here check if the actual object is the Instance to slide out
    
speed = (y_max-menu_bottom)*0.500000+1;//slinding in any menu that might be open
        
if (InstancePathArray[i]._y<y_start+1) {
            
InstancePathArray[i]._y y_start;
            
open false;
            
InstancePathArray[i]._parent.hit.gotoAndStop(1);
            
InstancePathArray[i]._visible false;
_global.Allclosed=true;

        } else {
            
InstancePathArray[i]._y InstancePathArray[i]._y-speed;
        }
//end if
}//en dif
        
}//end for i
            
            
        
if(_global.Allclosed && _global.NowOpened){
_global.Allclosed _global.NowOpened false;
clearInterval(intervalId);//deleting the intervall stoping the function
        
}
        
// end if
    
}
    
// end if 
    
    

when u filled in the buttoncode ton maybe 2 or 3 buttons and filled in the array with the pathes.. it should work...

if it doesent please come back...

might those synthax here ...

InstancePathArray[i]._visible

must be changed to this:

_root[InstancePathArray[i]]._visible

Geändert von ChickenWing (06-05-2006 um 11:06 Uhr)
ChickenWing ist offline   Mit Zitat antworten
Alt 06-05-2006, 13:52   #13 (permalink)
Neuer User
 
Registriert seit: Mar 2006
Beiträge: 52
hey many thanks!!!
I will reply here tomorrow....I am invited to a birthday today....I need to take a shower ...... sweet babes out there
zooray ist offline   Mit Zitat antworten
Alt 08-05-2006, 22:02   #14 (permalink)
Neuer User
 
Registriert seit: Mar 2006
Beiträge: 52
hi sorry...for replying so late!!
I tried as code provided but still it don`t work, though it dont throws error!!
therefore, could you please check updated fla file.

Mr. Chickenwing
I am having a bit trouble understanding below code part....
InstancePathArray = //please here fill in the full pathes to all sliding menues

though I have changed from
// InstancePathArray[i]._visible = false;
to
_root[InstancePathArray[i]]._visible
but still not working

thanks
Angehängte Dateien
Dateityp: rar slidemenu2.rar (12,2 KB, 11x aufgerufen)
zooray ist offline   Mit Zitat antworten
Alt 10-05-2006, 00:22   #15 (permalink)
brand new user
 
Benutzerbild von RustyCake
 
Registriert seit: May 2002
Ort: Laimbach 6 1/2
Beiträge: 16.884
Hi zooray
For a simple dropdown-menue, with a freeze-button is that way to laborious!
Normal i dont use frame-tweens, but what is normal?
So can we use frames (like a simple rewinder) ore the full-script-complicated-version??
Whaddayathink?
__________________
Bitte keine Fragen, zu Flash per PM. Dazu ist das Forum da. Danke MFG_RustyCake!
"Wer tanzen will, muß erst gehen lernen"
RustyCake 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 05:50 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele