RE: [Flashcoders] Wherefore the evils of _global?

2006-03-23 Thread David Stiller
Responding to two, here ...

>> ryanm wrote:
>>
>> Because global variables are contrary to the
>> basis of OOP, which is all about abstraction
>> and encapsulation. If you need to store
>> variables somewhere so that they can be
>> reached anywhere, use a singleton, or a static
>> class, or an application object, and so on.

Okay, I'm with you.  That jibes with my understanding of OOP in
a universal sense.  In ActionScript, however, classes *are* properties
of the _global object, which is what prompted my question.  Programmers
in general may agree to avoid global variables in principle, and what
I'm hearing is that ActionScript programmers, in a sense, pretend
_global isn't being used unless invoked explicitly.

Caveat:  By "pretend," I don't mean AS programmers are fibbers
... it's more like we agree to an anticipatory linguistic contrivance
while gearing up for AS3.  Right?  Same as we speak of strong typing in
AS2:  technically speaking, AS2 is not strongly typed.  Post-colon
syntax, at least currently, is a device for accommodating compile-time
error messages and code hinting.

> Tyler Wright wrote:
>
> _global is a perfect place to store application
> meta data [...] if you're building anything of
> significance (in size) you should have a class
> [...] This way every thing thrown the way of
> global vars is documented, type checked, and
> follows some sort of API.

That makes perfect sense.


David
[EMAIL PROTECTED]

___
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] Wherefore the evils of _global?

2006-03-23 Thread David Stiller
In the last few days, I've seen a handful of people refer
apologetically to use of the _global object.  To paraphrase:  "I'm in a
situation where I have to use _global variables," or, "We all know _global
is a no-no, but I'm tempted to use it in this one weird case," etc.  In
general, this gives me the impression that it's fashionable here to think of
_global as Evil -- or in the very least, yucky.

I understand why _root can be troublesome, especially in conjunction
with dynamically loaded SWFs, but I do use it in a pinch.  I mean, heck,
sometimes a movie is just a movie, not a portable app.

What I don't understand -- and I hasten to say I have no opinion on
the matter, yet -- is why _global is so shunned.  After all, _global is
exactly where AS2 classes are located.  Is this a religious issue?  Is it
because of how _global gets shared (or not?) among dynamically loaded SWFs?


David
[EMAIL PROTECTED]

___
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 width of rotatedMC'simaginaryboundingbox

2006-03-21 Thread David Stiller
> Odie Bracy PhD wrote:
> Actually, your width will change with the
> rotation. The greatest width will be when
> the diagonal line of your rectangle is a
> flat, horizontal line.

That seems to sum it up, for sure.  Thanks, Odie.

>> Yotam Laufer wrote:
>> First of all you're welcome. When using
>> the mathematical approace, are you feeding
>> the Math.sin (a) method radian or degrees?
>> It should be radians could that be your
>> problem?

I'm using radians.  I thought about that, too, and checked for
the possibility first thing.  The more I experiment, actually, the more
I see the light.  Thanks for all the input!


David
[EMAIL PROTECTED]

___
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 width of rotatedMC'simaginaryboundingbox

2006-03-20 Thread David Stiller
Danny,

>> My MC is a 150x30 rectangle rotated to 45 degrees.
>> My results show width and height both at 180, when
>> they should be closer to 130.  Here's my code:

> That's odd: when I go through those calculations
> with a calculator, they come out with about 130,
> just as you say [...].  Are you sure your mc._width
> and mc._height are returning the correct values?

Well, I checked, and am beginning to feel dumber and dumberer.
Somewhere, when I was dealing with this last night, my head must have been
clouded up.  If I take a 150x30 movie clip in the IDE and rotate it, the
width and height, as indicated in the Properties inspector, updates the way
your calculation and the getBounds approach dictate they should.

I was expecting mc._width to always return 150, even when it was
rotated.  After all, the clip's width, from its own POV, hasn't changed.  In
fact, I would swear this is what was happening last night -- but, sheesh,
maybe not?  If I simply trace mc's _width and _height from the main
timeline, the values returned by those properties give me the data I want.
This happens with dot notation as well as onClipEvent(load) {trace()}.

