Re: [Flashcoders] swc

2008-03-20 Thread Meinte van't Kruis
pretty much so I guess. I'm using SWC primarily to exclude classes from
compiling in
my swf's (since these are modules and my main SWF has those classes
allready).

On Wed, Mar 19, 2008 at 11:02 PM, Helmut Granda [EMAIL PROTECTED]
wrote:

 Interesting approach. so say I have an application with 100 classes and
 say
 99 of them are ready for production and I am only editing one, I can put
 all
 my other 99 into a swc and use it with my movie without having to compile
 them all together?

 On 3/19/08, Meinte van't Kruis [EMAIL PROTECTED] wrote:
 
  you can use flash cs3 as well, if you dont want to be bothered with fcsh
  or
  mxmlc
 
  just make a document class, let's say you want to compile test.test just
  do
  this
 
  import test.test
  import flash.display.Sprite;
 
  public class SWC_export extends Sprite{
  public function SWC_export(){
if(0){
 test.test  //trick compiler into thinking
 youre
  using the class, otherwise it wont get compiled in
}
  }
  }
 
  select 'export swc' in publish settings and you're done
 
  On Tue, Mar 18, 2008 at 3:05 PM, Glen Pike [EMAIL PROTECTED]
  wrote:
 
 
   You can reduce compile times by using the Flex Compiler Shell.  If you
   are using Flash Develop or similar it works as well.
  
   http://www.google.co.uk/search?hl=enq=fcsh+compilerbtnG=Searchmeta=
   
 http://www.google.co.uk/search?hl=enq=fcsh+compilerbtnG=Searchmeta=
  
   This is not a Papervision thing, but it really helps compile times...
  
   Dwayne Neckles wrote:
I am gettign long compile times witha papervision project im doing..
 i
   have a hunch that if i use somethign called a swc that has the
  pv3dclasses
   precompiled already.. then i can save massive times...
   
anyone know of a way to create them.. and i dont have flex
   
_
Do more with your photos with Windows Live Photo Gallery.
   
  
 
 http://www.windowslive.com/share.html?ocid=TXT_TAGLM_Wave2_photos_022008___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
   
   
   
  
   --
  
   Glen Pike
   01736 759321
   www.glenpike.co.uk http://www.glenpike.co.uk
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  
 
 
 
 
  --
  M.A. van't Kruis
  http://www.malatze.nl/
 
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 



 --
 ...helmut
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
M.A. van't Kruis
http://www.malatze.nl/
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Writing Custom MovieClip Classes

2008-03-20 Thread Merrill, Jason
nope this is not working..

Ambiguous posts like that always make me laugh.  You told me my car
needs a new radiator - so I replaced it, but my car still does not
work.  Do see any kind of problem with that?  :) Explain what you did
in order for us to determine why it's not working - what I described
should work, so the only thing I can tell you is you must have done
something differently.

Jason Merrill
Bank of America  
GTO and Risk LLD Solutions Design  Development 
eTools  Multimedia 

Bank of America Flash Platform Developer Community


Are you a Bank of America associate interested in innovative learning
ideas and technologies? 
Check out our internal  GTO Innovative Learning Blog  subscribe.


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] reparent child to halt scroll

2008-03-20 Thread Allandt Bik-Elliott (Receptacle)

hi guys

i'm a bit stuck with a project i'm working on. I have a timeline  
which all runs off a scrollbar similar to the one in the kirupa forum  
(http://www.kirupa.com/forum/showthread.php?t=245468 - amended to go  
horizontal and us Tweener to act a bit more smoothly)


at the moment, i have 2 sprites, 1 scrolls with the scrollbar and 1  
doesn't.
on the scrolling sprite i have several panels and the start of some  
ticks plus a mask for the non-scrolling textfield which is on the  
other sprite


everything works as it should with this, however - i'd like to push  
it a bit further so that the title (mainTitle) scrolls with the rest  
of the panels but when it hits the left hand side, it reparents to  
the non-scrolling sprite and stays there
you can see an example of this at http://www.bbc.co.uk/history/ 
british/launch_tl_british.shtml - which i think is a really elegant  
solution to the problem of overlong panels, designed to take several  
points of interest


i've tried having everything on the scrollable sprite and  moving the  
title backwards using a SliderEvent (custom event for the scrollbar)  
but the globalToLocal() method just gets really jumpy and doesn't  
seem to put the titles in the right place or return them correctly


this is my class:

