Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: Using MC Tween Add On Question...

  1. #11
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    verified... this line in the AS file:

    Code:
    // When the mouse exits the menu option.. go back up.
    	myButtons[i].onRollout = myButtons[i].onReleaseOutside = function() {
    		this.tween("_x", this.originalX, 0.5);
    is telling it only use the rollOut when outside of that area is released, meaning you have to click elsewhere on the stage to make the rollOut function work.

    you can achieve the onRollOut function by removing
    Code:
    = myButtons[i].onReleaseOutside


    <EDIT>
    OH, and it should be onRollOut not onRollout
    </EDIT>
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  2. #12
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by BLiZZaRD
    verified... this line in the AS file:

    Code:
    // When the mouse exits the menu option.. go back up.
    	myButtons[i].onRollout = myButtons[i].onReleaseOutside = function() {
    		this.tween("_x", this.originalX, 0.5);
    is telling it only use the rollOut when outside of that area is released, meaning you have to click elsewhere on the stage to make the rollOut function work.

    you can achieve the onRollout function by removing
    Code:
    = myButtons[i].onReleaseOutside
    Can I make all the buttons move to the right at the same time? If a button is rolled over?

  3. #13
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Wouldn't that defeat the whole point of this AS script?

    For the original problem replace your code with this:

    Code:
    // This is an array, a list of the buttons used.
    var myButtons = [this.right_1, this.right_2, this.right_3, this.right_4];
    
    // Loops on all buttons from the first to the last one
    for (var i=0; i<myButtons.length; i++) {
    	// Sets its original X value. This will be used later for reference.
    	myButtons[i].originalX = myButtons[i]._x;
    
    	// When the mouse rolls over this menu option... go down just a bit.
    	// NOTICE: I'm not taking into consideration the problem of having the hit area going down and "moving" the
    	// mouse area and out of the button (possible rollover flicking). This is just a simple example afterall.
    	myButtons[i].onRollOver = function() {
    				this.tween("_x", this.originalX + 5, 1);
    	};
    	// When the mouse exits the menu option.. go back up.
    	myButtons[i].onRollOut = function() {
    		this.tween("_x", this.originalX, 0.5);
    	};
    	// When the mouse clicks.. activate it!
    	myButtons[i].onRelease = function() {
    		this._parent.activateItem (this);
    		// *** Add some function here or somewhere else to handle real button actions!
    		trace ("Hey, button "+this+" was clicked.");
    	};
    }
    
    this.activateItem = function(item) {
    	// Function that activates a button.
    	
    	// Checks if there's an activated item already; if so, deactivates it.
    	if (this.currentItem != false) this.deActivateItem();
    	
    	// Activates it, finally
    	this.currentItem = item;
    	this.currentItem.alphaTo (50, 1); // makes it 'disabled'
    	this.currentItem.enabled = false; // makes it a disabled button, so it won't receive mouse events
    };
    
    this.deActivateItem = function() {
    	// Deactivates the current activated menu item.
    	this.currentItem.enabled = true; // back to a normal button/movieclip
    	this.currentItem.alphaTo (100, 0.5); // back to its original opacity
    	this.currentItem.tween("_x", this.currentItem.originalX, 0.5); // back to its original position
    	this.currentItem = undefined;
    };
    
    this.stop();
    This will enable the on mouseOut function you were after
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  4. #14
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by BLiZZaRD
    Wouldn't that defeat the whole point of this AS script?

    For the original problem replace your code with this:

    Code:
    // This is an array, a list of the buttons used.
    var myButtons = [this.right_1, this.right_2, this.right_3, this.right_4];
    
    // Loops on all buttons from the first to the last one
    for (var i=0; i<myButtons.length; i++) {
    	// Sets its original X value. This will be used later for reference.
    	myButtons[i].originalX = myButtons[i]._x;
    
    	// When the mouse rolls over this menu option... go down just a bit.
    	// NOTICE: I'm not taking into consideration the problem of having the hit area going down and "moving" the
    	// mouse area and out of the button (possible rollover flicking). This is just a simple example afterall.
    	myButtons[i].onRollOver = function() {
    				this.tween("_x", this.originalX + 5, 1);
    	};
    	// When the mouse exits the menu option.. go back up.
    	myButtons[i].onRollOut = function() {
    		this.tween("_x", this.originalX, 0.5);
    	};
    	// When the mouse clicks.. activate it!
    	myButtons[i].onRelease = function() {
    		this._parent.activateItem (this);
    		// *** Add some function here or somewhere else to handle real button actions!
    		trace ("Hey, button "+this+" was clicked.");
    	};
    }
    
    this.activateItem = function(item) {
    	// Function that activates a button.
    	
    	// Checks if there's an activated item already; if so, deactivates it.
    	if (this.currentItem != false) this.deActivateItem();
    	
    	// Activates it, finally
    	this.currentItem = item;
    	this.currentItem.alphaTo (50, 1); // makes it 'disabled'
    	this.currentItem.enabled = false; // makes it a disabled button, so it won't receive mouse events
    };
    
    this.deActivateItem = function() {
    	// Deactivates the current activated menu item.
    	this.currentItem.enabled = true; // back to a normal button/movieclip
    	this.currentItem.alphaTo (100, 0.5); // back to its original opacity
    	this.currentItem.tween("_x", this.currentItem.originalX, 0.5); // back to its original position
    	this.currentItem = undefined;
    };
    
    this.stop();
    This will enable the on mouseOut function you were after
    Thanks Bliazzard... Yea I guess it would, so what would I edit if I wanted to achive that? Basically when you roll over any of the red buttons I want all the buttons to move either to the right or left depending on which side they are on of the activated button... Get what I mean?

  5. #15
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by BLiZZaRD
    Wouldn't that defeat the whole point of this AS script?

    For the original problem replace your code with this:

    Code:
    // This is an array, a list of the buttons used.
    var myButtons = [this.right_1, this.right_2, this.right_3, this.right_4];
    
    // Loops on all buttons from the first to the last one
    for (var i=0; i<myButtons.length; i++) {
    	// Sets its original X value. This will be used later for reference.
    	myButtons[i].originalX = myButtons[i]._x;
    
    	// When the mouse rolls over this menu option... go down just a bit.
    	// NOTICE: I'm not taking into consideration the problem of having the hit area going down and "moving" the
    	// mouse area and out of the button (possible rollover flicking). This is just a simple example afterall.
    	myButtons[i].onRollOver = function() {
    				this.tween("_x", this.originalX + 5, 1);
    	};
    	// When the mouse exits the menu option.. go back up.
    	myButtons[i].onRollOut = function() {
    		this.tween("_x", this.originalX, 0.5);
    	};
    	// When the mouse clicks.. activate it!
    	myButtons[i].onRelease = function() {
    		this._parent.activateItem (this);
    		// *** Add some function here or somewhere else to handle real button actions!
    		trace ("Hey, button "+this+" was clicked.");
    	};
    }
    
    this.activateItem = function(item) {
    	// Function that activates a button.
    	
    	// Checks if there's an activated item already; if so, deactivates it.
    	if (this.currentItem != false) this.deActivateItem();
    	
    	// Activates it, finally
    	this.currentItem = item;
    	this.currentItem.alphaTo (50, 1); // makes it 'disabled'
    	this.currentItem.enabled = false; // makes it a disabled button, so it won't receive mouse events
    };
    
    this.deActivateItem = function() {
    	// Deactivates the current activated menu item.
    	this.currentItem.enabled = true; // back to a normal button/movieclip
    	this.currentItem.alphaTo (100, 0.5); // back to its original opacity
    	this.currentItem.tween("_x", this.currentItem.originalX, 0.5); // back to its original position
    	this.currentItem = undefined;
    };
    
    this.stop();
    This will enable the on mouseOut function you were after
    Also I'm confused by replacing the code I can't see what the difference is?

  6. #16
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    So what you want is your 5 buttons to move in sequence?

    so if right1 is hovered, you want right2, right3, right4 and right5 to move to the right, and if right3 is hovered, you want right1 and right2 to go left, and right4 and right5 to go right, is that correct?


    it is doable, and your buttons are sufficient size... let me think a minute.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  7. #17
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    YAY! I can't believe you understood what I was saying ha! Yes that's what I want!

  8. #18
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    We are going to have to resort to if/else statements.

    something like:

    if button1 moves, move all
    else if buttons 2 moves, move 2 -4, and move 1 left

    etc..

    problem is I just can't think of WHERE...
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  9. #19
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by BLiZZaRD
    We are going to have to resort to if/else statements.

    something like:

    if button1 moves, move all
    else if buttons 2 moves, move 2 -4, and move 1 left

    etc..

    problem is I just can't think of WHERE...
    Ah ok I gotcha... but where is the million dolalr question!

  10. #20
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Logically it will go in this section:

    Code:
    	myButtons[i].onRollOver = function() {
    		this.tween("_x", this.originalX + 5, 1);
    		};
    	// When the mouse exits the menu option.. go back up.
    	myButtons[i].onRollOut = function() {
    		this.tween("_x", this.originalX, 0.5);
    	};
    how to write it becomes a problem then, though, as we are trying to pin point one of the i's from the array.

    Code:
    if(i==1){
       this.move_them_all_dammit!;
    }
    didn't work
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

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