Wednesday 18 November 2009

Actionscripting

Now that I've got about 2/3 of the animation complete, I decided to try adding the interactive element to check everything will work okay before I finish. I will be using Actionscript 2 again for my cycle, since Actionscript 3 is still causing problems that we've yet to work out... But 2 is more than adequate for what I need to do now.

First I pasted the eight frames of my run cycle into scene 1, then added a second layer above it for my button. On that layer I inserted a new symbol (button) and used the Rectangle Tool to create a white fill box with no stroke, then set the Alpha of the white fill to 1%, making it practically invisible. I dragged it from my library onto the button layer and scaled up so it covered the main all of my cat except its tail, then inserted a new scene. On scene 2 I pasted the frames of the second part of my animation (the trip, fall, and tumble).

Back on scene 1, I opened the Actions box for the button layer and selected Global Functions. I then chose "On (release)" in order to make the button clickable, and then went into Timeline Control and added "Gotoandplay (1)" and then "Gotoandplay (Scene 2, 1)" to make the animation jump to the first frame of scene 2 after being clicked.

I then went back to layer 1 and opened the Actions for the last frame of the run cycle, then selected "Gotoandplay (1)" from Timeline Control to make it loop until the cat is clicked.

At first I had problems trying to get the second part of the animation running back into the loop once it had finished, but I eventually realised that Scene 2 doesn't need any actionscripting at all so can just be left alone. Pasting the run cycle after the trip/fall also helped the flow of the loop, and now its working really well! Unfortunately I can show the click test here since Blogger won't accept Flash files, but now that I've figured what actionscripting needs to be used, it should be easy to add last part of the animation to Scene 2 once its finished. The only flaw I can see now is that the eighth frame of the run cycle only seems to last for one frame instead of two, which looks a little odd while its playing. I think it must be because the loop action can only be added to the original frame rather than the extra one I inserted... So I'll try removing the extra frame and just pasting the eighth frame again instead.

No comments:

Post a Comment