CODE
package
{
//package imports
import flash.display.Sprite;

//scrollbar imports
import com.caurina.transitions.*;
import flash.geom.*;
import flash.events.*;
import flash.text.TextFormat;
import com.receptacle.utils.*;

internal class TimelineArea extends Sprite
{
// class variable declarations
private var cp:CommonProperties;
private var taTitleBarY;
private var taPanelY:uint;
private var taPanelHeight:uint
private var scrollableBase:Sprite;
private var scrollbar:Scrollbar
private var stage_width:uint;
private var stage_height:uint;

private var panelY:uint;
private var panelColour:uint;
private var taTitleBarHeight:uint;
private var nonScrollableBase:Sprite;
private var commonGrey:uint;
private var subheadingFont:String;
private var headingFont:String;

// constructor
public function TimelineArea():void
{
setVars();
addTicks();
addPanels();
addPeriodBars();
addImageLandmark();
initialiseTimelineScrollBar();
}

private function setVars()
{
scrollbar = new Scrollbar();
cp = new CommonProperties();
stage_width  = cp.stage_width;
stage_height = cp.stage_height;
taTitleBarHeight = cp.taTitleBarHeight;
taTitleBarY  = cp.taTitleBarY;
taPanelY = cp.taPanelY;
taPanelHeight= cp.taPanelHeight;
commonGrey   = cp.tickColour;
headingFont  = cp.headingFont;
subheadingFont   = cp.subheadingFont;

scrollbar.x = 16;
scrollbar.y = 550-cp.titleBarHeight;

scrollableBase = new Sprite();
nonScrollableBase = new Sprite();
scrollableBase.y = 0;

addChild(scrollableBase);
addChild(nonScrollableBase);
}

private function addPanels():void
{
trace (Background panels added);

			createPanel(0, 1000, 0xB6, Prehistory, c. 1.7 million -  
4000 B.C.E.);
			createPanel(1000, 2000, 0xB65B00, Early Civilisations, c. 1.7  
million - 4000 B.C.E.);
			createPanel(3000, 2000, 0x123456, Sumfink Else, c. 1.7 million  
- 4000 B.C.E.);



}

		private function createPanel(panelX:Number, panelWidth:int,  
panelColour:uint, pTitle:String, date:String):void

{
			// SimpleRectangle class (rColour:uint, rOutlineColour:uint,  
rX:Number, rY:Number, rWidth:uint, rHeight:uint)
			var mainTitlePanel:SimpleRectangle = new SimpleRectangle(0xFF,  
panelColour, panelX, 0, panelWidth, taTitleBarHeight);

scrollableBase.addChild(mainTitlePanel);

			// SimpleTextField class (tfColour:uint, 

Re: [Flashcoders] Tricky Scenerio

2008-03-20 Thread Helmut Granda
great link Muzak, the only thing that turns me down from Flex samples is
that all of them are created with their components and they have the green
gradient background. I would be nice to see more customized samples...

yet again great link!

On 3/19/08, Muzak [EMAIL PROTECTED] wrote:

 Stop torturing yourself - go flex and use flexmdi:
 http://code.google.com/p/flexmdi/
 http://www.returnundefined.com/flexmdi/explorer/



 - Original Message -
 From: anuj sharma [EMAIL PROTECTED]
 To: Flashcoders@chattyfig.figleaf.com
 Sent: Thursday, March 20, 2008 12:54 AM
 Subject: [Flashcoders] Tricky Scenerio


  Hi Guys
  I am trying to accomplish something which I think is little tricky for
 me in
  AS 3.0. Please help me out if you guys have any idea how to solve it.
  I am putting multiple instances of UILoader (containing videos) on the
 main
  stage and we can put them anywhere over the screen(free flow). I have
  provided 1 grid button which will arrange the UILoaders in a grid
 format. I
  hardcoded my program to move children to specific coordinates. I did not
 use
  grid becaue i don't want to stuck user from using free flow mode of
 moving
  UILoaders. So far I am successful. Now my scenerio is that suppose
 I  have 8
  UILoaders in grid format placed 4 in one row and 4 in second row, and if
  user put 9th UILoader in 2 nd row then all the UILoaders in 2nd row will
  shrink and move to accomodate 9th UIloader. And all the UILoaders in row
 2
  including 9th UILoader should be of same size.
  In short in any row if I put UILoader on top of already existed
 UILoader,
  all the UIloaders shrink symmetrically to let the video accommodated and
  placed.
 
  For the time being I have no idea how to target this problem. Any help
 will
  be highly appreciated.
  Thanks
  Anuj

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
...helmut
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Decorator Pattern - removing a decorator

2008-03-20 Thread Jiri Heitlager

Hello List,

i am looking into the decorator pattern for an upcoming AS2 project. I was
wondering if the following is possible

var com:Component = new Component()

com = new decoratorA(com)
com = new decoratorB(decA)
com = new decoratorC(decB)

I cant seem to figure out what I need to do in order to remove let say
decB at runtime? I tried a search on the internet, but all the articles 
about the decorator pattern are about runtime adding, not removing.


Can somebody please help me if it is at all possible.

Thank you,

Jiri

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Writing Custom MovieClip Classes

2008-03-20 Thread Omar Fouad
Man Here is what I wrote.

*

public* *class* A_window *extends* MovieClip{

*public* static *const* CLOSE:String = *close*;

*public* *function* A_window() {

initListeners();

}

*private* *function* initListeners():*void* {

*this*.addEventListener(MouseEvent.CLICK, handleListener);

}

*private* *function* handleListener(e:MouseEvent):*void* {

dispatchEvent(A_window.CLOSE);

*trace*(*Dispatched*);

}

}

}
in The FLA

*

public* *class* Amlak *extends* Sprite {

*public* *function* Amlak() {

*trace*(*Application Started*);

Init();

}

*public* *function* Init():*void* {

*for*(*var* i:int; i6; i++) {

*var* MyWindow:A_window = *new* A_window();

MyWindow.x = Math.random()*500;

MyWindow.y = Math.random()*500;*
*

MyWindow.addEventListener(MyWindow.CLOSE, onClose);*
*

addChild(MyWindow);

}

}

*public* *function* onClose(e:Event):*void* {

trace(It Works!);

}

}
The error is

 1119: Access of possibly undefined property CLOSE through a reference with
static type A_window. 

It does not work.
On Thu, Mar 20, 2008 at 4:53 PM, Merrill, Jason 
[EMAIL PROTECTED] wrote:

 nope this is not working..

 Ambiguous posts like that always make me laugh.  You told me my car
 needs a new radiator - so I replaced it, but my car still does not
 work.  Do see any kind of problem with that?  :) Explain what you did
 in order for us to determine why it's not working - what I described
 should work, so the only thing I can tell you is you must have done
 something differently.

 Jason Merrill
 Bank of America
 GTO and Risk LLD Solutions Design  Development
 eTools  Multimedia

 Bank of America Flash Platform Developer Community


 Are you a Bank of America associate interested in innovative learning
 ideas and technologies?
 Check out our internal  GTO Innovative Learning Blog  subscribe.


  ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
Omar M. Fouad - Digital Emotions
http://www.omarfouad.net

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Writing Custom MovieClip Classes

2008-03-20 Thread Sidney de Koning

HI,

I think this you must rewrite  
MyWindow.addEventListener(MyWindow.CLOSE, onClose);* to this

MyWindow.addEventListener(A_Window.CLOSE, onClose);*

