Clock Crew

Community => Flash & Flash Accessories => Topic farted by: FrostShell on June 12, 2009, 07:12:15 AM

Title: omg AS3 is raping me
Post by: FrostShell on June 12, 2009, 07:12:15 AM
Seriously, blood is pooling on the floor betwixt my legs. I only used Actionscript in it's most basic sense, cause as you know, I am all about the animation and art.

I tried to make a simple random play movie clip from some old code (ran through a converter SCSP found) and I find out I can't even attach script to clips anymore? I am completely lost on this one. Someone please explain how AS3 works in a way my soft little brain can understand.

I am reading this...
http://www.actionscript.org/resources/articles/671/1/AS-30-Coming-From-20---Article-1/Page1.html (http://www.actionscript.org/resources/articles/671/1/AS-30-Coming-From-20---Article-1/Page1.html)
(found by SCSP again), but since I was pretty inept at AS in the first place I am having trouble understanding it all. Also, I am aware I can just make an AS2 fla, but I want to use them bones!

ps: I am aware that I'm making alot of threads in this forum... that's it. What?
Title: omg AS3 is raping me
Post by: FrostShell on June 12, 2009, 07:28:20 AM
Jesus Christ almighty!!! I tried to make a simple damn button, and this is the AS3 tutorial code I found on it...

  1. //imports the necessary AS events  
   2. import flash.events.Event  
   3. import flash.events.MouseEvent;  
   4. //attaching mouse events to the button on stage  
   5. rssButton.addEventListener(MouseEvent.CLICK, rssClick);  
   6. rssButton.addEventListener(MouseEvent.MOUSE_OUT, rssMouseOut);  
   7. rssButton.addEventListener(MouseEvent.MOUSE_OVER, rssMouseOver);  
   8. rssButton.addEventListener(Event.ENTER_FRAME, onEnterFrames);  
   9. //Properly declaring variable  
  10. var box_color_play:Number;  
  11. //On mouse clicked function  
  12. function rssClick(event:MouseEvent):void {  
  13. eventNotice.text = "MOUSE CLICKED";  
  14. }  
  15. //On mouse out function  
  16. function rssMouseOut(event:MouseEvent):void {  
  17. eventNotice.text = "MOUSE OUT";  
  18. box_color_play = 0;  
  19. }  
  20. //On mouse over function  
  21. function rssMouseOver(event:MouseEvent):void {  
  22. eventNotice.text = "MOUSE OVER";  
  23. box_color_play = 1;  
  24. }  
  25. //Function in place used for on ENTER_FRAME event animation  
  26. function onEnterFrames(event:Event)  
  27. {  
  28. if ((rssButton.box_color.currentFrame != rssButton.box_color.totalFrames) || (rssButton.box_color.currentFrame != 0)) {  
  29. if (box_color_play == 1) {  
  30. rssButton.box_color.nextFrame();  
  31. }  
  32. if (box_color_play == 0) {  
  33. rssButton.box_color.prevFrame();  
  34. }  
  35. }  
  36. };  


Are you freaking kidding me!?!?!
Title: omg AS3 is raping me
Post by: FrostShell on June 12, 2009, 07:47:03 AM
I'll explain my random play movie clip even further as I think I know how it needs to be done, but I don't know how to code it...

(https://clockcrew.net/talk/proxy.php?request=http%3A%2F%2Fimg40.imageshack.us%2Fimg40%2F6112%2Fasdfkyh.png&hash=995d961abaab70952454fbd622a716fcff9e8c4c)

Basically the movie clip will play as normal, until it hits the end. When it hits [frame 3], it will randomly send the clip to [frame 1] or [frame 2]. If it chooses 1 then it will play the animation again, and if it chooses 2 then it will play the movie clip after the animation, and either choice will lead to the end of the clip, where the code will again randomly choose 1 or 2.

Hopefully it is that simple, but how do I do it in AS3?

Oh, and I guess this thread should be moved to the programming forum, sorry I forgot we had one of those.
Title: omg AS3 is raping me
Post by: AstronautClock on June 12, 2009, 08:44:13 AM
I can't help you but I would also like to know this!
Title: omg AS3 is raping me
Post by: SpongeClock SquarePants on June 12, 2009, 09:34:41 AM
sent you a fla
Title: omg AS3 is raping me
Post by: FrostShell on June 12, 2009, 10:48:35 AM
Hey that works perfectly, thanks man. I added it to my sig for the glare on the letters. Now I just need to examine this code and see how you did it...

If anyone else wants the fla SCSP made for this, you can get it here...

http://www.frostshell.com/stuff/as3randomframeplay.fla (http://www.frostshell.com/stuff/as3randomclipplay.fla)
Title: omg AS3 is raping me
Post by: SpongeClock SquarePants on June 13, 2009, 05:08:53 AM
what you could also do in this situation is make a timer that runs for X seconds and each time its done play the glare animation.
Title: omg AS3 is raping me
Post by: FrostShell on June 13, 2009, 05:25:34 AM
Yeah I figured there was a pure code way to do it, but having this linked to the timeline in some way keeps my brain from melting.