A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: problem of action script 3 within Flash CS3 professional

  1. #1
    Junior Member
    Join Date
    Nov 2006
    Posts
    2

    problem of action script 3 within Flash CS3 professional

    Hi,

    I am a new player of ActionScript 3 in Flash CS3 professional version. I don't know why the ActionScript I wrote, it didn't work while I published it. Would you please tell me what was it wrong? Basically I just made a mcRectangle as a movie clip in the library and drop three rectangles with different sizes and named them:rectangle1_mc.rectangle2_mc,rectangle3_mc for their instance names.

    Here is the ActionScript3 code:
    Code:
    function moveRectangle(rectangle:MovieClip, movement:Number, rotationAmt:Number):void
    {
    	rectangle._y -= movement;
    	rectangle._rotation += rotationAmt;
    }
    
    moveRectangle(rectangle1_mc, 150, 45);
    moveRectangle(rectangle2_mc, 250, 90);
    moveRectangle(rectangle3_mc. 50, 180);
    Any helps would be much appreciate it!

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    _y and _rotation (and everything else) lost the underscore in AS3. Change to just plain y, and rotation.

  3. #3
    Junior Member
    Join Date
    Nov 2006
    Posts
    2
    Quote Originally Posted by 5TonsOfFlax
    _y and _rotation (and everything else) lost the underscore in AS3. Change to just plain y, and rotation.
    Removed the underscores, didn't work as well? Not sure what is going on AS3?

  4. #4
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Are you getting error messages? What do you mean by "didn't work"? Exactly what is happening?

  5. #5
    Senior Member
    Join Date
    Apr 2008
    Location
    Nottingham, UK
    Posts
    348
    do you need an event to listen for in order to trigger the function?

  6. #6
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    His code explicitly calls the function. Given the way it's written it would appear to be frame script, and should execute upon entering that frame.

    Without knowing the errors he's receiving I don't think we can get further.

  7. #7
    OOP is one letter from OOPS kortex's Avatar
    Join Date
    Aug 2005
    Location
    New Hope, PA
    Posts
    2,668
    I am going to guess that all you see it the rectangle at the last set of coordinates. Since the function calls happen so quickly, you will not see any transitional movement between the function calls.

    I have an animation library that has a moveToPoint function in it that you could use at http://code.google.com/p/ooas/source.../vfd/animation

    Since the animations are built on tween classes, you can add event listeners to the end of the tweens and get the sequenced animation I assume you are going for.
    Jeremy Wischusen
    Flash - Flex - LAMP - Web Developer Purple Inc
    AS OOP FAQ-Best Practices Thread | Flashkit OOP Tutorials | Purple Inc (day job) | Blog


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