RE: [Flashcoders] determining which object is displayed at agivenpoint

2007-02-09 Thread Erik Bianchi
I think he is referring to the following class from another thread. One
problem pertaining to your issue is that it doesn't take into consideration
depth. It is still more process intensive then just firing a callback on
rollOver but could be useful for you and give you some ideas: 

class com.domain.RollWhileWithin extends MovieClip {
public var rolled:Boolean;

function RollWhileWithin () 
{
rolled = false;
}
public function doRollOver():Void 
{
if (!rolled) {
rolled = true;
gotoAndStop(over);
}
}
public function doRollOut():Void 
{
if (rolled) {
rolled = false;
gotoAndStop(up);
}
}
}




One level above it, you can manage as many clips as there are.

var checkMouseInterval:Number;
clearInterval(checkMouseInterval);
checkMouseInterval = setInterval(this, checkMouse, 100); private function
checkMouse():Void {
var i:Number = 5;
while (i--) {
var clip:MovieClip = this[MC_RollClip + i];
if (_xmouse  clip._x  _xmouse  clip._x + clip._width 
_ymouse  clip._y  _ymouse  clip._y + clip._height) {
clip.doRollOver();
} else {
clip.doRollOut();
}
}
}

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Vishal Kapur
Sent: Thursday, February 08, 2007 11:19 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] determining which object is displayed at
agivenpoint

Ok.  This is what I was missing.  Thanks to Karina and Erik for
pointing out that you need to compare the entire parent chain of two
objects to figure out which one is being rendered above the other.

The only thing to add is that in addition to checking depths, the
_visible property needs to be checked for the parent chain for each
object (so if _visible is false anywhere in the parent chain, I
consider that object to be invisible).  This works in all cases except
for some TextFields, where the bounding box of the textfield object is
bigger than the area actually occupied by the text.  This can be
solved with a custom hitTest() implementation that uses
Textfield.textWidth and .textHeight to get the bounding box of the
displayed text.  An interesting corollary is that this method would be
a way to implement onRollOver for TextFields (if that ever proves
useful to anyone).

Steven, I'm not familiar with the class you're referring to.  Could
you send the link to it?  I'm always looking to improve the simplicity
and efficiency of my code...

-- Vishal


On 2/8/07, Steven Sacks | BLITZ [EMAIL PROTECTED] wrote:
 I think the class I wrote works well enough, I actually pulled it out of
 an app I'm working on with complex rollovers like that.  Why not
 consider my way?  It's simple, easy and, most importantly, it works.  It
 hardly takes any processing power, too.


 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Identifier expected

2007-02-09 Thread Erik Bianchi
2 issues:

1) identifiers are an expression not a string ie a:hey vs a:hey. The
later will not work

2) You can not use a number as identifier in this case. The compiler catches
it and throws an error. However, you can hack it using this[1] = hello
world; trace(this[1]); but then you can use {:} type syntax.

-erik

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mendelsohn,
Michael
Sent: Friday, February 09, 2007 10:09 AM
To: Flashcoders mailing list
Subject: [Flashcoders] Identifier expected

Hi list...

Simple question -- why doesn't the 2nd line work?  The identifier
expected error is traced at compile time.

Thanks,
- Michael M.


function createObj():Void {
this._data = new Object();
this._data[a] = {1:new Number(0), 2:new Number(0), 3:new
Number(0)}; 
}
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Identifier expected

2007-02-09 Thread Erik Bianchi
*can't use* {:}

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Erik Bianchi
Sent: Friday, February 09, 2007 10:25 AM
To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] Identifier expected

2 issues:

1) identifiers are an expression not a string ie a:hey vs a:hey. The
later will not work

2) You can not use a number as identifier in this case. The compiler catches
it and throws an error. However, you can hack it using this[1] = hello
world; trace(this[1]); but then you can use {:} type syntax.

-erik

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mendelsohn,
Michael
Sent: Friday, February 09, 2007 10:09 AM
To: Flashcoders mailing list
Subject: [Flashcoders] Identifier expected

Hi list...

Simple question -- why doesn't the 2nd line work?  The identifier
expected error is traced at compile time.

Thanks,
- Michael M.


function createObj():Void {
this._data = new Object();
this._data[a] = {1:new Number(0), 2:new Number(0), 3:new
Number(0)}; 
}
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] finding domain

2007-02-09 Thread Erik Bianchi
Does anyone know if _url is the same thing Flash Player uses to check
sandbox?

-erik 

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] finding domain

2007-02-09 Thread Erik Bianchi
From testing it would appear no. =(

-erik

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Erik Bianchi
Sent: Friday, February 09, 2007 2:07 PM
To: 'Flashcoders mailing list'
Subject: [Flashcoders] finding domain

Does anyone know if _url is the same thing Flash Player uses to check
sandbox?

-erik 

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] determining which object is displayed at agivenpoint

2007-02-08 Thread Erik Bianchi
Depths cant be identical in the same timeline so what you'll have to do is
check the depth of the _parent clip in case of equal depth

-erik

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Vishal Kapur
Sent: Wednesday, February 07, 2007 11:05 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] determining which object is displayed at
agivenpoint

It looks like you spent some time on this response, I really
appreciate that.  As I mentioned in my first mail, depth, _visible and
_alpha are the properties I'm checking right now to resolve conflicts.
 So my code looks very similar to your code below.  This works
sometimes, but I've run into cases where there are 2 movieclips for
which hitTest() is true, _visible is true, _alpha is 100, and the
depths are identical.  One of the movieclips is obscured behind the
other; there must be some way to distinguish them.  Are there any
other properties on movieclips (maybe hidden ones) that might be of
use?  The Flash runtime must be doing this internally for onRollOver
event firing; anyone know how this works?

Thanks,
Vishal



On 2/7/07, Karina Steffens [EMAIL PROTECTED] wrote:
 Ok, I see your problem, so lets think what else you can do with the
hitTest
 approach...
 First of all, you can set the shape flag to true, so that the hit test
