| 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
|
Where to begin....
I have to create these "InfoModules" that are manufactured by an .swf file. The modules textual appearance changes by an xml. Which InfoModule loads at run time I don't know as that is also determined by the xml file and a factory. The same InfoModule has be able to have additional "decorations" to it (see first image attached and both are a representation of InfoModule1) depending on which .swf manufactures it. In the module on the left, there is 1 additional visual element added, that is a line. In the module on the right, there are 3 additional visual elements added: 2 lines and a grey box. However, there may be no visual elements added as this is to be determined by the .swf that makes the InfoModules. For instance, if InfoModule2 is instantiated, no decorations are needed. Here is how the modules are being manufactured: ActionScript Code:
I just don't know how to add these visual elements. I was thinking of getting rid of the getDefinitionByName way of doing this, and making each "template" .swf file have its own factory and when InfoModule1 is created in the factory, adding those visual elements. If InfoModule2 is create, no visual elements...etc. The problem with this is when I add a new InfoModuleNth, I will have to go back through all the "template" factories and include this new InfoModule. Maybe that just comes with the territory.... ![]()
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman Last edited by Flash Gordon; 08-21-2007 at 12:16 AM.. |
|
|
|
|
|
#2 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
Here is code of what I was thinking. Please let me know how this looks to you. I need it to stay flexible and easily maintainable. I don't want to program this thing and then 6 months down the road realize I did a horrible job. I need your experience!
DocumentClass ActionScript Code:
InfoModuleFactory: this class creates the actual modules ActionScript Code:
ActionScript Code:
Cheers if you got this far ![]()
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman Last edited by Flash Gordon; 08-21-2007 at 08:55 AM.. |
|
|
|
|
|
|
|
|
#3 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
Anybody?
If need be, I'll play you for your input.
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
|
|
#4 |
|
as[org].addListener(this)
Join Date: Dec 2005
Location: LA, California
Posts: 838
|
Well, if there's no way around the use of a unique concrete class for each module, but you want to make it extensible, why not have each concrete class be represented as an external swf, then you can have your factory load the external swf that matches the name of the module in the xml. Then have each swf's document class abstracted to the same base class, and you can handle each one the same way.
You'll play me?? I've been had! =o |
|
|
|
|
|
#5 | |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
Quote:
If I understand you correctly, that is about how I have it now, except for that I'm not loading .swf's but just instantiating classes. What is the benefit of making them actual .swf as apposed to just classes?HA! Chump, you've been punk'd. LoL....DOH.... .... quite the typo.Thanks again for the response!
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
|
|
|
#6 |
|
as[org].addListener(this)
Join Date: Dec 2005
Location: LA, California
Posts: 838
|
Well external swfs are the only way to inject classes into a precompiled application. There are two benefits with this.
1) You can add more swfs instead of recompiling the same swf over and over...which is nicer for distribution. 2) You cut down on the filesize of the primary swf, because the code is dispersed across multiple files, and not all files need to be loaded if they aren't all used. |
|
|
|
|
|
#7 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
That's true about the loading .swf's at runtime and that's a good point. However, in my case I would also need to recompile a separate DecorateModule for each template and load that as well as DecorateModule is unique to each template. You gave me something to definitely think about!
The strange thing about OOP is it doesn't always lend to the smoothest user experience. It can slow down game play and if I'm loading 15 different modules it can increase initial loading times (having to wait for loads rather than just instantiating classes). However, it does always make maintenance easier, so in the end it is a decision of which is the more important for this situation. Thanks a lot for all the great responses, Assertnfailure. I really appreciate the help you have given me!
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
|
|
#8 |
|
as[org].addListener(this)
Join Date: Dec 2005
Location: LA, California
Posts: 838
|
Yeah....OOP is really more of a utilization of faster computers to focus on development efficiency rather than process efficiency. After all, even simple things like breaking code into functions uses additional resources.
Haha, no problem dude. Conventions and architecture are much more interesting topics than "how to attach a movieclip," and it seems you're the only one utilizing this section so far. ![]() |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| making a window close after specified amount of time | bullettobinary | ActionScript 2.0 | 1 | 06-11-2005 11:17 AM |
| Making draggable movie clips undraggable? | tryin_to_learn | ActionScript 2.0 | 10 | 05-20-2005 02:15 AM |
| Making a MC stay at current positon after scene change | Xclint | ActionScript 1.0 (and below) | 4 | 05-04-2005 11:30 PM |
| need help making component | Billy T | ActionScript 1.0 (and below) | 13 | 09-24-2002 02:13 PM |
| making my clock into analogue?? | Crapatscript | Simple Stuff (Newbies) | 2 | 03-20-2002 05:50 PM |