So ... I guess my whole question is moot.  But now I'm scratching my
head.


David
[EMAIL PROTECTED]

___
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 width of rotated MC's imaginaryboundingbox

2006-03-20 Thread David Stiller
Yotam,

> Correct usage of getBounds will give you
> the correct result. You have to point the
> coordinate scope of the getBounds method
> to the parent of the mc.

Wow!  Yes, thank you, Yotam.  Now I'm slapping my forehead, too.  It
doesn't get easier than that.

I'm still interested in the geometry approach, for non-ActionScript
applications, so if anyone can show me where I stepped wrong with Danny's
suggestion, I'd appreciate it.


David
[EMAIL PROTECTED]

___
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 width of rotated MC's imaginaryboundingbox

2006-03-20 Thread David Stiller
>> Adrian Park wrote:
>> if you could enclose the rotated clip in a wrapper
>> clip [...] you will have the width of imaginery
>> bounding box.

True, but in this scenario I'm writing a class that needs to
determine this with the user's MCs as they are.  Definitely the way I'd go,
though, if the MCs were under my control.  :)

> Danny Kodicek wrote:
> assuming your original clip is rectangular; or that
> you;re looking for the dimensions of *its* bounding
> box when rotated,

Bingo!

> then at an angle of A, the new width will be 
> Math.abs(w*cos(A))+Math.abs(h*sin(A)), the new height will be 
> Math.abs(w*sin(A))+Math.abs(h*cos(A)).
> Remember that if A is measured in degrees, you need
> to multiply it by pi/180 to convert to radians.

In my implementation, that gets *close*, but not quite there.  My MC
is a 150x30 rectangle rotated to 45 degrees.  My results show width and
height both at 180, when they should be closer to 130.  Here's my code:

var a:Number = mc._rotation * Math.PI / 180;
//
var w:Number = Math.abs(mc._width * Math.cos(a)) + Math.abs(mc._height *
Math.sin(a));
var h:Number = Math.abs(mc._width * Math.sin(a)) + Math.abs(mc._height *
Math.cos(a));
//
trace("width: " + w);
trace("height: " + h);


David
[EMAIL PROTECTED]

___
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] Determining width of rotated MC's imaginary bounding box

2006-03-20 Thread David Stiller
I suspect the answer to this one is purely geometry.  It's trivial
to determine the width or height of a movie clip:  there's the _width and
_height properties, of course, as well as getBounds().  But when the clip is
rotated, the concept of "width" changes.  I'm looking for a way to determine
the width of an imaginary bounding box that contains the rotated clip.

Tips, tutorials, guidance?


David
[EMAIL PROTECTED]

___
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] Marrying Function.apply() to WebService web methodcalls

2006-03-14 Thread David Stiller
Got it!  The solution is due entirely to Arjan van Ham, who recently
Googled a year-and-a-half old variant of my question on the flash-db.com
forum.  Thanks Arjan!

Now that I see it, the answer is slap-your-forehead obvious.  eval()
to the rescue.

// Replace this ...
var pc:PendingCall = ws[meth].apply(null, param);

// with this ...
var pc:PendingCall = eval("ws." + meth).apply(ws, param);


> At this point, I should be able to slap in Function.apply(),
> like so ...
>
> // THIRD TRY
> import mx.services.*;
> var wsdl:String = "http://www.webservicex.net/uszip.asmx?WSDL";;
> var meth:String = "GetInfoByZIP";
> var param:Array = ["90210"];
> var ws:WebService = new WebService(wsdl);
> var pc:PendingCall = ws[meth].apply(null, param);
> pc.onResult = function(evt) {
>   trace(evt.NewDataSet);
> };
>
> ... but it all falls apart.  If you turn on VERBOSE logging,
> everything rolls along as usual until it hangs on the final
> line ...

___
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] Marrying Function.apply() to WebService web method calls

2006-03-14 Thread David Stiller
I'd like to use Function.apply() on WebService instances' web
methods.  Should be pretty straightforward, right?  Turns out the answer is
no.  I figure the quickest way to illustrate my problem is to relate my
journey in a few blocks of code.

Here's a successful sample, using a freebie US ZIP code service.
Note:  Make sure to drag a WebServiceClasses compiled clip onto your Stage
from Windows > Common Libraries > Classes.