will
 only return true if there's something there (as opposed to the entire
 bounding rect).
 Then you can test for _alpha (you might want to test for _visible also),
 thus eliminating invisible buttons, such as your big rectangle that
obscures
 the rest.

 Finally, checking for different depths - I recently discovered that if you
 loop through a clip, it starts at the highest depth, even on the same
layer:
 for (var i in _root) {
 trace(i +   +_root[i].getDepth());
 }

 $version
 clip3 -16379
 clip2 -16381
 clip1 -16383

 So now you know which one has the highest depth: clip3, which also comes
 first in the loop.
 At this point, you can break the loop. If you need to go deeper, you can
 then recurse within that clip, and see if it has any child mcs, which one
of
 those scores the highest hitTest and if that one has any children - etc.

 Here's some quickdirty code:

 for (var i in _root) {
 trace(i +   +_root[i].getDepth());
 }

 _root.onEnterFrame = function() {
 for (var i in this) {
 var clip = this[i];
 if (!(clip instanceof MovieClip)) {
 continue;
 }
 if (clip._alpha == 0 || clip._visible == 0) {
 continue;
 }
 if (clip.hitTest(_root._xmouse, _root._ymouse, true)) {
 trace(clip);
 break;
 }
 }
 };

 On the timeline, I placed three circular clips overlapping eachother, so
 that clip1 is at the lowest depth and clip3 at the highest. I made clip3
 invisible by setting it's alpha to 0.

 After moving my mouse over the clips, starting from the third, the trace
 result was:

 $version
 clip3 -16379
 clip2 -16381
 clip1 -16383
 _level0.clip2
 _level0.clip2
 _level0.clip2
 _level0.clip2
 _level0.clip2
 _level0.clip2
 _level0.clip2
 _level0.clip1
 _level0.clip1
 _level0.clip1

 Each time the trace picked out the highest visible part of a clip, thus
 resolving any conflicts.

 Hope this helps to point you in the right direction.
 Karina


  -Original Message-
  From: Vishal Kapur [mailto:[EMAIL PROTECTED]
  Sent: 07 February 2007 20:29
  To: Flashcoders mailing list
  Subject: Re: [Flashcoders] determining which object is
  displayed at agivenpoint
 
  To respond to the recent activity on this thread:
  Erik, the core functionality that I need really does need to
  be comprehensive and fairly generic: so, given any 3rd party
  swf which I don't have a priori knowledge of, determine which
  object is currently underneath the mouse.  It needs to work
  for any movieclip or TextField object.  It's proprietary so I
  can't really disclose why I need it.
  You mention that implementing this would be process
  intensive: this is ok to start.  The way I would like to
  tackle this problem is to get it working functionally, and
  worry about performance later.
 
  Karina, Jason, the approaches you are suggesting of looping
  through all the movieclips and calling hitTest() on each one
  is exactly what my first approach was (see my first email in
  this thread).  The problem is that very often multiple
  movieclips will return hitTest()==true for a given mouse
  position (clips at different depths, clips obscuring others,
  etc).  That's what I meant by 2 conflicting objects in my
  first mail.  I'm trying to find an algorithm to resolve conflicts.
 
  There is another approach which Erik mentioned, which is to
  define/override the onRollOver callback for every object that
  I care about, and set some variable that keeps track of the
  last object that 

RE: [Flashcoders] determining which object is displayed at agivenpoint

2007-02-08 Thread Erik Bianchi
If performance isn't an issue, you can use getDepth to figure out the top
most mc / textfield and then just act on it (place into a zorder array and
use depth for index). However, that is a more process intensive way of
emulating onRollOver. For textfield's you are correct. You can't catch
onRollOver unless it is wrapped by a movieclip; is that out of the question?



-erik

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Vishal Kapur
Sent: Wednesday, February 07, 2007 12:29 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] determining which object is displayed at
agivenpoint

To respond to the recent activity on this thread:
Erik, the core functionality that I need really does need to be
comprehensive and fairly generic: so, given any 3rd party swf which I
don't have a priori knowledge of, determine which object is currently
underneath the mouse.  It needs to work for any movieclip or TextField
object.  It's proprietary so I can't really disclose why I need it.
You mention that implementing this would be process intensive: this is
ok to start.  The way I would like to tackle this problem is to get it
working functionally, and worry about performance later.

Karina, Jason, the approaches you are suggesting of looping through
all the movieclips and calling hitTest() on each one is exactly what
my first approach was (see my first email in this thread).  The
problem is that very often multiple movieclips will return
hitTest()==true for a given mouse position (clips at different depths,
clips obscuring others, etc).  That's what I meant by 2 conflicting
objects in my first mail.  I'm trying to find an algorithm to resolve
conflicts.

There is another approach which Erik mentioned, which is to
define/override the onRollOver callback for every object that I care
about, and set some variable that keeps track of the last object that
invoked onRollOver.  I have tried this before, and I ditched it
because I couldn't find a way to get TextField objects to invoke an
onRollOver callback (or to otherwise respond to a 'roll over' event).
Any ideas on this?

Thanks,
Vishal



On 2/7/07, Jason Boyd [EMAIL PROTECTED] wrote:
 I've been following this thread and am just curious -- everyone seems to
be
 assuming that looping through all clips and doing hitTest() is
inefficient,
 but presumably this is exactly what the Flash player is doing with every
 mouse move. Is there some good reason to assume the Flash player is doing
 this internally much more efficiently than the function exposed through AS
 as hitTest()? Without a priori knowledge, I'd recommend trying this, and
if
 it doesnt turn out to noticeably slow anything, you're done.



 On 2/7/07, Karina Steffens [EMAIL PROTECTED] wrote:
 
  Hi Vishal,
 
  I apologise ahead if I'm being dense here, but nobody seems to have
  mentioned the obvious solution:
  Looping through the mcs in your third party flash movie and checking for
  hit-test with the mouse position.
 
  var hit_array:Array = [];
  for (var i:String in target_mc){
var mc:MovieClip = target_mc[i];
if (!mc instanceof MovieClip){
//not a movie clip - ignore
  continue;
}
//Check for hit test
if (target_mc[i].hitTest(_root._xmouse, _root._ymouse, true)
  hit_array.push(target_mc);
}
  }
 
  At the end of it you have an array of all the movie clips that scored
