New AS3 Code Snippets Available

Here are four more code snippets that you can use with my Snippets panel for Flash CS3. The snippets included are described below:

New Document Class
This snippet creates a skeleton document class for your OOP Flash projects. Create a new ActionScript document inside of Flash and paste in the code to save yourself a bunch of time.

Play External Sound
This snippet includes the code needed to load and play an external sound file. It also sets up a SoundChannel and SoundTransform object in case you need to manipulate the audio stream.

Custom FLV Playback
This snippet creates the code needed to play back an external FLV file without using the FLVPlayback component. It takes care of all the setup including the onMetaData function.

Loading External Content
This snippet creates the code needed to load external content using the Loader class. It includes the progress event function and some math to trace out the percent loaded.

You can download the new snippets here.

Enjoy!
Lee


Commentary

  1. christian says:

    As always, thanks Lee!

    one note: I had to change all the quotes with regular quotes and switch the Loading External Content apostrophes with quotes and its quotes with apostrophes.

  2. lee says:

    Damn this code plugin sucks. Sorry about that.

  3. Steve says:

    Thanks a million, these things are always great.
    On the last snippet, “loading external content”, the quotes around “% loaded” are causing the entire document not to load. I just thought I’d share in case anyone else runs into the same problem.
    Thanks again.

  4. lee says:

    Ok I uploaded it as a separate XML file so you don’t have to do that anymore.

  5. PeterMQ says:

    I get an error message…in this line:

    3 -

  6. Luke says:

    The Snippet panel is awesome! It seems only the “external sound” is the in the xml link.

  7. lee says:

    @Luke Either view the source or download the XML file to get the snippets.

  8. Lee these snippets are great! Thank you in advance.

  9. Fissunix says:

    Great ! Work fine ! As Steve said, you just have to fix the quote problem for “loading external content” and then it works.

  10. Mark McDonnell says:

    Hi Lee,

    The last option in the snippets panel “Loading External Content” displays an error message when I click on the “Copy to Clipboard” button…

    The following JavaScript error(s) occurred:
    SyntaxError: Missing ) after argument list

    …do you (or anyone) know what you need to change in the XML to fix this issue?

    Otherwise great work!

    Thanks :)

    M.

  11. shane says:

    i am getting this error when trying the link above to code examples.
    Please help.
    Thanks Lee, as always i’m sure this will be great, i just wish i could download it!

  12. shane says:

    XML Parsing Error: junk after document element
    Location: http://theflashblog.com/files/newSnippets.xml
    Line Number 3, Column 1:
    ^

  13. shane says:

    I just viewed source, and fixed the qoutes from the first comment,…works like a charm.

    Thanks Lee..

  14. Jan says:

    The link does not seem to work all I get is a webserver error?

  15. Randy says:

    I’m confused. Where do I put this new xml to add it to the Event Generator?

  16. Joe says:

    Same here. The download link is dead.

  17. Chris says:

    Hello; I’m working through the tutorials. On the tweener tutorial.
    I can’t find the right place to put the caurina files in the zip. I have a PC. I created this directory in the class root (or I think it is the class root), C:\Program Files\Adobe\Adobe Flash CS3\en\First Run\Classes\caurina I put the files here. It doesn’t seem to be the right place. What am I doing wrong.

  18. Craig says:

    Get snippets here: http://www.blueion.com/snippets.zip. This is the raw fla and the associated xml file – NOT THE EXTENSION.

    For those of you interested, I changed the snippets code slightly so that I could write my xml data just like I would in the Flash actions window.

    You may be able to wrap the code in CDATA but my example uses “<” for the “” special character. For example, if you had a for loop you would need to use the “” sympbol.

    Sample xml code:

    button.dispatchEvent(new MouseEvent(MouseEvent.CLICK));

  19. Craig says:

    Looks like my sample xml code got cut off. Just take a look at the files and it will make sense.

    Hope this helps!

  20. reighny says:

    can you use ‘greater than’ and ‘less than’ symbols?

  21. william says:

    it took me a little while to understand the first comment but it works =)
    just change the (‘) to (“) and the (“) to (‘) on the loading external contents snippet

    thanks it works great

  22. anton says:

    can someone upload the XML file on some server or something? cuz I can get this working…

    thanks!

  23. mikey says:

    hey guys if you notice there’s error on xml file, just use “View Source” or “Page Source” from browsers and you will see full xml code, hope that’s help.

  24. Andy says:

    Hey I’ve experienced a JavScript error when trying to copy the Loading External Content to the clipboard. I get the following message:

    The following JavaScript error(s) occured: SyntaxError: missing) after argument list.

    Me being still a nOOb, I’m not sure where otherwise I’d try to fix it myself.

  25. Mike says:

    I like the component, had it for a while, but just started trying to put it to use. I’m adding some basic snippets, and getting the “Syntax Error: missing ) after argument list” error whe ntryign to copy a snippet to the clipboard…

    My xml is this…

    Think it probably has to do with the single quotes around easeOutExpo, how can I correct this?

    Thanks for any help, and I love the blog and tutorials Lee!

  26. Mike says:

    of course, 10 seconds after I figure it out, for anyone else having problems, add back slashes around the quotes…

  27. hairball says:

    Where do I put this new xml to add it to the Event Generator?

  28. Emma says:

    Hey guys, having the same Javascript error as Andy and I can’t work it out either… it’s just for the Loading External Content snippet… if someone could tell me what I need to fix in the XML that’d be awesome!
    Thanks!
    Emma.

  29. Alan Wayman says:

    If you have problems with the “Loading External Content” Snippet. Take out the + ‘percent loaded’ and try that. I took that out and it is working for me.

  30. Flabbygums says:

    Lee, thanks very much!!

    If you guys still have issues w/ Loading External Content throwing the “missing ) error”, here’s the corrected node:

  31. Tara says:

    there is an asp.net error when i tried to download the package

  32. pjetr says:

    I love this extension.

    I added a line in it to load images. and it all works like a charm.

    for those of you who can’t read:
    Syntax Error: missing ) after argument list”

    look for the first “, swap it with ‘ do the same on the last one. Now look inside a little deeper, and look for all ‘ and swap them with “.

    this does the trick without having to erase anything from the snippet.

  33. pieter says:

    sounds very intrestesting. i cant follow your link (gives me an error, in my language). i am on firefox 3.

  34. Cheers for this. It cuts out a lot of time!

  35. Chris says:

    Alan,

    It worked for me as well – I wonder why you have to do this though…

    “If you have problems with the “Loading External Content” Snippet. Take out the + ‘percent loaded’ and try that. I took that out and it is working for me.”

    Thank you.

  36. Almog says:

    Hi am getting this error any body have any idea were I can download a good version of the xml file

    thanks
    var loader:URLLoader = new URLLoader();
    loader.addEventListener(Event.COMPLETE, xmlLoaded);
    loader.load(new URLRequest([REPLACE]));

    var xml:XML;

    function xmlLoaded(e:Event):void
    {
    xml = XML(e.target.data);
    }

  37. Almog says:

    Hi am getting this error any body have any idea were I can download a good version of the xml file

    XML Parsing Error: junk after document element
    Location: http://theflashblog.com/files/newSnippets.xml
    Line Number 3, Column 1:

    thanks

  38. Michael says:

    I would really like to download this, but it seems the link is . . . please please fix :D

  39. ssandy says:

    To get the file, Right mouse Click and save link as!

  40. celldrifter says:

    Hey guys, I’ve just started using an extension just like this, but it’s extensible by the community. I think it has some massive potential. Check it out here!

    http://www.flcodr.com/blog/

  41. OctAg0nO says:

    what i hav to do with the xml file ????

  42. Niels says:

    What to do with xml file:

    Open flash and open the snippets panel

    Click on the button with a pencil
    Now you can edit the xml and paste de new code after the old snippets.

    save and refresh your snippets list with the refresh button.

  43. Carroll Altman says:

    Lee,

    First let me say that you have been a god send for me with Flash. From your 8 tutorials on the video player and the XML tree, I have been finally been able to create a video player that can categorize video clips. How ever when I went to download the extension category of your Flash Blog and tried to down load the new AS3 Code Snippets I get an XML Parsing error regardless of platform or browser. Just thought you should know.

    This page contains the following errors:

    error on line 3 at column 1: Extra content at the end of the document
    Below is a rendering of the page up to the first error.

  44. neelam.a says:

    Hi, i am trying to create a html snippet for a flash image, i have entered the code for the snippet but when i make the website live after importing the image for the webpage, the image does not appear. Any ideas what I could be doing wrong?

  1. [... Here are four more code snippets that you can use with my Snippets panel for Flash CS3. The snippets included are described below: New Document Class This snippet creates a skeleton document ...]

Leave a Comment