A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [RESOLVED] need help with dynamic menu!

  1. #1
    Member
    Join Date
    Jun 2006
    Location
    on net
    Posts
    32

    [RESOLVED] need help with dynamic menu!

    Hello,
    I have this script for menu, but I want only the "box5" to work with submenu.
    Any solution for that please?
    Code:
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    _global.slidingMenu = this;
    big_height = 38;
    small_height = 29;
    time_for_animation = 12;
    // Initialization
    box1.id = 1;
    box2.id = 2;
    box3.id = 3;
    box4.id = 4;
    box5.id = 5;
    box6.id = 6;
    box7.id = 7;
    for (var i:Number = 1; i<=7; i++) {
    	this["box"+i].area.onRelease = function() {
    		slidingMenu.moveBoxes(this._parent.id);
    	};
    	
    	this["box"+i].area.onRollOver = function() {
    		slidingMenu.RollOverBoxes(this._parent.id);
    	};
    	
    	this["box"+i].area.onRollOut = this["box"+i].area.onReleaseOutside = function() {
    		slidingMenu.RollOutBoxes(this._parent.id);
    	};
    }
    slidingMenu.RollOverBoxes = function(boxNumber:Number) {
    	if(_root.link<>boxNumber) {
    		var cBox:MovieClip = eval('box'+boxNumber);
    		cBox.title_main.gotoAndPlay("s1");
    	}
    };
    
    
    slidingMenu.RollOutBoxes = function(boxNumber:Number) {
    	if(_root.link<>boxNumber) {
    		var cBox:MovieClip = eval('box'+boxNumber);
    		cBox.title_main.gotoAndPlay("s2");
    	}
    };
    
    // Functions
    slidingMenu.moveBoxes = function(boxNumber:Number) {
    	if(_root.link<>boxNumber and _root.animation==1) {
    	k = 1;
    	//-1239.0
    	
    	eval('box'+_root.link).title_main.gotoAndPlay("s2");
    	eval('box'+_root.link).sub_menu._visible=0;
    	for (var i:Number = 1; i<=10; i++) {
    		var cBox:MovieClip = eval('box'+i);
    		if (i == boxNumber) {
    			_root.link_prev=_root.link;
    			_root.link = boxNumber;
    			eval('box'+_root.link).sub_menu._visible=1;
    		}
    		if (i <= boxNumber) {
    			new Tween(cBox, "_y", Strong.easeOut, cBox._y,(k)*(small_height) - small_height, time_for_animation+k*2, false);
    		} else {
    			new Tween(cBox, "_y", Strong.easeOut, cBox._y, (k)*(small_height)+big_height  - small_height, time_for_animation+k*4, false);
    			
    		}
    		k++;
    	}
    	_root.play();
    	}
    		//
    	//new Tween(_root.pages2, "_y", Strong.easeOut, _root.pages2._y,-329.0 + _root.link*470, time_for_animation+100, false);
    	
    
    };
    
    
    slidingMenu.moveBoxes_start = function(boxNumber:Number) {
    	if(_root.link<>boxNumber) {
    	k = 1;
    	//-1239.0
    	
    	eval('box'+_root.link).title_main.gotoAndPlay("s2");
    	eval('box'+_root.link).sub_menu._visible=0;
    	for (var i:Number = 1; i<=7; i++) {
    		var cBox:MovieClip = eval('box'+i);
    		if (i == boxNumber) {
    			_root.link_prev=_root.link;
    			_root.link = boxNumber;
    			eval('box'+_root.link).sub_menu._visible=1;
    		}
    		if (i <= boxNumber) {
    			new Tween(cBox, "_y", Strong.easeOut, cBox._y,(k)*(small_height) - small_height, time_for_animation+k*7, false);
    		} else {
    			new Tween(cBox, "_y", Strong.easeOut, cBox._y, (k)*(small_height)+big_height  - small_height, time_for_animation+k*14, false);
    			
    		}
    		k++;
    	}
    	}
    		//
    	//new Tween(_root.pages2, "_y", Strong.easeOut, _root.pages2._y,-329.0 + _root.link*470, time_for_animation+100, false);
    	_root.play();
    
    };
    
    //slidingMenu.moveBoxes();

  2. #2
    Member
    Join Date
    Jun 2006
    Location
    on net
    Posts
    32
    Please I need help on this, working on this about 2 weeks but nothing
    I want the sliding and "sub menu" to work only with the "menu 4", see swf.
    Attached Files Attached Files

  3. #3
    Member
    Join Date
    Jun 2006
    Location
    on net
    Posts
    32
    Download the fla,
    any help?
    Attached Files Attached Files

  4. #4
    Member
    Join Date
    Jun 2006
    Location
    on net
    Posts
    32
    I need some help here to find the light!
    I don't want anyone to code for me, just tell me what to change or from where to start.
    Last edited by nzizo; 08-07-2007 at 06:41 AM.

  5. #5
    Member
    Join Date
    Jun 2006
    Location
    on net
    Posts
    32
    Problem solved.
    here the code
    Code:
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    _global.slidingMenu = this;
    big_height = 38;
    small_height = 29;
    time_for_animation = 12;
    // Initialization
    box1.id = 1;
    box2.id = 2;
    box3.id = 3;
    box4.id = 4;
    box5.id = 5;
    box6.id = 6;
    box7.id = 7;
    for (var i:Number = 1; i<=7; i++) {
        if (i == 4) {
            this["box"+i].area.onRelease = function() {
                slidingMenu.moveBoxes(this._parent.id);
            };
        }else{
            this["box"+i].area.onRelease = function(){
                trace("something");
            }
        }
        this["box"+i].area.onRollOver = function() {
            slidingMenu.RollOverBoxes(this._parent.id);
        };
        this["box"+i].area.onRollOut = this["box"+i].area.onReleaseOutside=function () {
            slidingMenu.RollOutBoxes(this._parent.id);
        };
    }
    slidingMenu.RollOverBoxes = function(boxNumber:Number) {
        if (_root.link<>boxNumber) {
            var cBox:MovieClip = eval('box'+boxNumber);
            cBox.title_main.gotoAndPlay("s1");
        }
    };
    slidingMenu.RollOutBoxes = function(boxNumber:Number) {
        if (_root.link<>boxNumber) {
            var cBox:MovieClip = eval('box'+boxNumber);
            cBox.title_main.gotoAndPlay("s2");
        }
    };
    // Functions
    slidingMenu.moveBoxes = function(boxNumber:Number) {
        if (_root.link<>boxNumber and _root.animation == 1) {
            k = 1;
            //-1239.0
            eval('box'+_root.link).title_main.gotoAndPlay("s2");
            eval('box'+_root.link).sub_menu._visible = 0;
            for (var i:Number = 1; i<=10; i++) {
                var cBox:MovieClip = eval('box'+i);
                if (i == boxNumber) {
                    _root.link_prev = _root.link;
                    _root.link = boxNumber;
                    eval('box'+_root.link).sub_menu._visible = 1;
                }
                if (i<=boxNumber) {
                    new Tween(cBox, "_y", Strong.easeOut, cBox._y, (k)*(small_height)-small_height, time_for_animation+k*2, false);
                } else {
                    new Tween(cBox, "_y", Strong.easeOut, cBox._y, (k)*(small_height)+big_height-small_height, time_for_animation+k*4, false);
                }
                k++;
            }
            _root.play();
        }
        //
        //new Tween(_root.pages2, "_y", Strong.easeOut, _root.pages2._y,-329.0 + _root.link*470, time_for_animation+100, false);
    };
    slidingMenu.moveBoxes_start = function(boxNumber:Number) {
        if (_root.link<>boxNumber) {
            k = 1;
            //-1239.0
            eval('box'+_root.link).title_main.gotoAndPlay("s2");
            eval('box'+_root.link).sub_menu._visible = 0;
            for (var i:Number = 1; i<=7; i++) {
                var cBox:MovieClip = eval('box'+i);
                if (i == boxNumber) {
                    _root.link_prev = _root.link;
                    _root.link = boxNumber;
                    eval('box'+_root.link).sub_menu._visible = 1;
                }
                if (i<=boxNumber) {
                    new Tween(cBox, "_y", Strong.easeOut, cBox._y, (k)*(small_height)-small_height, time_for_animation+k*7, false);
                } else {
                    new Tween(cBox, "_y", Strong.easeOut, cBox._y, (k)*(small_height)+big_height-small_height, time_for_animation+k*14, false);
                }
                k++;
            }
        }
        //
        //new Tween(_root.pages2, "_y", Strong.easeOut, _root.pages2._y,-329.0 + _root.link*470, time_for_animation+100, false);
        _root.play();
    };
    //slidingMenu.moveBoxes();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center