A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] .swf not acknowledging some AS

  1. #1
    Member
    Join Date
    Jul 2009
    Posts
    72

    resolved [RESOLVED] .swf not acknowledging some AS

    I've scripted a small flash file that for some reason, does not throw any errors but does not apply the tweens I have set for the beggining...

    Please take a look at what I mean:
    Code:
    import gs.TweenLite;
    import gs.easing.*;
    
    var tabs:Array = new Array();
    var btnProps:Array = new Array();
    var prop:Rectangle;
    
    for(var i:Number = 0; i < top_menu_buttons.numChildren; i++)
    {
        var _btn:MovieClip = MovieClip(top_menu_buttons.getChildAt(i));
        _btn.buttonMode = true;
        _btn.mouseChildren = false;
        _btn.id = i;
        _btn.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
        _btn.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
    	_btn.addEventListener(MouseEvent.CLICK, menuClick, false, 0, true);
        tabs.push(_btn);
    
        var _rect:Rectangle = new Rectangle(_btn.x, _btn.y, _btn.width, _btn.height);
        btnProps.push(_rect);
    }
    
    tab_photo.addEventListener(MouseEvent.MOUSE_OVER, buttonOver, false, 0, true);
    tab_photo.addEventListener(MouseEvent.MOUSE_OUT, buttonOut, false, 0, true);
    tab_photo.addEventListener(MouseEvent.CLICK, buttonClick, false, 0, true);
    
    TweenLite.from(photo, .2, {alpha:1});
    TweenLite.from(tab_photo, .2, {alpha:1, delay:.2});
    TweenLite.from(products_section, .2, {alpha:1, delay:.4});
    TweenLite.from(tab_products, .2, {alpha:1, delay:.6});
    TweenLite.from(services_section, .2, {alpha:1, delay:.8});
    TweenLite.from(tab_services, .2, {alpha:1, delay:1});
    TweenLite.from(environment_section, .2, {alpha:1, delay:1.2});
    TweenLite.from(tab_environment, .2, {alpha:1, delay:1.4});
    
    function onOver(e:MouseEvent):void
    {
        // prop contains the initial x,y,width,height properties of the targeted movieclip
    	prop = btnProps[e.target.id];
        TweenLite.to(e.target, .2, {x:prop.x+10});
    }
    
    function onOut(e:MouseEvent):void
    {
        TweenLite.to(e.target, .2, {x:prop.x});
    }
    
    function menuClick(e:MouseEvent):void
    {
    	switch(MovieClip(e.currentTarget).id)
    	{
    		case 0:
    		trace("1");
    		break;
    		case 1:
    		trace("2");
    		break;
    		case 2:
    		trace("3");
    		break;
    		case 3:
    		trace("4");
    		break;
    		case 4:
    		trace("5");
    		break;
    		case 5:
    		trace("6");
    		break;
    		case 6:
    		trace("7");
    		break;
    	}
    }
    
    function buttonOver(e:MouseEvent):void
    {
        TweenLite.to(e.target, .2, {x:x-10});
    }
    
    function buttonOut(e:MouseEvent):void
    {
        TweenLite.to(e.target, .2, {x:x});
    }
    
    function buttonClick(e:MouseEvent):void
    {
    	TweenLite.to(top_menu_buttons, .2, {x:670});
    	TweenLite.to(top_menu_background, .2, {x:670});
    }
    All the tweens I have, that I'd like to play as the .swf begins, are not playing at all. Anyone have any idea why this is happening?
    Last edited by r3h0ld3r; 08-03-2009 at 10:53 AM.

  2. #2
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    I'm not sure, but you're using the .from() method, while I usually use the to() method.
    Then again, I'm not familiar at all with those tween classes

    Try it anyway!
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  3. #3
    Member
    Join Date
    Jul 2009
    Posts
    72
    I was being unwise and had all the properties set as though it was TweenLite.to.

    Problem solved.

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