Because you are listening to the event comming from class A_Window.
Hope this helps,

Sid

On Mar 20, 2008, at 4:49 PM, Omar Fouad wrote:


Man Here is what I wrote.

*

public* *class* A_window *extends* MovieClip{

*public* static *const* CLOSE:String = *close*;

*public* *function* A_window() {

initListeners();

}

*private* *function* initListeners():*void* {

*this*.addEventListener(MouseEvent.CLICK, handleListener);

}

*private* *function* handleListener(e:MouseEvent):*void* {

dispatchEvent(A_window.CLOSE);

*trace*(*Dispatched*);

}

}

}
in The FLA

*

public* *class* Amlak *extends* Sprite {

*public* *function* Amlak() {

*trace*(*Application Started*);

Init();

}

*public* *function* Init():*void* {

*for*(*var* i:int; i6; i++) {

*var* MyWindow:A_window = *new* A_window();

MyWindow.x = Math.random()*500;

MyWindow.y = Math.random()*500;*
*

MyWindow.addEventListener(MyWindow.CLOSE, onClose);*
*

addChild(MyWindow);

}

}

*public* *function* onClose(e:Event):*void* {

   trace(It Works!);

}

}
The error is

 1119: Access of possibly undefined property CLOSE through a  
reference with

static type A_window. 

It does not work.
On Thu, Mar 20, 2008 at 4:53 PM, Merrill, Jason 
[EMAIL PROTECTED] wrote:


nope this is not working..


Ambiguous posts like that always make me laugh.  You told me my car
needs a new radiator - so I replaced it, but my car still does not
work.  Do see any kind of problem with that?  :) Explain what you  
did

in order for us to determine why it's not working - what I described
should work, so the only thing I can tell you is you must have done
something differently.

Jason Merrill
Bank of America
GTO and Risk LLD Solutions Design  Development
eTools  Multimedia

Bank of America Flash Platform Developer Community


Are you a Bank of America associate interested in innovative learning
ideas and technologies?
Check out our internal  GTO Innovative Learning Blog  subscribe.


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders





--
Omar M. Fouad - Digital Emotions
http://www.omarfouad.net

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be  
copied,

disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Writing Custom MovieClip Classes

2008-03-20 Thread Merrill, Jason
You need to listen to the static constant in the A_window class, because
it's a static property, not dynamic. You were referencing the dynamic
instance of the class.  So instead of:

MyWindow.addEventListener(MyWindow.CLOSE, onClose);

use:

MyWindow.addEventListener(A_window.CLOSE, onClose);


Jason Merrill
Bank of America  
GTO and Risk LLD Solutions Design  Development 
eTools  Multimedia 

Bank of America Flash Platform Developer Community


Are you a Bank of America associate interested in innovative learning
ideas and technologies? 
Check out our internal  GTO Innovative Learning Blog  subscribe.


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Re: Tricky Scenerio

2008-03-20 Thread anuj sharma
Hi guys
Thanks for replying.
That's my problem. I am kind of confused ' *To be FLEX or not to be FLEX*'.
I start exploring FLEX but it's just lack of guidance and my initial
hesitation to try FLEX with my shrinking deadline.
My whole code is currently on the main timeline( no custom classes yet) in
Flash authoring IDE and working fine except this last flexible grid thing.
If this thing has to be done only in FLEX then I have to go for that.
Please help me out if I have to use FLEX and if my existing code is going to
be merged and working fine in FLEX or not.
I will appreciate your help in this matter.
Regards
Anuj

On Wed, Mar 19, 2008 at 4:54 PM, anuj sharma [EMAIL PROTECTED] wrote:

 Hi Guys
 I am trying to accomplish something which I think is little tricky for me
 in AS 3.0. Please help me out if you guys have any idea how to solve it.
 I am putting multiple instances of UILoader (containing videos) on the
 main stage and we can put them anywhere over the screen(free flow). I have
 provided 1 grid button which will arrange the UILoaders in a grid format. I
 hardcoded my program to move children to specific coordinates. I did not use
 grid becaue i don't want to stuck user from using free flow mode of moving
 UILoaders. So far I am successful. Now my scenerio is that suppose I  have 8
 UILoaders in grid format placed 4 in one row and 4 in second row, and if
 user put 9th UILoader in 2 nd row then all the UILoaders in 2nd row will
 shrink and move to accomodate 9th UIloader. And all the UILoaders in row 2
 including 9th UILoader should be of same size.
 In short in any row if I put UILoader on top of already existed UILoader,
 all the UIloaders shrink symmetrically to let the video accommodated and
 placed.

 For the time being I have no idea how to target this problem. Any help
 will be highly appreciated.
 Thanks
 Anuj



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Writing Custom MovieClip Classes

2008-03-20 Thread Hans Wichman
i'm betting it's the 

sorry couldn't resist;)

