SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: I hate AS3!!

  1. #1
    SitePoint Zealot sappo's Avatar
    Join Date
    Sep 2005
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I hate AS3!!

    Normally I steer clear of AS3 but I've just started playing around with Air and of course AS2 is incompatible - great!

    Basically I'm stuck trying to get a click action triggering a function. I want the function to run when an instance of an MC is clicked.

    The MC is 'ins_1' wich is buried 2 levels deep within other MCs, the path from the top is:

    ins_container.ins_slide.ins_1

    I have all my actionscript at the top level but I'm happy to more it to ins_slide if need-be.

    I have tried this:

    Code Actionscript:
    ins_container.ins_slide.ins_1.addEventListener(MouseEvent.MOUSE_DOWN, item1_CLICK);
     
    function item1_CLICK(e:MouseEvent):void {
    	ins_bug.htmlText += "1 clicked, ";
    }

    Does anyone have any ideas?
    Thank you,
    Check out my Movie Trailers website - Popcorn Trailers

  2. #2
    SitePoint Enthusiast jamiemcd's Avatar
    Join Date
    May 2005
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your code looked fine, but I tested it nonetheless.

    I just drew a rectangle and converted it into a movieclip named ins_1. I then put that inside a movieclip named ins_slide and then that inside a movieclip named ins_container. On frame 1 of the timeline, on a layer called Actionscript, I added your code (except that I used a trace statement inside the function). It worked fine.

    I'd guess your problem is likely with the instance name of one of the three movieclips. Or it could be that your code is on the timeline incorrectly.

  3. #3
    SitePoint Zealot sappo's Avatar
    Join Date
    Sep 2005
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks jamiemcd,

    After what you said I did the same in a new file and got it working straight away too. I then added each seemingly unrelated element until it broke.

    In the end it had nothing to do with my code or the MCs. It was an image above (png) which had a transparent area 'masking' them when they slid on. I've since tried it again with just a normal flash mask and it worked fine.

    Weird! Thanks for your help though,
    Check out my Movie Trailers website - Popcorn Trailers

  4. #4
    SitePoint Enthusiast jamiemcd's Avatar
    Join Date
    May 2005
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great! BTW, I love Actionscript 3 and I think those proficient in AS2 will grow to like it too, especially if you do a lot in code and create RIAs in Flex. Flash designers who were used to writing quick actionscript, however, might not like the changes... having to strongly type variables, using addEventListener instead of callback functions like myButton.onRelease = function () { //code here }, etc.

    Here is a resource that might help others.

    Tips for migrating your Flash applications to ActionScript 3.0


Tags for this Thread

Bookmarks

Posting Permissions

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