AS 2 [RESOLVED] Anybody see what could be wrong with these tweens?
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] Anybody see what could be wrong with these tweens?

  1. #1
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    365

    resolved [RESOLVED] Anybody see what could be wrong with these tweens?

    Hi,

    I had read it was advisable to remove clips variables listeners and such before running the code that would load or start them off and I have tried here but, eventhough the tweens work if you run the mouse slowly on them, they act crazy and appear anywhere in the movieclip otherwise.

    I had even changed their placing trying to set the tweened clips on full integer values, but I must be doing something wrong...

    Code:
    if (_root.language != "english")
    {
    	Object(this).avuiDummy_btn.onRollOver = function():Void 
    	{
    		avui_btn.removeMovieClip();
    		periodico1_btn.removeMovieClip();
    		periodico2_btn.removeMovieClip();
    		periodico3_btn.removeMovieClip();
    		periodico4_btn.removeMovieClip();
    
    		attachMovie("avui_btn","avui_btn",avui_btn.getNextHighestDepth());
    		avui_btn._y = this._y;
    
    		new Tween(avui_btn, "_x", Bounce.easeOut, this._x + 72, this._x + 124, 0.5, true);
    	};
    
    	Object(this).avuiDummy_btn.onRollOut = function():Void 
    	{
    		avui_btn.removeMovieClip();
    	};
    
    	Object(this).avuiDummy_btn.onRelease = function():Void 
    	{
    		getURL("l", "_blank");
    	};
    }
    else
    {
    	Object(this).avuiDummy_btn.onRollOver = function():Void 
    	{
    		avui_btn.removeMovieClip();
    		periodico1_btn.removeMovieClip();
    		periodico2_btn.removeMovieClip();
    		periodico3_btn.removeMovieClip();
    		periodico4_btn.removeMovieClip();
    
    		attachMovie("avui_btn","avui_btn",avui_btn.getNextHighestDepth());
    		avui_btn._y = this._y;
    
    		new Tween(avui_btn, "_x", Bounce.easeOut, this._x + 72, this._x + 124, 0.5, true);
    	};
    
    	Object(this).avuiDummy_btn.onRollOut = function():Void 
    	{
    		avui_btn.removeMovieClip();
    	};
    
    	Object(this).avuiDummy_btn.onRelease = function():Void 
    	{
    		_root.createEmptyMovieClip("contenidor9",_root.getNextHighestDepth());
    		_root.contenidor9._x = 416;
    		_root.contenidor9._y = 232;
    
    		loadMovie("tradAvui.swf", _root.contenidor9);
    		avui_btn.removeMovieClip();
    	};
    }
    
    Object(this).periodicoDummy_btn.onRollOver = function():Void 
    {
    	avui_btn.removeMovieClip();
    
    	attachMovie("periodico1_btn","periodico1_btn",getNextHighestDepth());
    	periodico1_btn._y = this._y;
    
    	var myTween = new Tween(periodico1_btn, "_x", Bounce.easeOut, this._x + 72, this._x + 98, 0.3, true);
    
    	myTween.onMotionFinished = function()
    	{
    		runOtherTweens();
    	};
    };
    
    Object(this).periodicoDummy_btn.onRollOut = function():Void 
    {
    	periodico1_btn.removeMovieClip();
    	periodico2_btn.removeMovieClip();
    	periodico3_btn.removeMovieClip();
    	periodico4_btn.removeMovieClip();
    };
    
    function runOtherTweens()
    {
    	attachMovie("periodico2_btn","periodico2_btn",getNextHighestDepth());
    
    	periodico2_btn._x = this._x + 404;
    	new Tween(periodico2_btn, "_y", Elastic.easeOut, periodico1_btn._y, periodico1_btn._y + 19, 0.5, true);
    
    	periodico2_btn.onRelease = function()
    	{
    		getURL("l", "_blank");
    	};
    
    	attachMovie("periodico3_btn","periodico3_btn",getNextHighestDepth());
    	periodico3_btn._x = this._x + 404;
    
    	new Tween(periodico3_btn, "_y", Elastic.easeOut, periodico1_btn._y, periodico1_btn._y + 37, 0.5, true);
    
    	periodico3_btn.onRelease = function():Void 
    	{
    		getURL("l", "_blank");
    	};
    
    	attachMovie("periodico4_btn","periodico4_btn",getNextHighestDepth());
    	periodico4_btn._x = this._x + 404;
    
    	new Tween(periodico4_btn, "_y", Elastic.easeOut, periodico1_btn._y, periodico1_btn._y + 55, 0.5, true);
    
    	periodico4_btn.onRelease = function():Void 
    	{
    		getURL("l", "_blank");
    	};
    }
    
    periodico1_btn.onRelease = function():Void 
    {
    	getURL("l", "_blank");
    };
    you can see it running at http://webs.ono.com/jpdurba

    am attaching the fla as well,

    thanks in advance

  2. #2
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    I dont have flash in this laptop, so i cant help further. But here is a tip that helps a lot with buttons and movieclips dragging:











    periodico2_btn.onRelease = periodico2_btn.onReleaseOutside = function()
    {
    getURL("l", "_blank");
    };


    periodico3_btn.onRelease = periodico3_btn.onReleaseOutside = function():Void
    {
    getURL("l", "_blank");
    };



    periodico4_btn.onRelease = periodico4_btn.onReleaseOutside = function():Void
    {
    getURL("l", "_blank");
    };
    }

    periodico1_btn.onRelease = periodico1_btn.onReleaseOutside = function():Void
    {
    getURL("l", "_blank");
    };
    Last edited by angelhdz; 10-09-2013 at 12:41 PM.
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

  3. #3
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    365
    Thanks, Angel,

    I've changed the code and it seems to work without flaws now. Even the tween speed seems to have changed and runs smoothly.

    thanks a lot,

  4. #4
    Member
    Join Date
    Aug 2012
    Posts
    78
    Hey, it no fix i looker, it move all the place still !!
    Hobbies btn and the periodico

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