On Thu, Mar 20, 2008 at 4:49 PM, Omar Fouad [EMAIL PROTECTED] wrote:

 Man Here is what I wrote.

 *

 public* *class* A_window *extends* MovieClip{

 *public* static *const* CLOSE:String = *close*;

 *public* *function* A_window() {

 initListeners();

 }

 *private* *function* initListeners():*void* {

 *this*.addEventListener(MouseEvent.CLICK, handleListener);

 }

 *private* *function* handleListener(e:MouseEvent):*void* {

 dispatchEvent(A_window.CLOSE);

 *trace*(*Dispatched*);

 }

 }

 }
 in The FLA

 *

 public* *class* Amlak *extends* Sprite {

 *public* *function* Amlak() {

 *trace*(*Application Started*);

 Init();

 }

 *public* *function* Init():*void* {

 *for*(*var* i:int; i6; i++) {

 *var* MyWindow:A_window = *new* A_window();

 MyWindow.x = Math.random()*500;

 MyWindow.y = Math.random()*500;*
 *

 MyWindow.addEventListener(MyWindow.CLOSE, onClose);*
 *

 addChild(MyWindow);

 }

 }

 *public* *function* onClose(e:Event):*void* {

trace(It Works!);

 }

 }
 The error is

  1119: Access of possibly undefined property CLOSE through a reference
 with
 static type A_window. 

 It does not work.
 On Thu, Mar 20, 2008 at 4:53 PM, Merrill, Jason 
 [EMAIL PROTECTED] wrote:

   nope this is not working..
 
  Ambiguous posts like that always make me laugh.  You told me my car
  needs a new radiator - so I replaced it, but my car still does not
  work.  Do see any kind of problem with that?  :) Explain what you did
  in order for us to determine why it's not working - what I described
  should work, so the only thing I can tell you is you must have done
  something differently.
 
  Jason Merrill
  Bank of America
  GTO and Risk LLD Solutions Design  Development
  eTools  Multimedia
 
  Bank of America Flash Platform Developer Community
 
 
  Are you a Bank of America associate interested in innovative learning
  ideas and technologies?
  Check out our internal  GTO Innovative Learning Blog  subscribe.
 
 
   ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 



 --
 Omar M. Fouad - Digital Emotions
 http://www.omarfouad.net

 This e-mail and any attachment is for authorised use by the intended
 recipient(s) only. It may contain proprietary material, confidential
 information and/or be subject to legal privilege. It should not be copied,
 disclosed to, retained or used by, any other party. If you are not an
 intended recipient then please promptly delete this e-mail and any
 attachment and all copies and inform the sender. Thank you.
 ___
  Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Writing Custom MovieClip Classes

2008-03-20 Thread Ian Thomas
If this is AS3, this line:

dispatchEvent(A_window.CLOSE);

should at least be something like:

dispatchEvent(new Event(A_window.CLOSE));

dispatchEvent() expects to sent Event objects around (or their
subclasses), not strings.

Ian

On Thu, Mar 20, 2008 at 3:49 PM, Omar Fouad [EMAIL PROTECTED] wrote:
 Man Here is what I wrote.

  *

  public* *class* A_window *extends* MovieClip{


  *public* static *const* CLOSE:String = *close*;

  *public* *function* A_window() {

  initListeners();

  }

  *private* *function* initListeners():*void* {

  *this*.addEventListener(MouseEvent.CLICK, handleListener);

  }

  *private* *function* handleListener(e:MouseEvent):*void* {

  dispatchEvent(A_window.CLOSE);

  *trace*(*Dispatched*);

  }

  }

  }
  in The FLA

  *

  public* *class* Amlak *extends* Sprite {

  *public* *function* Amlak() {

  *trace*(*Application Started*);

  Init();

  }

  *public* *function* Init():*void* {

  *for*(*var* i:int; i6; i++) {

  *var* MyWindow:A_window = *new* A_window();

  MyWindow.x = Math.random()*500;

  MyWindow.y = Math.random()*500;*
  *

  MyWindow.addEventListener(MyWindow.CLOSE, onClose);*
  *

  addChild(MyWindow);

  }

  }

  *public* *function* onClose(e:Event):*void* {

 trace(It Works!);

  }

  }
  The error is

   1119: Access of possibly undefined property CLOSE through a reference with
  static type A_window. 

  It does not work.
  On Thu, Mar 20, 2008 at 4:53 PM, Merrill, Jason 

 [EMAIL PROTECTED] wrote:



  nope this is not working..
  
   Ambiguous posts like that always make me laugh.  You told me my car
   needs a new radiator - so I replaced it, but my car still does not
   work.  Do see any kind of problem with that?  :) Explain what you did
   in order for us to determine why it's not working - what I described
   should work, so the only thing I can tell you is you must have done
   something differently.
  
   Jason Merrill
   Bank of America
   GTO and Risk LLD Solutions Design  Development
   eTools  Multimedia
  
   Bank of America Flash Platform Developer Community
  
  
   Are you a Bank of America associate interested in innovative learning
   ideas and technologies?
   Check out our internal  GTO Innovative Learning Blog  subscribe.
  
  
___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  



  --

 Omar M. Fouad - Digital Emotions
  http://www.omarfouad.net

  This e-mail and any attachment is for authorised use by the intended
  recipient(s) only. It may contain proprietary material, confidential
  information and/or be subject to legal privilege. It should not be copied,
  disclosed to, retained or used by, any other party. If you are not an
  intended recipient then please promptly delete this e-mail and any
  attachment and all copies and inform the sender. Thank you.
  ___


 Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Writing Custom MovieClip Classes

2008-03-20 Thread Merrill, Jason
should at least be something like:

dispatchEvent(new Event(A_window.CLOSE));

Good catch.  - I typed that on the fly.

Jason Merrill
Bank of America  
GTO and Risk LLD Solutions Design  Development 
eTools  Multimedia 

Bank of America Flash Platform Developer Community


Are you a Bank of America associate interested in innovative learning
ideas and technologies? 
Check out our internal  GTO Innovative Learning Blog  subscribe.




 

-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf 
Of Ian Thomas
Sent: Thursday, March 20, 2008 12:06 PM
To: Flash Coders List
Subject: Re: [Flashcoders] Writing Custom MovieClip Classes

If this is AS3, this line:

dispatchEvent(A_window.CLOSE);

should at least be something like:

dispatchEvent(new Event(A_window.CLOSE));

dispatchEvent() expects to sent Event objects around (or 
their subclasses), not strings.

Ian

