A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Working again with Flash & Actionscript

Hybrid View

  1. #1
    Junior Member
    Join Date
    Sep 2016

    Working again with Flash & Actionscript

    Actually Actionscript was my introduction to programming and that was using Flash in its first incarnation as created by Macromedia.

    I actually came to really like writing Actionscript and creating Flash applications. That being said I eventually set Flash aside and moved on to other things like trying to make a living.

    So today I find myself trying to get back into Flash and Actionscript. Unfortunately I am finding that Adobe has become an almost entirely useless organization as far as support is concerned. For Adobe "Support" is nothing more than an avenue to try and peddle more of their useless garbage on you.

    Nevertheless the core products were originally created by people who were competent programmers and designers. When I first learned to use Actionscript I bought a really great book which I of course no longer have or even remember the name of. Today, if you need help you search the internet and lo here I am.

    So I'm trying to work through some examples I have been able to find on Youtube and so far it's not working and I'm not seeing what the problem is. I can only suspect that it has something to do with particulars with the software or even just specifics about the use of the code.
    So here's what I have...

    I'm running Flash CS6 installed locally on a Windows 7 desktop machine. I have created a new "Flash project" so it's entirely empty, one layer 1024 X 768 . I created a simple drawing of a rocket / bullet shape, grouped the object and then converted it to a move clip symbol named bullet. I then gave that move clip an instance name of bullet_mc. So, next i add a layer to the timeline and name it "AS" I select the 1st frame (only frame) and open the "Actions" panel and enter the following code as demonstrated in the Youtube video...

    addEventListener (Event.ENTER_FRAME, bulletgo);
    	function bulletgo (e.Event):void{
    		   bullet_mc.x = mouseX;
    		   bullet_mc.y = mousey;
    When I test the movie in the browser I get nothing. The file in the video works so I have to asume the code is correct but that I have or am missing something somewhere.

    can anyone point me in the right direction?

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011

    The code should be giving errors if that is exactly how it is and not some copy/paste erors.

    PHP Code:

  3. #3
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    ok he got mousey wrong, but mouseX seems right and, at the very least, his bullet should move horizontally?

    edit: oh, e.Event not e:Event, I see it
    who is this? a word of friendly advice: FFS stop using AS2

  4. #4
    Junior Member
    Join Date
    Sep 2016
    Thank you for the response. I did find the problem with my code, You are right the mousey was wrong. It should have been mouseY also I had e. wrong in the function "bulletgo" I had (e.Event) and it should have been (e:Event). At least I think that's correct. In any event it's working now.

    Corrected code...

    addEventListener (Event.ENTER_FRAME, bulletgo);
    	function bulletgo (e:Event):void{
    		   bullet_mc.x = mouseX;
    		   bullet_mc.y = mouseY;
    This works.

    I remember advise from my early experiences with Flash and the book I learned from. the author often noted that incorrect syntax would "fail silently". That tip usually kept me from stressing out too much when my code didn't work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center