a
  hit test.
 
  This code is just off the top of my head, an thoroughly untested. Also
  Depending on the structure of your flash movie, you will probably want
to
  delve deeper and test for a hit within each movie clip that you
encounter.
  It's also not very efficient, especially if you have to do recursion, so
I
  wouldn't recommend doing it too often. (don't use onMouseMove but rather
  an
  enterFrame event, an interval or some kind of once-off event - depending
  on
  your application).
 
  Alternatively, if you already know which objects should be tested, you
can
  do this more efficiently by hard-coding them manually into an array and
  looping within the array to check for a hit test. Not pretty, but should
  work.
 
  And finally, something that occurred to me while writing this post, you
  could try temporarily switching off the _visible property of the
  overlapping
  clip just before checking for _droptarget - and then switching it on
  again.
  This might be the least processor-intensive way of doing this.
 
  Cheers,
  Karina
 
 
 
 
 
   -Original Message-
   From: Vishal Kapur [mailto:[EMAIL PROTECTED]
   Sent: 07 February 2007 01:26
   To: Flashcoders mailing list
   Subject: Re: [Flashcoders] determining which object is
   displayed at agivenpoint
  
   Ok, got it.  Thanks for the suggestion.  I tried this but it
   doesn't work with the third-party flash movie I am looking
   at.  They have an movie clip with _alpha set to 0 that covers
   the stage at a depth higher than all other visible elements.
   As a result _droptarget is always set to 

RE: [Flashcoders] determining which object is displayed at agivenpoint

2007-02-08 Thread Erik Bianchi
For every mousemove or enterframe (however, you decide to check hittest) you
have to loop through and hittest every movieclip you want to check.

So say for example we are talking about just 10 movieclips checking using
enterframe at 30 frames per-second (assumming Flash Player is actually
running at 30fps) you're technically looping through 300 movieclips
persecond and running 300 hitTest persecond. That's a lot of processing for
just 10 movieclips. Which is why I suggest using some other method.

If you setup a test calculating FPS you'll see that hitTest / looping will
tax the processor much more then setting an onRollOver.

-erik

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jason Boyd
Sent: Wednesday, February 07, 2007 11:43 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] determining which object is displayed at
agivenpoint

I've been following this thread and am just curious -- everyone seems to be
assuming that looping through all clips and doing hitTest() is inefficient,
but presumably this is exactly what the Flash player is doing with every
mouse move. Is there some good reason to assume the Flash player is doing
this internally much more efficiently than the function exposed through AS
as hitTest()? Without a priori knowledge, I'd recommend trying this, and if
it doesnt turn out to noticeably slow anything, you're done.