On Thu, Mar 20, 2008 at 3:49 PM, Omar Fouad 
[EMAIL PROTECTED] wrote:
 Man Here is what I wrote.

  *

  public* *class* A_window *extends* MovieClip{


  *public* static *const* CLOSE:String = *close*;

  *public* *function* A_window() {

  initListeners();

  }

  *private* *function* initListeners():*void* {

  *this*.addEventListener(MouseEvent.CLICK, handleListener);

  }

  *private* *function* handleListener(e:MouseEvent):*void* {

  dispatchEvent(A_window.CLOSE);

  *trace*(*Dispatched*);

  }

  }

  }
  in The FLA

  *

  public* *class* Amlak *extends* Sprite {

  *public* *function* Amlak() {

  *trace*(*Application Started*);

  Init();

  }

  *public* *function* Init():*void* {

  *for*(*var* i:int; i6; i++) {

  *var* MyWindow:A_window = *new* A_window();

  MyWindow.x = Math.random()*500;

  MyWindow.y = Math.random()*500;*
  *

  MyWindow.addEventListener(MyWindow.CLOSE, onClose);*
  *

  addChild(MyWindow);

  }

  }

  *public* *function* onClose(e:Event):*void* {

 trace(It Works!);

  }

  }
  The error is

   1119: Access of possibly undefined property CLOSE through a 
 reference with  static type A_window. 

  It does not work.
  On Thu, Mar 20, 2008 at 4:53 PM, Merrill, Jason 

 [EMAIL PROTECTED] wrote:



  nope this is not working..
  
   Ambiguous posts like that always make me laugh.  You told me my 
 car   needs a new radiator - so I replaced it, but my car 
still does 
 not   work.  Do see any kind of problem with that?  :) 
Explain what 
 you did   in order for us to determine why it's not 
working - what I 
 described   should work, so the only thing I can tell you 
is you must 
 have done   something differently.
  
   Jason Merrill
   Bank of America
   GTO and Risk LLD Solutions Design  Development   eTools  
 Multimedia Bank of America Flash Platform Developer 
Community
Are you a Bank of America associate interested in innovative 
 learning   ideas and technologies?
   Check out our internal  GTO Innovative Learning Blog  
subscribe.
  
  
___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  



  --

 Omar M. Fouad - Digital Emotions
  http://www.omarfouad.net

  This e-mail and any attachment is for authorised use by 
the intended
  recipient(s) only. It may contain proprietary material, 
confidential  
 information and/or be subject to legal privilege. It should not be 
 copied,  disclosed to, retained or used by, any other party. If you 
 are not an  intended recipient then please promptly delete 
this e-mail 
 and any  attachment and all copies and inform the sender. Thank you.
  ___


 Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Tricky Scenerio

2008-03-20 Thread Bob Wohl
http://flex.org/showcase/


B.

On Thu, Mar 20, 2008 at 8:35 AM, Helmut Granda [EMAIL PROTECTED]
wrote:

 great link Muzak, the only thing that turns me down from Flex samples is
 that all of them are created with their components and they have the green
 gradient background. I would be nice to see more customized samples...

 yet again great link!

 On 3/19/08, Muzak [EMAIL PROTECTED] wrote:
 
  Stop torturing yourself - go flex and use flexmdi:
  http://code.google.com/p/flexmdi/
  http://www.returnundefined.com/flexmdi/explorer/
 
 
 
  - Original Message -
  From: anuj sharma [EMAIL PROTECTED]
  To: Flashcoders@chattyfig.figleaf.com
  Sent: Thursday, March 20, 2008 12:54 AM
  Subject: [Flashcoders] Tricky Scenerio
 
 
   Hi Guys
   I am trying to accomplish something which I think is little tricky for
  me in
   AS 3.0. Please help me out if you guys have any idea how to solve it.
   I am putting multiple instances of UILoader (containing videos) on the
  main
   stage and we can put them anywhere over the screen(free flow). I have
   provided 1 grid button which will arrange the UILoaders in a grid
  format. I
   hardcoded my program to move children to specific coordinates. I did
 not
  use
   grid becaue i don't want to stuck user from using free flow mode of
  moving
   UILoaders. So far I am successful. Now my scenerio is that suppose
  I  have 8
   UILoaders in grid format placed 4 in one row and 4 in second row, and
 if
   user put 9th UILoader in 2 nd row then all the UILoaders in 2nd row
 will
   shrink and move to accomodate 9th UIloader. And all the UILoaders in
 row
  2
   including 9th UILoader should be of same size.
   In short in any row if I put UILoader on top of already existed
  UILoader,
   all the UIloaders shrink symmetrically to let the video accommodated
 and
   placed.
  
   For the time being I have no idea how to target this problem. Any help
  will
   be highly appreciated.
   Thanks
   Anuj
 
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 



 --
 ...helmut
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Decorator Pattern - removing a decorator

2008-03-20 Thread Cory Petosky
That's not really how Decorator is meant to work.

You could hack around it by exposing the decorated instance in your
Decorator interface, digging down to it, and using a bunch of
instanceof calls to figure out which is which. I really don't
recommend this, though -- instead, use a different design pattern or
program architecture.

On 3/20/08, Jiri Heitlager [EMAIL PROTECTED] wrote:
 Hello List,

  i am looking into the decorator pattern for an upcoming AS2 project. I was
  wondering if the following is possible

  var com:Component = new Component()

  com = new decoratorA(com)
  com = new decoratorB(decA)
  com = new decoratorC(decB)

  I cant seem to figure out what I need to do in order to remove let say
  decB at runtime? I tried a search on the internet, but all the articles
  about the decorator pattern are about runtime adding, not removing.

  Can somebody please help me if it is at all possible.

  Thank you,

  Jiri

  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



-- 
Cory Petosky : Lead Developer : PUNY
1618 Central Ave NE Suite 130
Minneapolis, MN 55413
Office: 612.216.3924
Mobile: 240.422.9652
Fax: 612.605.9216
http://www.punyentertainment.com
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Tricky Scenerio

2008-03-20 Thread Helmut Granda
amazing... thanks for sharing