// FIRST TRY
import mx.services.*;
var wsdl:String = "http://www.webservicex.net/uszip.asmx?WSDL";;
var ws:WebService = new WebService(wsdl);
var pc:PendingCall = ws.GetInfoByZIP("90210");
pc.onResult = function(evt) {
  trace(evt.NewDataSet);
};

... which traces the following XML ...

Beverly
HillsCA90210310P

Easy.

Now, to transform it into a slightly more generic mechanism ...


// SECOND TRY
import mx.services.*;
var wsdl:String = "http://www.webservicex.net/uszip.asmx?WSDL";;
var meth:String = "GetInfoByZIP";
var param:String = "90210";
var ws:WebService = new WebService(wsdl);
var pc:PendingCall = ws[meth](param);
pc.onResult = function(evt) {
trace(evt.NewDataSet);
};

Still successful.  Now, Function.apply() takes an array of
arguments, which is the reason I want to use it.  To continue stepping in
that direction, I update the above param lines to ...

var param:Array = ["90210"];

... and ...

var pc:PendingCall = ws[meth](param[0]);

... and as expected, all goes well -- still.  At this point, I should be
able to slap in Function.apply(), like so ...

// THIRD TRY
import mx.services.*;
var wsdl:String = "http://www.webservicex.net/uszip.asmx?WSDL";;
var meth:String = "GetInfoByZIP";
var param:Array = ["90210"];
var ws:WebService = new WebService(wsdl);
var pc:PendingCall = ws[meth].apply(null, param);
pc.onResult = function(evt) {
trace(evt.NewDataSet);
};

... but it all falls apart.  If you turn on VERBOSE logging, everything
rolls along as usual until it hangs on the final line ...

3/13 12:7:30 [INFO] : Set active port in service stub: USZip : USZipSoap


Any thoughts?


David
[EMAIL PROTECTED]

___
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] And these [EMAIL PROTECTED] paths

2005-12-09 Thread David Stiller
The answer has already been given.  :)

Use a different Linkage id, because BoundingBox is alread taken.


David
[EMAIL PROTECTED]
"Luck is the residue of good design."


If you make time to answer these questions 2 times,
could you point me out of this in a way.
My 2nd post since no one seems te hear me.
see down.
Regards,
Latcho aka Stijn
> not just 'somewhere in your library', but it tells you exactly which 
> symbols they are:
>
> com/yellowjacketsoftware/ui/components/Flash UI Components 2/Component

> Assets/BoundingBox is the first one
>
> Flash UI Components 2/Component Assets/BoundingBox is the second one.
>
> The error seems pretty descriptive to me...
> "The linkage identifier 'BoundingBox' was already assigned to [1st MC]

> and cannot be assigned to [2nd MC], since linkage identifiers must be 
> unique."
>
> -David R

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


RE: [Flashcoders] Key down forces button/mc onRelease/onReleaseOutside

2005-11-03 Thread David Stiller
Actually, I was talking about movie clip based buttons.  :)  In my
testing, it is both movie clips and buttons (symbol buttons) that fire the
onRelease and onReleaseOutside when a key is pressed.

HOWEVER, I just learned this issue only occurs when you test the SWF
inside the IDE.  Good to know!


David
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David
Skoglund
Sent: Wednesday, November 02, 2005 9:44 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Key down forces button/mc
onRelease/onReleaseOutside


Sound like a similar problem to mine that I posted a couple of days ago. I 
got no replies i'm afraid.

I think I'll create some movie clip-based buttons instead, but havn't had 
time to test if movie clips show the same behaviour or not.

/David

-- attached message ---
Hi, I'm new to this list, heard about it from DirGames.

I have a problem with button components that annoys me a lot, it seems lika 
buttons auto-activate whenever I move the cursor over them and have either 
shift, control or alt pressed..? I really need to use those keys while 
dragging objects around the scene

Is there anyway to disable this behavior, or do you think I should I write 
my own components/button MC:s instead of using the default?

Thanks for any suggestions!

/David Skoglund


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


[Flashcoders] Key down forces button/mc onRelease/onReleaseOutside

