A Flash Developer Resource Site

Results 1 to 20 of 51

Thread: AS3 is FAST! Redux - CopyPixels vs. Sprite Pooling

Hybrid View

  1. #1
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    Bleh... you're gonna get to see my coding practices now, aren't you?

    http://www.birchlabs.co.uk/CopyPixelsSource.zip

    (there are no comments, have fun...)

    Sprite sheet's here:



    The transparent arrows are there because the arrows fade out, and it's faster to copy the pixels of a pre-rendered transparent arrow than apply a ColorTransform to it every time it's needed.
    http://www.birchlabs.co.uk/
    You know you want to.

  2. #2
    Junior Member
    Join Date
    Jan 2002
    Posts
    18
    Okie dokie. I'll see if I can understand how it all works. Thank you =)
    Got Milk?
    FaeKitty >^.^<

  3. #3
    Junior Member
    Join Date
    Jan 2002
    Posts
    18
    Hmmm, I get the following error when I try to run/test it in Flash CS3 Pro:

    >>
    ArgumentError: Error #1063: Argument count mismatch on ArrowSheet$iinit(). Expected 2, got 0.
    at CopyPixelsSource_fla::MainTimeline/CopyPixelsSource_fla::frame2()

    >>

    Anyone know what the problem might be? =/
    Got Milk?
    FaeKitty >^.^<

  4. #4
    Junior Member
    Join Date
    Jan 2002
    Posts
    18
    Thank you webgeek. I changed the forth line from:

    var arrowSpriteSheet:ArrowSheet = new ArrowSheet();

    to:

    var arrowSpriteSheet:ArrowSheet = new ArrowSheet(0,0);

    Still not sure why it needed arguments, but it works for me now.

    I've looked through it and I believe I understand how the technique works now. Thank you very much, VENGEANCE MX =)
    Last edited by FaeKitty; 06-02-2007 at 08:58 PM.
    Got Milk?
    FaeKitty >^.^<

  5. #5
    Member
    Join Date
    Jun 2007
    Posts
    64
    Quote Originally Posted by VENGEANCE MX
    Bleh... you're gonna get to see my coding practices now, aren't you?

    http://www.birchlabs.co.uk/CopyPixelsSource.zip

    (there are no comments, have fun...)

    Sprite sheet's here:



    The transparent arrows are there because the arrows fade out, and it's faster to copy the pixels of a pre-rendered transparent arrow than apply a ColorTransform to it every time it's needed.
    Thanks for posting this demo as I'm still learning the whole copypixel() thing.

    My question is somewhat off topic, but possibly still related... Lets say for some reason you wanted to be able to detect if the user clicked on one of the arrows. How would you go about doing that?

    I've only ever used the movieclip approach where I can simply add a mouseevent handler.

    Thanks

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