This content has been marked as final. Show 4 replies
are you publishing for as3?
ok there are a few items here. the problem with the first sections of code for the wheel is that you cannot assign multiple event handlers to the same object (in this case the stage) so it is likely that they are interfering with one another. it would be best, when handling multiple objects (wheels) to attach the listeners to the object itself, then each is individually controlled.
the reason that the second wheel is running continuously is that the onEnterFrame event is 'always' being fired, to control it you need to place it inside a method that you then invoke in the same manner that you have the moveArrow method - ie. by adding/removing the Event listener. I'm a bit unclear on just 'what' you would like the 'second' wheel to do? do you want it to just 'scroll' up to 10 automatically or does one 'set' the power level - similar to the first section of code you have there.
as far as 'where' to place you code: it is common to create a layer in the timeline usually called 'actions' and place the code there. however the code must be placed 'where' the wheel is instantiated or 'exsits' on the timeline. however when using AS3, it may also be best to place your codes within a class file that is then either a) attached to the document as the doc class or b) defines the class of the instance under it's own naming convention. with this method (b) the code will be available to each instance of a given MC instance. but there are other things to consider when using a class structure as well.
your codes can be also be simplified a bit, the 'second' section of the wheel rotation 'stop' method looks like you are trying 'snap' the wheel to specific increments - and this can be done a bit easier really. I've created a quick example of how you can achieve this more efficiently HERE
sorry kg - been working on this a bit :)
i don't think he's even publishing for as3.
right on kg - heck if I know LOL!