On 2/7/07, Karina Steffens [EMAIL PROTECTED] wrote:

 Hi Vishal,

 I apologise ahead if I'm being dense here, but nobody seems to have
 mentioned the obvious solution:
 Looping through the mcs in your third party flash movie and checking for
 hit-test with the mouse position.

 var hit_array:Array = [];
 for (var i:String in target_mc){
   var mc:MovieClip = target_mc[i];
   if (!mc instanceof MovieClip){
   //not a movie clip - ignore
 continue;
   }
   //Check for hit test
   if (target_mc[i].hitTest(_root._xmouse, _root._ymouse, true)
 hit_array.push(target_mc);
   }
 }

 At the end of it you have an array of all the movie clips that scored a
 hit test.

 This code is just off the top of my head, an thoroughly untested. Also
 Depending on the structure of your flash movie, you will probably want to
 delve deeper and test for a hit within each movie clip that you encounter.
 It's also not very efficient, especially if you have to do recursion, so I
 wouldn't recommend doing it too often. (don't use onMouseMove but rather
 an
 enterFrame event, an interval or some kind of once-off event - depending
 on
 your application).

 Alternatively, if you already know which objects should be tested, you can
 do this more efficiently by hard-coding them manually into an array and
 looping within the array to check for a hit test. Not pretty, but should
 work.

 And finally, something that occurred to me while writing this post, you
 could try temporarily switching off the _visible property of the
 overlapping
 clip just before checking for _droptarget - and then switching it on
 again.
 This might be the least processor-intensive way of doing this.

 Cheers,
 Karina





  -Original Message-
  From: Vishal Kapur [mailto:[EMAIL PROTECTED]
  Sent: 07 February 2007 01:26
  To: Flashcoders mailing list
  Subject: Re: [Flashcoders] determining which object is
  displayed at agivenpoint
 
  Ok, got it.  Thanks for the suggestion.  I tried this but it
  doesn't work with the third-party flash movie I am looking
  at.  They have an movie clip with _alpha set to 0 that covers
  the stage at a depth higher than all other visible elements.
  As a result _droptarget is always set to that object.  What I
  need is something that takes into account visibility.
 
  Any other thoughts on this?
 
  -- Vishal
 
 
  On 2/6/07, Mike Mountain [EMAIL PROTECTED] wrote:
What he's saying is that _droptarget will tell you exactly
  what is at
   the top under the users mouse - but in order to use it you
  have to use
   startDrag to fool it in to working. Maybe you could drag an
  invisible
   clip around or something.
  
   M
  
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Vishal Kapur
Sent: 06 February 2007 16:03
To: Flashcoders mailing list
Subject: Re: [Flashcoders] determining which object is
  displayed at
a givenpoint
   
I don't understand what you're suggesting.  The user is
  not dragging
the movieclip.
   
The idea is to write a function with a signature like:
function getObjectAtPoint(xmouse:Number, ymouse:Number):Object
  
  
   ECM Systems Ltd, Ellifoot Park, Burstwick, East Yorkshire HU12 9DZ
   Tel: 01964 672000
   Fax: 01964 671102
   Registered in England no. 01646471
   The information contained within this email expresses the
  views of the sender and not necessarily those of the company.
  It is private and confidential and may be legally privileged.
  It is intended solely for those authorised to receive it. If
  you are 

RE: [Flashcoders] determining which object is displayed at agivenpoint

2007-02-06 Thread Erik Bianchi
I'm not sure how your app is structured but if you can't put your movieclips
above this 3rd party movieclip you wont be able to use _droptarget (as
you've already discovered) unless you can set that interfering movieclips
visibility to false.

I'm not sure how / why you want to check what mc the mouse is over, but you
could also just manually set movieclips to set an over variable onRollOver
/ onRollOut or onPress.

The reason why I'm suggesting one of these methods is that all other options
will be much more complex, processor intensive and time consuming.
Unfortunately there is no getMovieClipAt(x,y) method.

Your best bet is to think about what core functionality you really need and
go with the cheapest solution. So if your goal isn't as broad as knowing
EVERY movieclips position / depth maybe you can put a few invisible
movieclips over the 3rd party clip that represents the position of the mcs
you really care about.

-erik



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Vishal Kapur
Sent: Tuesday, February 06, 2007 5:26 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] determining which object is displayed at
agivenpoint

Ok, got it.  Thanks for the suggestion.  I tried this but it doesn't
work with the third-party flash movie I am looking at.  They have an
movie clip with _alpha set to 0 that covers the stage at a depth
higher than all other visible elements.  As a result _droptarget is
always set to that object.  What I need is something that takes into
account visibility.

Any other thoughts on this?

-- Vishal


On 2/6/07, Mike Mountain [EMAIL PROTECTED] wrote:
  What he's saying is that _droptarget will tell you exactly what is at
 the top under the users mouse - but in order to use it you have to use
 startDrag to fool it in to working. Maybe you could drag an invisible
 clip around or something.

 M

  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf
  Of Vishal Kapur
  Sent: 06 February 2007 16:03
  To: Flashcoders mailing list
  Subject: Re: [Flashcoders] determining which object is
  displayed at a givenpoint
 
  I don't understand what you're suggesting.  The user is not
  dragging the movieclip.
 
  The idea is to write a function with a signature like:
  function getObjectAtPoint(xmouse:Number, ymouse:Number):Object


 ECM Systems Ltd, Ellifoot Park, Burstwick, East Yorkshire HU12 9DZ
 Tel: 01964 672000
 Fax: 01964 671102
 Registered in England no. 01646471
 The information contained within this email expresses the views of the
sender and not necessarily those of the company. It is private and
confidential and may be legally privileged. It is intended solely for those
authorised to receive it. If you are not the intended recipient you are
hereby notified that any disclosure, copying, distribution or action taken
in reliance on its contents is strictly prohibited and may be unlawful. If
you have received this email in error, please telephone us immediately on
01964 672000 or email a reply to highlight the error and then delete it from
your system. This email may contain links to web-sites, the contents of
which ECM Systems Ltd have no control over and can accept no responsibility
for. Any attachments have been virus-checked before transmission; however,
recipients are strongly advised to carry out their own virus checking as ECM
Systems Ltd do not warrant that such attachments are virus-free. Please note
that this email has been created in the knowledge that Internet email is not
a secure communications medium. We advise that you understand and observe
this lack of security when emailing us.

 ECM Systems Ltd, Ellifoot Park, Burstwick, East Yorkshire HU12 9DZ

 Tel: 01964 672000
 Fax: 01964 671102

 Registered in England no. 01646471

 The information contained within this email expresses the views of the
sender and not necessarily those of the company.
 It is private and confidential and may be legally privileged. It is
intended solely for those authorised to receive it. If you are
 not the intended recipient you are hereby notified that any disclosure,
copying, distribution or action taken in reliance on its
 contents is strictly prohibited and may be unlawful. If you have received
this email in error, please telephone us immediately
 on 01964 672000 or email a reply to highlight the error and then delete it
from your system. This email may contain links to
 web-sites, the contents of which ECM Systems Ltd have no control over and
can accept no responsibility for. Any
 attachments have been virus-checked before transmission; however,
recipients are strongly advised to carry out their own
 virus checking as ECM Systems Ltd do not warrant that such attachments are
virus-free.
 Please note that this email has been created in the knowledge that
Internet email is not a secure communications medium.
 We advise that you understand and observe this lack of security when
emailing us.



 

RE: [Flashcoders] determining which object is displayed at a given point

2007-02-05 Thread Erik Bianchi
Been a while but I believe the solution you need is startDrag with
_droptarget.

Note you must use startDrag otherwise _droptarget isn't set.

-erik

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Vishal Kapur
Sent: Monday, February 05, 2007 4:52 PM
To: Flashcoders mailing list
Subject: [Flashcoders] determining which object is displayed at a given
point

I am trying to solve the following problem: given the coordinates of a
point in a flash movie, determine the targetPath of the object that is
currently displayed at that point.  In simple cases I have been able
to do this by looping through a list of possible target objects and
calling hitTest() on each one.

However, issues arise when there are multiple objects for which
hitTest() returns true.  This can happen with hidden objects, or more
often, objects sitting on layers that aren't currently visible.
Sometimes I can compare the depth of 2 conflicting objects, and I
assume whichever one has a larger depth is rendered in front of the
other.  This doesn't always work, however.  I am debugging a case
where there are two objects that return hitTest()=true, have identical
depths, have identical bounding boxes, and both have _visible set to
true.  Only one of them is actually visible to the user at any given
time, however.  What other properties of a movieclip can be checked to
determine if it's really the one that the user can currently see?  Or
is there a better way to do this, rather than using hitTest()?

Let me know if I can clarify.

Thanks,
Vishal
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Flair Pattern bad mixins good (?)

2007-01-30 Thread Erik Bianchi
Just to clarify mixins and strategy are a bit different. One is more
structural while the other is more behavioral.

Also mixins aren't really considered a design pattern but it is made up of
composites, proxies / facades (all structural design patterns ) +
interfaces. They are used to emulate multiple inheritance. So something
could have functionality of say a MovieClip and a Sound Object.

The strategy design pattern is used to encapsulate interchangeable logic
(layout, validation, etc).

However, I think what you're really asking is more of an architectural
question so I would take a look at ARP and Cairngorm.

Cairngorm is labeled for Flex but can be easily adapted to Flash
development. Similarly ARP is thought of as being used for slides but can be
adapted to using MovieClips.

Just a note, Cairngorm is less prescriptive about how to structure your
views (which may or may not be a good thing depending on your disposition)
so if you're already pretty far a long in your development check out
Cairngorm

Cairngorm:
http://labs.adobe.com/wiki/index.php/Cairngorm

ARP:
http://www.osflash.org/ARP


If you want want something a bit more fine grained you can do a search on
MVP (Model View Presenter) or MVC (Model View Controller). Both are similar
but have different rules of communication and responsibilities.

-erik

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Ham
Sent: Monday, January 29, 2007 11:40 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

OK, this is helping a lot. And Steven I see what you mean, poor Flair  
is starting to look a little meager now.

In my app, I  have several different states. Each state sets itself  
up by initializing variables and drawing its various pieces, and the  
final piece is to subscribe various parts of the app to events that  
happen in other parts. So in one state I have methods like:

onRoomObjectPress()
onRoomObjectRelease()

that are triggered by onPress and onRelease events in my object  
movieclips. These onSomething() methods contain the core logic of the  
app--code to resize clips or process values or what have you. This  
structure is good because I know where to look to track down where  
things happen, but its bad because sometimes a bunch of things are  
supposed to happen at once and those onSomething() methods get hairy.

So in this new mixin strategy (which does look a lot like Strategy,  
thanks James!), should I design my Snappable class to have methods  
that would map to movieclip events, such as:

startObjectDrag triggered by obj_mc.onPress
checkForSnaptriggered bysetInterval or onEnterFrame type of event,  
in this case onObjectDrag
stopObjectDrag  triggered byobj_mc.onRelease

Am I headed in the right direction?

Thank you again, this

OK
DAH

 The theory of mixins originated from multiple inheritance programming
 languages such as C++.

 So for example: Say you wanted to make an object dragable,  
 clickable and
 resizable. You would then create separate classes called: Dragable,
 Clickable and Resizable (common naming convention for a mixin).

 Then your base class would just inherit form those 3 classes.

 Since AS2 doesn't support multiple inheritances you can emulate a  
 mixin
 using interfaces and composed classes.

 For example:

 IClickable, IDragable, IResizable

 So then your AS2 class would say:

 Class MyClass extends Whatever implements IClickable, IDragable,  
 IResizable

 Those interfaces just specify what methods your class has to support.

 From there you could have a class (or a consolidated class)  
 implement that
 functionality

 private var clickable:Clickable = new Clickable();
 private var dragable:Dragable = new Dragable();
 private var resizeable:Resizeable = new Resizeable();

 from there you just forward / wire the appropriate methods to its
 corresponding instances.

 public function startResize()
 {
   this.resizeable.startResize();
 }

 Or for arguments:

 public function startResize()
 {
   this.resizeable.apply.(this.resizeable.startResize, arguments);
 }

 You could get even more fancy by externalizing those classes so  
 based on
 various rules you could pass in different resize logic, etc.

 Anyhow, hope that gets the gears turning. =)

 DISCLAIMER: Didn't spell check or test anything in the compiler so  
 maybe
 some typos. =)

 -erik


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of  
 David Ham
 Sent: Monday, January 29, 2007 7:12 PM
 To: Flashcoders mailing list
 Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

 Anyhow I tend not to use decorators (matter of personal taste). I
 prefer to
 not Frankenstein an object at runtime and rather use mixins
 (composition +
 interfaces).

 Ah, thank you, now we are getting somewhere!

 Tell me about mixins. I have used EventDispatcher before, but I am
 unfamiliar with the theory behind 

