| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
Hi,
Attached are the files for a simple slideshow/gallery presentation. I'm looking for comments for best practice in OO or convention in AS 3.0. I understand I'm not checking for loading of images in such, as that isn't my focus right now. Also, is it better to have callbacks like I'm doing from the classes and then make new classes as needed? Or is there a better way OO way of organizing the application? Thanks ![]() scripts: FLA ActionScript Code:
ImagesXML ActionScript Code:
LoadImage ActionScript Code:
SlideShow ActionScript Code:
XML HTML Code:
<?xml version="1.0" encoding="iso-8859-1"?> <banner time="5.5"> <set> <client>Client Name: Google</client> <industry>Expertise: Searching</industry> <url link="http://www.google.com">www.google.com</url> </set> <pictures> <image>image1.jpg</image> <image>image2.jpg</image> <image>image3.jpg</image> <image>image4.jpg</image> </pictures> </banner>
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman Last edited by Flash Gordon; 07-02-2007 at 07:38 AM.. |
|
|
|
|
|
#2 |
|
AS3
|
I am not saying that my way is better or something. Just few minor advices.
1. I am naming class variables starting with underscore becouse when you are passing variable to method you don;t have to use this keyword. ActionScript Code:
2. When parsing xml I am using try, catch. It's easy way to deal with incorrect xml especially when you edit it xml manually there is chance to make mistake. ActionScript Code:
I would also split xml. Create one for images and one for 'banner info'. Becouse in future you may add some parameters to image (title, navigateUrl) xml won't be so easy to read (in my opinion using one xml file for 2 things isn't good practice ) <Image> <Title>Eye</Title> <Url>Image3.png</Url> <NavigateUrl>http://www.actionscript.org</NavigateUrl> </Image> 3. In my photo gallery I am using two classes PhotoList and Photo. This way I can create new photo object in PhotoList and manage add/remove to display list them when needed or Imagine situation when you have separate link for eqach photo. You could easly get current photo link. Remember that processXML function runt from try block onXML, so if something is wrong with xml you will know. ActionScript Code:
4. Consider using document class |
|
|
|
|
|
|
|
|
#3 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
cool thanks bro!
It appear private/protected vars in a class begin with underscore so yea that is a good idea. and I used a doc class in my most recenty project. Cheers ![]()
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Developing a flash site, Part1: Some thoughts | Bloom22 | Other Flash General Questions | 6 | 09-29-2006 03:10 AM |
| RESUME: Senior Flash Designer / Developer - San Francisco | OSS | Projects and Positions | 0 | 08-16-2006 08:29 PM |
| Flash Encrypt 1.2 Released. | SIntrix | General Chat | 14 | 04-21-2005 10:02 PM |
| scrollBar on Flash Exchange | cdeg | Components | 5 | 05-03-2004 08:13 PM |