A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: syntax error? Where?

  1. #1
    Member
    Join Date
    Jul 2005
    Posts
    83

    syntax error? Where?

    hey hey


    where for the lifeame is the syntax error in this script? I cant get it

    import mx.transitions.Tween;
    function doTheAction(clip:MovieClip, action:String):Void
    {
    switch (action){
    case "toCenter":
    clip._x = Tween(clip,"_x",Regular.easeInOut,clip._x,Stage.wi dth/2,30,false);
    clip._x = Tween(clip,"_y",Regular.easeInOut,clip._y,Stage.he ight/2,30,false);
    break;
    case "wobble":
    clip._parent.gotoAndStop("wibblewobble");
    break;
    case "whatThe****":
    _level0.dummyClip.gotoAndPlay("somewhere");
    break;
    }
    };

    if i wasnt so bald id be pulling my hair out

  2. #2
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    Try using new Tween:
    code:

    clip._x = new Tween(clip,"_x",Regular.easeInOut,clip._x,Stage.wi dth/2,30,false);
    clip._x =new Tween(clip,"_y",Regular.easeInOut,clip._y,Stage.he ight/2,30,false);



    K.

  3. #3
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    you cannot assign a class to a mc's _x property,

    should be something like this;
    Code:
    import mx.transitions.Tween;
    function doTheAction(clip:MovieClip, action:String):Void {
    	switch (action) {
    	case "toCenter" :
    		clipXTween = new Tween(clip, "_x", Regular.easeInOut, clip._x, Stage.width/2, 30, false);
    		clipyTween = new Tween(clip, "_y", Regular.easeInOut, clip._y, Stage.height/2, 30, false);
    		break;
    	case "wobble" :
    		clip._parent.gotoAndStop("wibblewobble");
    		break;
    	case "whatThe****" :
    		_level0.dummyClip.gotoAndPlay("somewhere");
    		break;
    	}
    }
    New sig soon

  4. #4
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    Tween is the Class name, thus has no return parameter either...
    As such change:
    Code:
     clip._x = Tween(clip,"_x",Regular.easeInOut,clip._x,Stage.width/2,30,false);
    clip._x = Tween(clip,"_y",Regular.easeInOut,clip._y,Stage.height/2,30,false);
    to
    Code:
    new Tween(clip,"_x",Regular.easeInOut,clip._x,Stage.width/2,30,false);
    new Tween(clip,"_y",Regular.easeInOut,clip._y,Stage.height/2,30,false);
    My letters on the F1 key have faded, how are yours today?

  5. #5
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    LOL...I didn't even notice that that code was trying to attach the Tween to the clips X property...

    Tweens do have a return type though, so you can assign it to a variable:

    var myTweenX=new Tween(clip,"_x",Regular.easeInOut,clip._x,Stage.wi dth/2,30,false);

    var myTweenY=new Tween(clip,"_y",Regular.easeInOut,clip._y,Stage.he ight/2,30,false);

    K.

  6. #6
    Flash Gordon McUsher's Avatar
    Join Date
    Mar 2001
    Location
    Krautland
    Posts
    1,560
    Err, of course returns every constructor the instanciated Class, dunno why i wrote the above BS
    My letters on the F1 key have faded, how are yours today?

  7. #7
    Member
    Join Date
    Jul 2005
    Posts
    83

    yes!

    Hey wow it affected the clip!

    I think I get some of whats going on here...

    Unfortunatly it doesnt break up the rotation, the clicked clip still rotates along in its own world off stage...how would the rotation be stopped so the selected clip moves to the center and sits there?

    I thought the break; line did that? Is it necessary to stop all the other functions going on in there for that?
    Attached Files Attached Files

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