RE: [Flashcoders] Flair Pattern bad mixins good (?)

2007-01-30 Thread Erik Bianchi
Actually my definition of a mixin is very strict compared to a decorator; it
uses design by contract, composition and declares type:

Class ClassA implements IClassB, IClassC
{

private var classB:ClassB;
private var classC:ClassC;

private function classBMethod():Boolean{...};

private function classCMethod():Number{...};

}


-erik


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of T. Michael
Keesey
Sent: Tuesday, January 30, 2007 12:09 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

On 1/29/07, David Ham [EMAIL PROTECTED] wrote:

 startObjectDrag triggered by obj_mc.onPress
 checkForSnaptriggered bysetInterval or onEnterFrame type of event,
 in this case onObjectDrag
 stopObjectDrag  triggered byobj_mc.onRelease

This looks more like the Broadcaster pattern or the Event Dispatcher
(a.k.a. Observer) pattern than Decorator.

(Also, it might be better to tie checkForSnap to mouseMove.)

Personally, I'm not a big fan of mix-ins because, well, they're kind
of sloppy. They involve tinkering with stuff that should be off-limits
(and is in AS3, I think). Using mix-ins, you could accidentally use a
non-function as a function. That can't happen if you stick to
strictly-typed programming.
-- 
T. Michael Keesey
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Flair Pattern bad mixins good (?)

2007-01-30 Thread Erik Bianchi
A decorator is meant to be dynamic. It adds responsibilities to an object at
run time.

You take ComponentA and add methods to it on mouseclick, that's a decorator.

ComponentB is made up of ComponentC and ClassA, that's a composite.

My implementation of a mixin which I borrowed from java is really just using
composites + interfaces to emulate multiple inheritance.

Decorators and composites are similar however in that they are both
structural patterns and define an interface for communicating between parent
and child components / classes.