On 3/20/08, Bob Wohl [EMAIL PROTECTED] wrote:

 http://flex.org/showcase/


 B.

 On Thu, Mar 20, 2008 at 8:35 AM, Helmut Granda [EMAIL PROTECTED]
 wrote:


  great link Muzak, the only thing that turns me down from Flex samples is
  that all of them are created with their components and they have the
 green
  gradient background. I would be nice to see more customized samples...
 
  yet again great link!
 
  On 3/19/08, Muzak [EMAIL PROTECTED] wrote:
  
   Stop torturing yourself - go flex and use flexmdi:
   http://code.google.com/p/flexmdi/
   http://www.returnundefined.com/flexmdi/explorer/
  
  
  
   - Original Message -
   From: anuj sharma [EMAIL PROTECTED]
   To: Flashcoders@chattyfig.figleaf.com
   Sent: Thursday, March 20, 2008 12:54 AM
   Subject: [Flashcoders] Tricky Scenerio
  
  
Hi Guys
I am trying to accomplish something which I think is little tricky
 for
   me in
AS 3.0. Please help me out if you guys have any idea how to solve
 it.
I am putting multiple instances of UILoader (containing videos) on
 the
   main
stage and we can put them anywhere over the screen(free flow). I
 have
provided 1 grid button which will arrange the UILoaders in a grid
   format. I
hardcoded my program to move children to specific coordinates. I did
  not
   use
grid becaue i don't want to stuck user from using free flow mode of
   moving
UILoaders. So far I am successful. Now my scenerio is that suppose
   I  have 8
UILoaders in grid format placed 4 in one row and 4 in second row,
 and
  if
user put 9th UILoader in 2 nd row then all the UILoaders in 2nd row
  will
shrink and move to accomodate 9th UIloader. And all the UILoaders in
  row
   2
including 9th UILoader should be of same size.
In short in any row if I put UILoader on top of already existed
   UILoader,
all the UIloaders shrink symmetrically to let the video accommodated
  and
placed.
   
For the time being I have no idea how to target this problem. Any
 help
   will
be highly appreciated.
Thanks
Anuj
  
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  
 
 
 
  --
  ...helmut
  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
...helmut
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Re: Tricky Scenerio

2008-03-20 Thread Helmut Granda
Hi Anuj,

You dont have to use Flex for this project, you can use flash. the only
think that Muzak commented is that there is alibrary out there that would
make things a lot easier but think about it. Is the example shown exactly
what you need? Like you commented it might be too late in the game to switch
the whole project to FLEX, can your customized skins/graphics be implemented
in Flex? or would it be easier to write similar routines in flash?

On 3/20/08, anuj sharma [EMAIL PROTECTED] wrote:

 Hi guys
 Thanks for replying.
 That's my problem. I am kind of confused ' *To be FLEX or not to be
 FLEX*'.
 I start exploring FLEX but it's just lack of guidance and my initial
 hesitation to try FLEX with my shrinking deadline.
 My whole code is currently on the main timeline( no custom classes yet) in
 Flash authoring IDE and working fine except this last flexible grid thing.
 If this thing has to be done only in FLEX then I have to go for that.
 Please help me out if I have to use FLEX and if my existing code is going
 to
 be merged and working fine in FLEX or not.
 I will appreciate your help in this matter.
 Regards

 Anuj


 On Wed, Mar 19, 2008 at 4:54 PM, anuj sharma [EMAIL PROTECTED] wrote:

  Hi Guys
  I am trying to accomplish something which I think is little tricky for
 me
  in AS 3.0. Please help me out if you guys have any idea how to solve it.
  I am putting multiple instances of UILoader (containing videos) on the
  main stage and we can put them anywhere over the screen(free flow). I
 have
  provided 1 grid button which will arrange the UILoaders in a grid
 format. I
  hardcoded my program to move children to specific coordinates. I did not
 use
  grid becaue i don't want to stuck user from using free flow mode of
 moving
  UILoaders. So far I am successful. Now my scenerio is that suppose
 I  have 8
  UILoaders in grid format placed 4 in one row and 4 in second row, and if
  user put 9th UILoader in 2 nd row then all the UILoaders in 2nd row will
  shrink and move to accomodate 9th UIloader. And all the UILoaders in row
 2
  including 9th UILoader should be of same size.
  In short in any row if I put UILoader on top of already existed
 UILoader,
  all the UIloaders shrink symmetrically to let the video accommodated and
  placed.
 
  For the time being I have no idea how to target this problem. Any help
  will be highly appreciated.
  Thanks
  Anuj
 
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
...helmut
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Decorator Pattern - removing a decorator

2008-03-20 Thread Jiri Heitlager
I could use another design pattern, but I need to figure out which one 
then. The application is one where the user can selected certain items 
and those items are put on a canvas. Then when the user selects the item 
on the canvas, a panel shows up that allows the item to be rotated, 
scaled and possible edited ,i.e add text. I thought that the decorator 
would be perfect for this.
Come to think of it maybe it still is. I really dont ever need to remove 
any decorator that is added do I.
Them item starts blank and when the user rotates it, I just add a 
decorator, rotatorModifier. Then the decorator  interface has a method
setModifierProperty(key , value), in this case key = rot value=number. 
The decorator component holds a hash and checks if 
hash[rot]!=undefined, then adds the rot and the value. Then calls an 
update method to reflect the property set.

Deleting the modifier would be then just setting the hash[rot] to 0.

Does that make sense and I am approaching this in a efficient way. I am 
quit new to design patterns, but fell in love with there elegance and 
would like to learn how to implement them as best as possible. Some 
feedback would be very much appreciated.


Jiri

Cory Petosky wrote:

That's not really how Decorator is meant to work.

You could hack around it by exposing the decorated instance in your
Decorator interface, digging down to it, and using a bunch of
instanceof calls to figure out which is which. I really don't
recommend this, though -- instead, use a different design pattern or
program architecture.

On 3/20/08, Jiri Heitlager [EMAIL PROTECTED] wrote:

Hello List,

 i am looking into the decorator pattern for an upcoming AS2 project. I was
 wondering if the following is possible

 var com:Component = new Component()

 com = new decoratorA(com)
 com = new decoratorB(decA)
 com = new decoratorC(decB)

 I cant seem to figure out what I need to do in order to remove let say
 decB at runtime? I tried a search on the internet, but all the articles
 about the decorator pattern are about runtime adding, not removing.

 Can somebody please help me if it is at all possible.

 Thank you,

 Jiri

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders





