SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: How to use actionscript 2
-
Sep 24, 2008, 03:25 #1
- Join Date
- Mar 2003
- Location
- scarborough
- Posts
- 140
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
How to use actionscript 2
I have used flash before. I have totally forgotten everything though. I have been trying to get to grips with it again. I want to make the following simple program.
1. I have created a simple shape(rectangle). I called it s1 in the instance box.
2. I right clicked and added the following script into the shapes actions.
rotate=4;// rotation variable
this.onEnterFrame=function(){// our dynamic event
rotate++;// the angle will increase constantly
s1_.rotation=rotate;// rotate
s1_.onEnterFrame=function(){// dynamic event
}
All I want to do is rotate the shape by 1 degree a frame. How do I do it the above code obviously doesn't work.
-
Sep 24, 2008, 13:31 #2
- Join Date
- Mar 2008
- Location
- NP, New Zealand
- Posts
- 576
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
That second onEnterFrame is unnecessary, and it's got nothing in it anyway.
You say your shape is called S1 but in your code you've referred to it as S1_ - you want to move that underscore to the other side of the dot, so it reads S1._rotation.
Try this code:
Code Actionscript:rotate=4;// rotation variable this.onEnterFrame=function(){// our dynamic event rotate++;// the angle will increase constantly s1._rotation=rotate;// rotate }
See how that goes.
-
Sep 25, 2008, 02:52 #3
- Join Date
- Mar 2003
- Location
- scarborough
- Posts
- 140
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Right - thanks
I never thought of a syntax error. I thought the code was entirely wrong in the first place.
In the end I had already got it working. I just used
_rotation=rotate;
Bookmarks