2005-11-02 Thread David Stiller
Is anyone else seeing this?  Draw a shape, convert to button or mc.
Code the following:

btn.onPress = function() {
trace("pressed");
}
btn.onRelease = function() {
trace("released");
}
btn.onReleaseOutside = function() {
trace("released outside");
}

Click the symbol to see "pressed" in the Output panel.  Release, of
course, to see "released."

Now click again, but hold this time.  Now press any key.  If you're
over the symbol, you'll see "released," even though you haven't; if you're
not over the symbol, you'll see "released outside," even though you haven't.

This is a total bummer if you want to write a drawing app with Shift
constrain or Ctrl whatever.

Anyone know a workaround?


David
[EMAIL PROTECTED]
"Luck is the residue of good design."

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


[Flashcoders] [JSFL] beginDraw(true) seems to disobey document.viewMatrix

2005-10-28 Thread David Stiller
I begin to suspect that beginDraw(true), which leaves the drawing
layer's drawing intact, does not obey the document.viewMatrix as it should.
I'm writing a tool that uses the transformPoint() function in the
Peters/Yard Extension book to compensate for changes in the pen's location
in symbol timelines.  It works just fine during onMouseMove, but as soon as
onMouseUp fires, the drawing jumps to its previously un-transformed
location.

Has anyone else seen this?  The issue is present in both MX 2004 and
8.  Workarounds, thoughts?

A big thanks, btw, to JesterXL and Patrick Mineault for helping me
zero in on the likely culprit.


David
[EMAIL PROTECTED]
"Luck is the residue of good design."

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


RE: [Flashcoders] Macromedia unveiling Flex 2andFlash9 :communicationor cacophony ?

2005-10-19 Thread David Stiller
Jesse, thanks!

Ted's article nails exactly what I'm looking for.

This statement here -- > "The SWF contains just only what you import
and can be devoid of the Flex Framework," suggests to me I can avoid that
240KB initial hit right off the bat.  I realize that figure may drop with
optimization, but I believe you said earlier that even Flex 1.5 SWFs
(presumably optimized) start out at over 100KB.

I'm interested in leveraging the speed increases of AS3 and the new
virtual machine -- at least, gearing that way -- but I presently have little
interest in the UI Component (and other) benefits of the Flex framework.  If
my career veers in that direction, Flex is the obvious choice.  Meanwhile,
I'm delving into the mechanics of incorporating good, old fashioned, heavily
tweened movie clips into Flex-built, 8.5-Player SWFs via the ASProject
component of Flex Builder 2.

Any pointers?  Do I need to produce Components of all my artwork
(hope not!) ... can I use a runtime shared Library?


David
[EMAIL PROTECTED]




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of JesterXL
Sent: Wednesday, October 19, 2005 10:14 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Macromedia unveiling Flex 2andFlash9
:communicationor cacophony ?


BTW, more info David on ActionScript projects.
http://www.powersdk.com/ted/2005/10/flex2-actionscript-project.php

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


RE: [Flashcoders] Macromedia unveiling Flex 2 andFlash9 :communication or cacophony ?

2005-10-18 Thread David Stiller
> Go try it.  Build something small, and you'll be on
> board lickety-split.

Heh, you can't build *anything* yet less than 240KB!  :-p

Okay, now, chuckles aside ... Jesse, I know just from
subscribing to this list for a while that you're a long-time Flash dev,
in addition to being a Flex dev.

I played with Flex Builder 2 a bit today and I'll admit, for
RIA-type apps, this looks very, *very* promising.  Given what Flex seems
geared for, what's your take on how to use Flex Builder 2 for more
traditional (though heavily coded) movies?  That is, using FB2 only for
writing AS classes, and -- when the time comes -- possibly even using
the Flash IDE to publish?  I haven't toyed with it enough yet, but for
example, I don't see a way to create a project without also creating an
MXML document.  Of course, so far, I would *have* to use MXML, but when
Flash 9 arrives (possibly), I may not.

You addressed earlier the AA-like steps of Flex acceptance, and
among your points was the line every dev must draw in regard to the
types of apps s/he develops.  RIAs ... games?  Where is that line for
you?  Obivously, anyone else who wants to reply, please jump in!


David
[EMAIL PROTECTED]

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