Best,

-erik







-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of T. Michael
Keesey
Sent: Tuesday, January 30, 2007 9:00 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

How is this any different from a Decorator/Wrapper? Looks like a
double decorator.

On 1/30/07, Erik Bianchi [EMAIL PROTECTED] wrote:
 Actually my definition of a mixin is very strict compared to a decorator;
it
 uses design by contract, composition and declares type:

 Class ClassA implements IClassB, IClassC
 {

 private var classB:ClassB;
 private var classC:ClassC;

 private function classBMethod():Boolean{...};

 private function classCMethod():Number{...};

 }


 -erik


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of T. Michael
 Keesey
 Sent: Tuesday, January 30, 2007 12:09 AM
 To: Flashcoders mailing list
 Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

 On 1/29/07, David Ham [EMAIL PROTECTED] wrote:
 
  startObjectDrag triggered by obj_mc.onPress
  checkForSnaptriggered bysetInterval or onEnterFrame type of
event,
  in this case onObjectDrag
  stopObjectDrag  triggered byobj_mc.onRelease

 This looks more like the Broadcaster pattern or the Event Dispatcher
 (a.k.a. Observer) pattern than Decorator.

 (Also, it might be better to tie checkForSnap to mouseMove.)

 Personally, I'm not a big fan of mix-ins because, well, they're kind
 of sloppy. They involve tinkering with stuff that should be off-limits
 (and is in AS3, I think). Using mix-ins, you could accidentally use a
 non-function as a function. That can't happen if you stick to
 strictly-typed programming.
 --
 T. Michael Keesey
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com


 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com



-- 
T. Michael Keesey
Director of Technology
Exopolis, Inc.
2894 Rowena Avenue Ste. B
Los Angeles, California 90039
--
The Dinosauricon: http://dino.lm.com
Parry  Carney: http://parryandcarney.com
ISPN Forum: http://www.phylonames.org/forum/
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Flair Pattern bad mixins good (?)

2007-01-30 Thread Erik Bianchi
Opps meant to add: that's my interpretation anyways. I could be wrong. I'm
wrong all the time. In fact I consider myself a professional mistake maker.

-erik

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Erik Bianchi
Sent: Tuesday, January 30, 2007 1:49 PM
To: 'Flashcoders mailing list'
Subject: RE: [Flashcoders] Flair Pattern bad mixins good (?)

A decorator is meant to be dynamic. It adds responsibilities to an object at
run time.

You take ComponentA and add methods to it on mouseclick, that's a decorator.

ComponentB is made up of ComponentC and ClassA, that's a composite.

My implementation of a mixin which I borrowed from java is really just using
composites + interfaces to emulate multiple inheritance.

Decorators and composites are similar however in that they are both
structural patterns and define an interface for communicating between parent
and child components / classes.

Best,

-erik







-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of T. Michael
Keesey
Sent: Tuesday, January 30, 2007 9:00 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

How is this any different from a Decorator/Wrapper? Looks like a
double decorator.

On 1/30/07, Erik Bianchi [EMAIL PROTECTED] wrote:
 Actually my definition of a mixin is very strict compared to a decorator;
it
 uses design by contract, composition and declares type:

 Class ClassA implements IClassB, IClassC
 {

 private var classB:ClassB;
 private var classC:ClassC;

 private function classBMethod():Boolean{...};

 private function classCMethod():Number{...};

 }


 -erik


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of T. Michael
 Keesey
 Sent: Tuesday, January 30, 2007 12:09 AM
 To: Flashcoders mailing list
 Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

 On 1/29/07, David Ham [EMAIL PROTECTED] wrote:
 
  startObjectDrag triggered by obj_mc.onPress
  checkForSnaptriggered bysetInterval or onEnterFrame type of
event,
  in this case onObjectDrag
  stopObjectDrag  triggered byobj_mc.onRelease

 This looks more like the Broadcaster pattern or the Event Dispatcher
 (a.k.a. Observer) pattern than Decorator.

 (Also, it might be better to tie checkForSnap to mouseMove.)

 Personally, I'm not a big fan of mix-ins because, well, they're kind
 of sloppy. They involve tinkering with stuff that should be off-limits
 (and is in AS3, I think). Using mix-ins, you could accidentally use a
 non-function as a function. That can't happen if you stick to
 strictly-typed programming.
 --
 T. Michael Keesey
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com


 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com



-- 
T. Michael Keesey
Director of Technology
Exopolis, Inc.
2894 Rowena Avenue Ste. B
Los Angeles, California 90039
--
The Dinosauricon: http://dino.lm.com
Parry  Carney: http://parryandcarney.com
ISPN Forum: http://www.phylonames.org/forum/
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Flair Pattern bad mixins good (?)

2007-01-30 Thread Erik Bianchi
I've seen examples of it both ways where a decorated object maintains the
objects interface or it adds additional methods so it breaks polymorphism.

Don't have the GOF book with me to reference so no idea what they actually
outlined. Doing a quick search wikipedia states 1 to 1 where doFactory shows
otherwise.

On a side note I love doFactory as they offer simple UML diagrams and sample
code (both conceptual and real world).

Been a while since I've posted here, a few years I think. I miss the geek
tangents / debates. =)

-erik



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of JOR
Sent: Tuesday, January 30, 2007 3:55 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

A decorator object composites the object it wishes to decorate and is 
used in it's place.  Since the decorator inherits from the the same base 
class as the object it decorates they can both be used interchangeably 
through polymorphism.

consider something like this:

var myBagel:Bagel = new Bagel();
trace (myBagel.getCalories()); // 200

// Add creamcheese to my bagel
myBagel = new CreamCheeseDecorator(myBagel);
trace (myBagel.getCalories()); // 300

// Add lox to my bagel
myBagel = new LoxDecorator(myBagel);
trace (myBagel.getCalories()); // 330