___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Writing Custom MovieClip Classes

2008-03-20 Thread Merrill, Jason
Oh yeah!! That worked... Now I'll try to understand it.

I thought I had to extend the EventDispatcher Class.

Glad you got it working.  Yeah, you don't have to extend EventDispatcher
because you're already extending MovieClip which is an (not directly,but
further down the chain) of EventDispatcher, as all display objects are:

MovieClip   Sprite  DisplayObjectContainer   InteractiveObject 
DisplayObject  EventDispatcher  Object


Jason Merrill
Bank of America  
GTO and Risk LLD Solutions Design  Development 
eTools  Multimedia 

Bank of America Flash Platform Developer Community


Are you a Bank of America associate interested in innovative learning
ideas and technologies? 
Check out our internal  GTO Innovative Learning Blog  subscribe.



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Writing Custom MovieClip Classes

2008-03-20 Thread Merrill, Jason
which is an __

typo, I meant to add the word, extension

which is an extension (not directly,but further down the chain) of
EventDispatcher

Jason Merrill
Bank of America  
GTO and Risk LLD Solutions Design  Development 
eTools  Multimedia 

Bank of America Flash Platform Developer Community


Are you a Bank of America associate interested in innovative learning
ideas and technologies? 
Check out our internal  GTO Innovative Learning Blog  subscribe.



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Decorator Pattern - removing a decorator

2008-03-20 Thread Meinte van't Kruis
it's better to code and accidentally discover you've used a design pattern,
than beginning to code thinking you have to use a specifick pattern, but
that's just my humble opinion.

On Thu, Mar 20, 2008 at 6:08 PM, Jiri Heitlager 
[EMAIL PROTECTED] wrote:

 I could use another design pattern, but I need to figure out which one
 then. The application is one where the user can selected certain items
 and those items are put on a canvas. Then when the user selects the item
 on the canvas, a panel shows up that allows the item to be rotated,
 scaled and possible edited ,i.e add text. I thought that the decorator
 would be perfect for this.
 Come to think of it maybe it still is. I really dont ever need to remove
 any decorator that is added do I.
 Them item starts blank and when the user rotates it, I just add a
 decorator, rotatorModifier. Then the decorator  interface has a method
 setModifierProperty(key , value), in this case key = rot value=number.
 The decorator component holds a hash and checks if
 hash[rot]!=undefined, then adds the rot and the value. Then calls an
 update method to reflect the property set.
 Deleting the modifier would be then just setting the hash[rot] to 0.

 Does that make sense and I am approaching this in a efficient way. I am
 quit new to design patterns, but fell in love with there elegance and
 would like to learn how to implement them as best as possible. Some
 feedback would be very much appreciated.

 Jiri

 Cory Petosky wrote:
  That's not really how Decorator is meant to work.
 
  You could hack around it by exposing the decorated instance in your
  Decorator interface, digging down to it, and using a bunch of
  instanceof calls to figure out which is which. I really don't
  recommend this, though -- instead, use a different design pattern or
  program architecture.
 
  On 3/20/08, Jiri Heitlager [EMAIL PROTECTED] wrote:
  Hello List,
 
   i am looking into the decorator pattern for an upcoming AS2 project. I
 was
   wondering if the following is possible
 
   var com:Component = new Component()
 
   com = new decoratorA(com)
   com = new decoratorB(decA)
   com = new decoratorC(decB)
 
   I cant seem to figure out what I need to do in order to remove let say
   decB at runtime? I tried a search on the internet, but all the
 articles
   about the decorator pattern are about runtime adding, not removing.
 
   Can somebody please help me if it is at all possible.
 
   Thank you,
 
   Jiri
 
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
M.A. van't Kruis
http://www.malatze.nl/
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Decorator Pattern - removing a decorator

2008-03-20 Thread Jiri Heitlager

Meinte,

i have been doing that for the last 4 years and I am not saying you are 
wrong, but I get the feeling that I am reinventing the wheel every time. 
Why not use patterns that have been developed over the last n years and 
as a result get better maintainable code.
I just dont have that god given gift/talent or education that I can just 
code and discover that I used a pattern. And how can I discover I used a 
pattern, if I dont know them that well yet.
So maybe your right, but personally I dont think it will cut the cake 
for me, if I want to develop myself as a better programmer and be able 
to start delivering code that is easy for other programmers to 
recognize. Am I living in a dream?


I am still looking for some feedback about my last post, do you wanna 
give it a go?


Jiri

Meinte van't Kruis wrote:

it's better to code and accidentally discover you've used a design pattern,
than beginning to code thinking you have to use a specifick pattern, but
that's just my humble opinion.

On Thu, Mar 20, 2008 at 6:08 PM, Jiri Heitlager 
[EMAIL PROTECTED] wrote:


I could use another design pattern, but I need to figure out which one
then. The application is one where the user can selected certain items
and those items are put on a canvas. Then when the user selects the item
on the canvas, a panel shows up that allows the item to be rotated,
scaled and possible edited ,i.e add text. I thought that the decorator
would be perfect for this.
Come to think of it maybe it still is. I really dont ever need to remove
any decorator that is added do I.
Them item starts blank and when the user rotates it, I just add a
decorator, rotatorModifier. Then the decorator  interface has a method
setModifierProperty(key , value), in this case key = rot value=number.
The decorator component holds a hash and checks if
hash[rot]!=undefined, then adds the rot and the value. Then calls an
update method to reflect the property set.
Deleting the modifier would be then just setting the hash[rot] to 0.

Does that make sense and I am approaching this in a efficient way. I am
quit new to design patterns, but fell in love with there elegance and
would like to learn how to implement them as best as possible. Some
feedback would be very much appreciated.

Jiri

Cory Petosky wrote:

