A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: damn my crap coding

  1. #1
    Senior Member liquidfists uk's Avatar
    Join Date
    Mar 2003
    Location
    uk
    Posts
    318

    damn my crap coding

    can anyone tell me whats wrong with my code?

    code:

    menuText = ["home","links","forum","spicy","oaddball"];
    menus = [home1,home2,home3,home4,home5];

    for (i = 0; i < menuText.length; ++i){
    var mc = menus[i];
    mc.escale = 100;
    mc.ey = mc._y;
    mc.cState = false;
    mc.lippy.text = menuText[i];
    mc.lippy.autoSize = true;
    }
    tweenMe = function(){
    var d = (this.escale - this._xscale)/speed;
    var c = (this.ey - this._y)/speed;
    this._y += c;
    this._yscale += d;
    this._xscale += d;


    }
    rollOverMe = function(){
    this.cState = true;
    this.escale = 160;
    _root.menus[i].ey+=10;
    }

    rollOutMe = function(){
    this.cState = false;
    this.cState = 0;
    this.escale = 100;
    }
    daft = function(){
    for(var i=0;i<5;i++){
    if(_root["home"+i].cState == false && _root["home"+i]._y<this._y){
    _root["home"+i].ey-=speed;
    }else if (_root["home"+i].cState == false && _root["home"+i]._y>this._y){
    _root["home"+i].ey+=speed;
    }
    }
    }
    speed = 10;

    home1.onEnterFrame = tweenMe;
    home2.onEnterFrame = tweenMe;
    home3.onEnterFrame = tweenMe;
    home4.onEnterFrame = tweenMe;
    home5.onEnterFrame = tweenMe;
    home1.onRollOver = rollOverMe;
    home2.onRollOver = rollOverMe;
    home3.onRollOver = rollOverMe;daft;
    home4.onRollOver = rollOverMe;
    home5.onRollOver = rollOverMe;
    home1.onRollOut = rollOutMe;
    home2.onRollOut = rollOutMe;
    home3.onRollOut = rollOutMe;
    home4.onRollOut = rollOutMe;
    home5.onRollOut = rollOutMe;



    im trying to get the y axis of the buttons that im not rolling over to move up or down depening on wether there current y pos is less or more than the current (in use) buttons y pos.

    please help!

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    A few problems.

    * The daft function is never used.

    * This line doesn't make sense.

    home3.onRollOver = rollOverMe;daft;

    * You are increasing the value of 'ey' in your rollOverMe function, but nothing ever sets it back.

  3. #3
    Senior Member liquidfists uk's Avatar
    Join Date
    Mar 2003
    Location
    uk
    Posts
    318
    you wrote most of this code after i made that apple menu style thing but u took the _y movement out of my original so i waas trying to add it to yours!

    with the code i have just posted no y movement ever happens!

  4. #4
    Senior Member liquidfists uk's Avatar
    Join Date
    Mar 2003
    Location
    uk
    Posts
    318
    its ok i sorted it with this code
    code:

    menuText = ["HOME","LINKS","FORUM","SPICY","ODDBALL"];
    menus = [home1,home2,home3,home4,home5];

    for (i = 0; i < menuText.length; ++i){
    var mc = menus[i];
    mc.escale = 100;
    mc.ey = mc._y;
    mc.cState = false;
    mc.lippy.text = menuText[i];
    mc.lippy.autoSize = true;
    }
    tweenMe = function(){
    var d = (this.escale - this._xscale)/speed;
    var c = (this.ey - this._y)/speed;
    this._y += c;
    this._yscale += d;
    this._xscale += d;


    }
    rollOverMe = function(){
    this.cState = true;
    this.escale = 160;
    for(var i=0;i<=5;i++){
    if(_root["home"+i].cState == false && _root["home"+i]._y<this._y){
    _root["home"+i].ey-=distance;
    }else if (_root["home"+i].cState == false && _root["home"+i]._y>this._y){
    _root["home"+i].ey+=distance;
    }
    }
    }

    rollOutMe = function(){
    this.cState = false;
    this.cState = 0;
    this.escale = 100;
    for(var i=0;i<=5;i++){
    if(_root["home"+i].cState == false && _root["home"+i]._y<this._y){
    _root["home"+i].ey+=distance;
    }else if (_root["home"+i].cState == false && _root["home"+i]._y>this._y){
    _root["home"+i].ey-=distance;
    }
    }
    }
    speed = 7;
    distance = 23;
    for(var i=0;i<=5;i++){
    _root["home"+i].onEnterFrame = tweenMe;
    _root["home"+i].onRollOver = rollOverMe;
    _root["home"+i].onRollOut = rollOutMe;
    }

    Last edited by liquidfists uk; 05-16-2004 at 07:59 AM.

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