//---
// bagel looks something like this
public class Bagel {
   public function getCalories ():uint {
 return 200;
   }
}
//inside the decorator is something like this:
public class CreamCheeseDecorator extends Bagel {
   private var _bagel:Bagel;
   public function CreamCheeseDecorator (bagel:Bagel) {
 _bagel = bagel;
   }
   public function getCalories ():uint {
 return _bagel.getCalories() + 100;
   }
}
//inside the decorator is something like this:
public class LoxDecorator extends Bagel {
   private var _bagel:Bagel;
   public function LoxDecorator (bagel:Bagel) {
 _bagel = bagel;
   }
   public function getCalories ():uint {
 return _bagel.getCalories() + 30;
   }
}

You can add more Bagel types like EggBagel and EverythingBagel and more 
Decorator objects like Butter and use them all interchangeably.

note, this untested code, I just typed it out in the post so their might 
be typos.


James O'Reilly  -  Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design . Code . Train



Erik Bianchi wrote:
 Opps meant to add: that's my interpretation anyways. I could be wrong. I'm
 wrong all the time. In fact I consider myself a professional mistake
maker.
 
 -erik
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Erik
Bianchi
 Sent: Tuesday, January 30, 2007 1:49 PM
 To: 'Flashcoders mailing list'
 Subject: RE: [Flashcoders] Flair Pattern bad mixins good (?)
 
 A decorator is meant to be dynamic. It adds responsibilities to an object
at
 run time.
 
 You take ComponentA and add methods to it on mouseclick, that's a
decorator.
 
 ComponentB is made up of ComponentC and ClassA, that's a composite.
 
 My implementation of a mixin which I borrowed from java is really just
using
 composites + interfaces to emulate multiple inheritance.
 
 Decorators and composites are similar however in that they are both
 structural patterns and define an interface for communicating between
parent
 and child components / classes.
 
 Best,
 
 -erik
 
 
 
 
 
 
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of T. Michael
 Keesey
 Sent: Tuesday, January 30, 2007 9:00 AM
 To: Flashcoders mailing list
 Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)
 
 How is this any different from a Decorator/Wrapper? Looks like a
 double decorator.
 
 On 1/30/07, Erik Bianchi [EMAIL PROTECTED] wrote:
 
Actually my definition of a mixin is very strict compared to a decorator;
 
 it
 
uses design by contract, composition and declares type:

Class ClassA implements IClassB, IClassC
{

private var classB:ClassB;
private var classC:ClassC;

private function classBMethod():Boolean{...};

private function classCMethod():Number{...};

}


-erik


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of T. Michael
Keesey
Sent: Tuesday, January 30, 2007 12:09 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

On 1/29/07, David Ham [EMAIL PROTECTED] wrote:

startObjectDrag triggered by obj_mc.onPress
checkForSnaptriggered bysetInterval or onEnterFrame type of
 
 event,
 
in this case onObjectDrag
stopObjectDrag  triggered byobj_mc.onRelease

This looks more like the Broadcaster pattern or the Event Dispatcher
(a.k.a. Observer) pattern than Decorator.

(Also, it might be better to tie checkForSnap to mouseMove.)

Personally, I'm not a big fan of mix-ins because, well, they're kind
of sloppy. They involve tinkering with stuff that should be off-limits
(and is in AS3, I think). Using mix-ins, you could accidentally use a
non

RE: [Flashcoders] Flair Pattern bad mixins good (?)

2007-01-30 Thread Erik Bianchi
I think GoF is a great reference book but the writers aren't very gentle
about how they present information. It is very blunt and straight to the
point. Reminds me a bit of an old calculus book.

The first time I read the GoF book I thought my head was going to explode. A
few years later though when I'm referencing a pattern it's a lot more clear
now for some reason.

Also, It be nice if they revised using java or C# rather then C++.

-erik

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Ham
Sent: Tuesday, January 30, 2007 7:02 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

 Been a while since I've posted here, a few years I think. I miss  
 the geek
 tangents / debates. =)

Good man! Seriously, the world affords precious few opportunities to  
truly geek out on design patterns and such. Internet mailing lists  
excepted of course.

I have the Head First Design Patterns book, and I have to say I like  
it, in spite of its profusion of clip art and cheesy humor. Despite  
these stylistic affronts, it presents the material in a way that is  
easy to learn.

What's the consensus on the GoF book? I know it's a classic, but so  
is Ulysses and dog if I can read that. I don't have a CS background-- 
Flash is about as far as my programming expertise extends--so the  
Head First style works for me. Is GoF accessible for people who don't  
program in C++?

OK
DAH
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Flair Pattern?

2007-01-29 Thread Erik Bianchi
Respectfully, Isn't that like saying a singleton is just a class that
manages a factory? =)

A design pattern is a repeatable solution to a commonly occurring problem in
software development. So if all a Flair does is manage decorators and 2
people know that's what it does, then that sounds like a design pattern to
me (unless there's a ECMA committee for that now a days). =)

Anyhow I tend not to use decorators (matter of personal taste). I prefer to
not Frankenstein an object at runtime and rather use mixins (composition +
interfaces).


-erik

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks
| BLITZ
Sent: Monday, January 29, 2007 11:35 AM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Flair Pattern?

So I was dead on about the Office Space reference.  :)

The class manages assigning Decorators.  It isn't a design pattern.
It's a class that manages the Decorator design pattern on multiple
objects.

I'm not sure where the idea that the Decorator pattern must be used on
all or none of the objects in an application, or that Decorated objects
cannot be undecorated.

There are no references to the Flair design pattern anywhere else
because it doesn't exist anywhere except in the ego of Brendan Hall.
It's not a design pattern, it's a class that uses another design
pattern, and poorly, too, judging by the code example.

If you want to learn more about Design Patterns, there are quite a few
great books out there on the subject written by people more learned and
experienced than Brendan Hall.  Like people with PhD's in Computer
Science.  From the de facto bible Design Patterns by the Gang of Four to
many others.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Flair Pattern bad mixins good (?)