That's not really how Decorator is meant to work.

You could hack around it by exposing the decorated instance in your
Decorator interface, digging down to it, and using a bunch of
instanceof calls to figure out which is which. I really don't
recommend this, though -- instead, use a different design pattern or
program architecture.

On 3/20/08, Jiri Heitlager [EMAIL PROTECTED] wrote:

Hello List,

 i am looking into the decorator pattern for an upcoming AS2 project. I

was

 wondering if the following is possible

 var com:Component = new Component()

 com = new decoratorA(com)
 com = new decoratorB(decA)
 com = new decoratorC(decB)

 I cant seem to figure out what I need to do in order to remove let say
 decB at runtime? I tried a search on the internet, but all the

articles

 about the decorator pattern are about runtime adding, not removing.

 Can somebody please help me if it is at all possible.

 Thank you,

 Jiri

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders






___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Decorator Pattern - removing a decorator

2008-03-20 Thread Steven Sacks

What you're experiencing is premature enlightenment. - Tyler Durden

The Gang of Four specifically warns about this, and it's important to 
acknowledge that it's happening.


When people first learn about design patterns, they will immediately 
begin looking for places to apply them.  They will do this and fail in 
some particular way, and in doing so, learn more about that design 
pattern or perhaps one that they don't know of, yet.  The issue most 
people have is trying to solve a problem with a design pattern they just 
learned without understanding that it isn't an appropriate pattern.  
But, you have to do it wrong in order to learn why.  Prepare to fail and 
learn from those failures.  It will make you a better coder.


Your initial hunch is that your problem would best be solved by the 
Decorator pattern, but it very well may not be.  The Decorator pattern 
has fallen out of favor in recent years, as many people believe it 
violates good OOP practices.  It has its uses, but they're limited.


You should continue coding this using Decorator if you like, so you can 
discover what its limitations are.  It sounds like you're already 
hitting them.  It's possible that Strategy and Composition might be 
useful here, as well.  Just understand that you won't understand until 
you code yourself into a corner a few times.  :)


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Decorator Pattern - removing a decorator

2008-03-20 Thread Kerry Thompson
Steven Sacks wrote:

 Your initial hunch is that your problem would best be solved by the
 Decorator pattern, but it very well may not be.  The Decorator pattern
 has fallen out of favor in recent years, as many people believe it
 violates good OOP practices.  It has its uses, but they're limited.

Design Patterns, the book by the gang of four, is a very, very good book,
but I wouldn't make it my only way of structuring code. Read it, use it, but
be aware of its limitations.

The OOP paradigm has gone through different phases. At first it was all
about inheritance and reusable code. Then we discovered composition, and
pretty soon everybody was doing composition.

Design Patterns is very strongly composition-oriented, to the point of
almost being dismissive of inheritance. And, sure enough, the pendulum has
swung back to a more inheritance-centric OOP paradigm.

In practice, both inheritance and composition are important, useful
approaches to OOP design. I'm a stubborn old cuss, and I've always resisted
following the latest trend (extreme programming and the like). I read,
observe, and cherry-pick what looks useful to me.

I guess I'm saying pretty much the same thing Steven is--don't just follow
the gurus. Understand the guru's approach, then choose what's useful to you.
The gang of four, as good (and popular) as they are, don't have all the
answers.

Cordially,

Kerry Thompson


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Decorator Pattern - removing a decorator

2008-03-20 Thread Jiri Heitlager

Steven,

thanks for that helpfull reply. It is funny becuase I was just thinking 
about the dualism, on the one hand there are these wonderfull elegant 
design patterns that supposed to make things easier and on the other 
hand it seems like coding has just became harder ever since when I 
started applying them. Knowing about them seems sometimes almost a 
burden. But the absolute elegance of how they can be used, which is 
reflected in the many articles and books on them, just makes me want to 
understand them better. And as you say, applying them and failing 
horribly is a perfect way to get to know their individual intrisic workings.


Strategy is the one that I am just now looking into, because the 
Decorator and the possibilty of not removing them just doesnt make them 
suitable for the behaviour I was after on that level.


I have something like this now.

var item = new Item()
item.executeModifier() {

modifier.execute(item.mc)
}
item.setModifier(modifier) this.modifier = modifier
item.setClip(mc) this.mc = mc


Then I will use the Decorator pattern, for decorating (what else) the 
items. It so happens that some Items contain text that can be edited.



class ItemTextDecorator implements itemInterface{
_item:Iteminterface

 function ItemTextDecorator(item:Iteminterface)
{
_item = item
}

function executeModifier() {

_item.executeModifier(_item.mc)
}

function setModifier(modifier) {

_item.setModifier(modifier)
}

function.setClip(mc) this.mc = mc

//additional function to set Text and edit text
}

It feels beautiful to piece things together like this :)

Just understand that you won't understand until
 you code yourself into a corner a few times.  :)
When will it end, if ever?



What you're experiencing is premature enlightenment. - Tyler Durden

The Gang of Four specifically warns about this, and it's important to 
acknowledge that it's happening.


When people first learn about design patterns, they will immediately 
begin looking for places to apply them.  They will do this and fail in 
some particular way, and in doing so, learn more about that design 
pattern or perhaps one that they don't know of, yet.  The issue most 
people have is trying to solve a problem with a design pattern they just 
learned without understanding that it isn't an appropriate pattern.  
But, you have to do it wrong in order to learn why.  Prepare to fail and 
learn from those failures.  It will make you a better coder.


Your initial hunch is that your problem would best be solved by the 
Decorator pattern, but it very well may not be.  The Decorator pattern 
has fallen out of favor in recent years, as many people believe it 
violates good OOP practices.  It has its uses, but they're limited.


You should continue coding this using Decorator if you like, so you can 
discover what its limitations are.  It sounds like you're already 
hitting them.  It's possible that Strategy and Composition might be 
useful here, as well.  Just understand that you won't understand until 
you code yourself into a corner a few times.  :)


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders