;

PDA

Click to See Complete Forum and Search --> : problem of action script 3 within Flash CS3 professional


begeiste
08-21-2008, 09:11 PM
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:

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!

5TonsOfFlax
08-21-2008, 09:38 PM
_y and _rotation (and everything else) lost the underscore in AS3. Change to just plain y, and rotation.

begeiste
08-22-2008, 01:33 PM
_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?

5TonsOfFlax
08-22-2008, 01:39 PM
Are you getting error messages? What do you mean by "didn't work"? Exactly what is happening?

dan_hin
08-22-2008, 04:22 PM
do you need an event to listen for in order to trigger the function?

5TonsOfFlax
08-22-2008, 04:24 PM
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.

kortex
08-22-2008, 04:35 PM
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/browse/#svn/trunk/actionscript/as3/com/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.