2007-01-29 Thread Erik Bianchi
The theory of mixins originated from multiple inheritance programming
languages such as C++.

So for example: Say you wanted to make an object dragable, clickable and
resizable. You would then create separate classes called: Dragable,
Clickable and Resizable (common naming convention for a mixin).

Then your base class would just inherit form those 3 classes.

Since AS2 doesn't support multiple inheritances you can emulate a mixin
using interfaces and composed classes.

For example:

IClickable, IDragable, IResizable

So then your AS2 class would say:

Class MyClass extends Whatever implements IClickable, IDragable, IResizable

Those interfaces just specify what methods your class has to support.

From there you could have a class (or a consolidated class) implement that
functionality

private var clickable:Clickable = new Clickable();
private var dragable:Dragable = new Dragable();
private var resizeable:Resizeable = new Resizeable();

from there you just forward / wire the appropriate methods to its
corresponding instances.

public function startResize()
{
this.resizeable.startResize();
}

Or for arguments:

public function startResize()
{
this.resizeable.apply.(this.resizeable.startResize, arguments);
}

You could get even more fancy by externalizing those classes so based on
various rules you could pass in different resize logic, etc.

Anyhow, hope that gets the gears turning. =)

DISCLAIMER: Didn't spell check or test anything in the compiler so maybe
some typos. =)

-erik


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Ham
Sent: Monday, January 29, 2007 7:12 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Flair Pattern bad mixins good (?)

 Anyhow I tend not to use decorators (matter of personal taste). I  
 prefer to
 not Frankenstein an object at runtime and rather use mixins  
 (composition +
 interfaces).

Ah, thank you, now we are getting somewhere!

Tell me about mixins. I have used EventDispatcher before, but I am  
unfamiliar with the theory behind mixins in general.

In my app, i have objects that can be dragged around in a Room, and  
they have a snapping behavior that lets them snap to the walls of  
the room, and in some cases, rotate themselves so that a given side  
of the object is always to the wall.

Currently, my snapping behavior is in a separate class like the one  
at the top of this thread. If the room object has snapping enabled,  
the  SnapFlair class adds an object with a bunch of methods and  
properties to it. The snapping methods are triggered by an event that  
is broadcast as the room object is being dragged.

How would I implement this as a mixin?

Many thanks fellas!

As for Steven, sounds like HE'S got a case of the Mondays! *smirk*

OK
DAH
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] Flash Size / Scaling on IE Windows Mobile

2006-09-12 Thread Erik Bianchi
Hey list,

 

I'm trying to port an app to IE running on Windows Mobile 5.0, but I'm
fighting with the IE renderer.

 

I can't seem to get something to open perfectly in the browser without any
scroll bars. I can size it just right so the vertical scroll bars aren't
visible, but anytime I try to size my swf where the scroll bar would
normally be displayed it automatically scales it down to fit inside the
window. In other words even if I make something 800 pixels wide, inside of
horizontal scroll bars being display, IE just smushes it.

 

Is there a way to disable or work around this?

 

Also, it's been a while since I've done mobile dev, but there use to be a
way to make Flash content open standalone or full screen using a 3rd party
tool, but I can't remember the name of it?

 

Thanks!

 

-erik

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Flash Size / Scaling on IE Windows Mobile

2006-09-12 Thread Erik Bianchi
Hey thanks for the info Harald.

I fiddled around with it some more and on the Verizon XV6700 I got it pretty
locked at 240w x 245h running in default mode with leftMargin and topMargin
set to 0. Nice and tight all the way around the bottom and top nav bars.

It seems that there is some play in the scroll bar logic so that if you go
below a certain point, the vertical scroll bar space will appear but not the
actual scroll bars (weird).

Thanks again!

-erik


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Harald
Kobler
Sent: Tuesday, September 12, 2006 3:13 PM
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Flash Size / Scaling on IE Windows Mobile

Hi Erik,

I recently built a small Pocket PC application for IE.  The only way I found
to eliminate both scroll bars is to set the View menu option in IE to One
Column otherwise I can't get rid of the horizontal scrollbar.  I also
experimented with various size parameters and scaling to determine the
optimal setting for my needs.  Here they are:

object width=235 height=243 id=SnappMX_FE ... 
param name=movie
value=SnappMX_FE.swf?snappServer=CFscreenId=6scaleX=160scaleY=160applic
ationWidth=290applicationHeight=301 /

I'm currently using a Dell Axim X51V for testing which supports VGA.
Interestingly this required me to set my scaleX / Y values to 160 to scale
the movie down to 80% of its original size.  If I open this application in a
desktop web browser it is actually scaled to 160% so I only see one corner
of the UI.

The applicationWidth of 290 and applicationHeight of 301 allowed me to
display the entire screen without the need for any scrolling.

One pitfall that I found was that i couldn't make use of full screen mode
since my application needs to access the virtual keyboard for data entry and
I haven't found any way to programmatically access it.

Sincerely,

Harald M. Kobler

CTO, Netcentrics Corporation
www.snappmx.com


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Erik Bianchi
Sent: Tuesday, September 12, 2006 2:35 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Flash Size / Scaling on IE Windows Mobile


Hey list,



I'm trying to port an app to IE running on Windows Mobile 5.0, but I'm
fighting with the IE renderer.



I can't seem to get something to open perfectly in the browser without any
scroll bars. I can size it just right so the vertical scroll bars aren't
visible, but anytime I try to size my swf where the scroll bar would
normally be displayed it automatically scales it down to fit inside the
window. In other words even if I make something 800 pixels wide, inside of
horizontal scroll bars being display, IE just smushes it.



Is there a way to disable or work around this?



Also, it's been a while since I've done mobile dev, but there use to be a
way to make Flash content open standalone or full screen using a 3rd party
tool, but I can't remember the name of it?



Thanks!



-erik

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.0.405 / Virus Database: 268.12.3/446 - Release Date: 9/12/2006

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.0.405 / Virus Database: 268.12.3/446 - Release Date: 9/12/2006

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com