omgnoseat Posted November 29, 2007 Report Share Posted November 29, 2007 Well, I got a school assignment where I need to program an animation in adobe flash cs3 where the user has influence on what happends, so something like a little game.The problem is that I never have programmed in my life, and I don´t have the time to study it now...So some help would be gratefull.Someone I my class helped me to create a ball which you can controll by the keyboard, but that isn´t going to do for the assignment.I would like the ball to be clickable, and then change into a square which will move faster.This is my current code:package { import flash.display.Sprite; import flash.events.Event import flash.events.KeyboardEvent; import flash.ui.Keyboard; public class Test extends Sprite { var Ball:Sprite = new Sprite(); var speed:int = 5; public function Test() { init(); } private function init():void { stage.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyboardEvent); Ball.graphics.beginFill(0XFF0909); Ball.graphics.drawRoundRect(50,50,60,60,60); Ball.graphics.endFill(); stage.addChild(Ball); } private function handleKeyboardEvent(event:KeyboardEvent):void { switch(event.keyCode) { case Keyboard.UP : Ball.y -= speed; break; case Keyboard.DOWN : Ball.y += speed; break; case Keyboard.LEFT : Ball.x -= speed; break; case Keyboard.RIGHT : Ball.x += speed; break; } } } }I'm using 2 files:Deelopdracht1.fla Test.as I'm using the document class in the .fla file to link them.Some help will be greatly apreaciated, it's quite important Quote Link to comment Share on other sites More sharing options...
GlynnP Posted November 29, 2007 Report Share Posted November 29, 2007 Does it HAVE to be programed in actionscript 3 because i have only just started touching on it as its pretty new i know theres not a lot different part from its in its own separate file.But i have some actionscript 2 stuff thats user interactive but wouldnt just give you it as its meant to be your work.But could point you in the right direction Quote Link to comment Share on other sites More sharing options...
omgnoseat Posted November 29, 2007 Author Report Share Posted November 29, 2007 Does it HAVE to be programed in actionscript 3 because i have only just started touching on it as its pretty new i know theres not a lot different part from its in its own separate file.But i have some actionscript 2 stuff thats user interactive but wouldnt just give you it as its meant to be your work.But could point you in the right directionIt has to be in actionscript 3I'm all stressed out, if I don't make this thing I have to do a harder test which is basicly impossiblehurray Quote Link to comment Share on other sites More sharing options...
omgnoseat Posted November 25, 2008 Author Report Share Posted November 25, 2008 (edited) Have a chance to retry my assignment from last year, which I failed. Have to use actionscript 3 once again, I do get the hang of it alot more now though.We can only use actionscript for everything, nothing on the stage whatsoever. We have to use a document clas in the .fla file to connect to the .as file, so we get a OOP type of programming.I´ve made a little ghost from some sprites, which was hard enough for me but it did work out. Now I´m having some problems connecting events to it. I want it to me able to be controlleable with the mouse, and on a mouse click it should dissapear [change decrease the alpha on mouse click]. I thought I figured it out but i'm just getting errors =/Edit:Worked it out together with my gf Edited November 26, 2008 by omgnoseat Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.