Chakra Media blog

SWFAddress Design Template 2.0

With the release of SWFAddress 2.0 I figured now would be a good time to update my Flash design template to version two. The update includes the new SWFAddress 2.0 and SWFObject 2.0 as well as updated HTML embedding. The code has been cleaned up a bit and the AS2 version includes SWFMacMouseWheel (for OSX) while the AS3 version loads a Flex app (blog reader) and includes the some AS3 font embedding just for fun.

UPDATE 4.10.08 - includes the new SWFAddress 2.1 code

Download for AS2
View example

Download for AS3
View example

24 Comments so far

  1. Qtip November 21st, 2007 9:08 am

    Nice work yo!

  2. John Webber December 8th, 2007 10:06 pm

    This is great… i’m a designer and i’ve spent 10 years trying to have a great simple way to wrap cool graphics around stuff. Your source files are a deep_hook_up

    thanks man..

    John

  3. justin December 9th, 2007 8:46 am

    thanks John, your welcome! i’m glad to hear you find it useful. one of these days i’m going to finish writing up a little explanation on how it works, how to use it and make changes, etc. … and eventually a tutorial on how to do dynamic deep linking with clean URLs using this same template.

  4. chris December 12th, 2007 4:21 pm

    Good resource, it should be an eyeopener.

    I tried compiling your As3 version and error says;
    1046: Type was not found or was not a compile-time constant: SWFAddressEvent.

    this is line 50
    function handleSWFAddress(e:SWFAddressEvent):void {

    the As2 version works fine :)

    Thanks!

  5. Keith December 22nd, 2007 9:56 pm

    I too received the 1046 error. How do you fix it?

    Thanks

  6. wes December 24th, 2007 9:41 am

    I received the 1046 error, as well. What does this mean and how can I fix it.

    thanks

  7. justin December 27th, 2007 10:05 am

    i’m looking into this… it seems to only be happening with Windows machines as far as i can tell, which is strange….

  8. Pioup December 28th, 2007 8:28 am

    I think your AS2 example is a AS1 one. Cause the class concept is ignored. Just import as files is not AS2.
    Plus you are using the SWFAddress AS1 _global function…

    AS3 version works fine ^^ nice job.

  9. wes December 28th, 2007 9:11 am

    Justin,

    I receive the 1046 error on my MAC machine, not windows. I’m compiling the code in Flash CS3 version 9. Hope this helps.

  10. justin December 28th, 2007 11:42 am

    @wes : found the issue with the AS3 - 1046 error… the classpath was pointing to a directory on my machine, when it needs to point to “./src”. I’ve uploaded a new version that fixes this as well fix to an issue with the Garbage Collector and the TransistionManager that was causing the transition to stop before it was actually done. Apparently it’s not good to have nested functions like I had previously done in AS2.

  11. wes December 28th, 2007 12:31 pm

    Justin,

    You fixed the 1046 error. Excellent work and thank you again for sharing a great template.

    Cheers,

    Wes

  12. justin December 28th, 2007 4:37 pm

    @Pioup : yea, I’m using ‘inline’ code for these templates … just for simplicity’s sake. AS1 and AS2 are both compiled into the same bytecode when published, so using one or the other doesn’t really matter. _global is available in AS1/AS2 .. but not in AS3. IMHO i think using all classes for something like this is a bit overkill … especially with Flash designers who have little OOP experience. The complexity of keeping everything encapsulated and extensible is just not worth it when you’ve got deadlines and need something done yesterday. When building a site using all classes, I’d definitely want to start with a framework like ARP (AS2) or Cairngorm (AS3) or one of the many others out there. :)

  13. John Webber January 17th, 2008 12:37 am

    I have a question, How do you create a new page? I tried duplicating anything that said about for example, but I can’t get the page to come up.

    I am a bit confused by the class thing. I can’t seem to find where you connect .as files in the com/../../../ folders to the buttons.

    is there a quick way to add new pages?

  14. justin January 17th, 2008 8:49 am

    hey john

    i have an explanation of this template in the works, but I just haven’t had the time to finish it. one of these days i’ll get there… in the mean time maybe this will help.

    for the buttons, i use classes because i don’t like to have the code spread out on the button instances in the movieclips i use for navigation. if i have to make a change to the button actions, i can just change the one class file and not have to worry about every keyframe the button is on. the classes are attached to the buttons by using the Linkage property, which can be accessed by right-clicking on the button symbol in the library and selecting “Linkage…” You’ll see the classpath entered there.

    for a page called ‘newpage’, you’d could do the following:

    1. create a new button and associated class (or duplicate existing class) and change the swfaddress link : SWFAddress.setValue(’/newpage/’); Set the Linkage for the new button.

    2. in the ApplicationForm.fla file, double click the ApplicationForm mc and create a new layer (name it ‘newpage’ for consistency) and on this layer create a new movieclip with an instance name of ‘newpage’. Put your newpage content here, (actionscript for this page could be kept in an include file like the example, or directly within this movieclip.)

    3. in the ApplicationForm.as file (includes folder) you’ll need to add a line to the ‘hideSections()” function so that your new page gets hidden when there is a page change: “newpage.visible = false”;

    save and export…. that should do it!

  15. John Webber January 17th, 2008 2:55 pm

    Linkage! haha.. I looked for that for ever. When I first replied up there at the top. I came back to it because I was so inspired to the clean code.

    Thanks for sharing… and teaching.

  16. tamudjin January 18th, 2008 11:23 pm

    great work!

    noticed one thing: on Safari Version 3.0.4 (523.12.2) the AS3 Example shows up as a blank white page. i looked at Window > Activity and it said:

    Flash Player Installation:

    …”http://www.chakramedia.com/examples/SWFAddressDesignTemplate/AS3/swfobject/expressinstall.swf” ” “not found”

  17. Nick January 26th, 2008 2:12 pm

    What if I want to deeplink external swfs how could this be done?

    Thanks!

  18. Dario Gutierrez April 9th, 2008 7:55 am

    Awesome examples, thanks for sharing. Best regards

  19. Pieter May 21st, 2008 11:14 pm

    Great example indeed. Do you still have a template explanation in the works, Justin? Would be great.

    Thanks!

  20. AudioVoyeur May 28th, 2008 1:07 pm

    A massive “thank you” all the way from Cape Town, South africa!

  21. Andreas Brandt June 19th, 2008 3:26 am

    Many thanx, just excellent!

  22. Anony July 21st, 2008 9:19 pm

    Hi,

    Is there a LITE version to this? For programming beginners (aka designers)? I need a version I can easily implement into my websites.

    :(

  23. justin July 22nd, 2008 7:32 am

    Anony (and Pieter) … thanks for reminding me I need to get that explanation/tutorial done… i’ll keep working on it

  24. Max August 19th, 2008 7:38 pm

    To that designer up there- girl, good luck! Post for a developer on craiglist or sumpn.

Leave a reply

Mexico