Re: [Flashcoders] Question about AS3 components

2009-03-17 Thread David Hershberger
What class are you subclassing to make your component? UIComponent defines a protected measure() function which some other internals use to figure out how big a component is. Maybe you need to implement an override of that? The docs show InteractiveObject having a "focusRect" property, but they

Re: [Flashcoders] Advice on creating random grid of pairs for a game

2009-03-11 Thread David Hershberger
; >> then >> >> -1,-1,27 >> -1,01,04 >> -1,27,04 >> >> then >> >> -1,-1,27 >> -1,01,04 >> 01,27,04 >> >> then >> >> -1,36,27 >> -1,01,04 >> 01,27,04 >> >> then >> >> -1,36,2

Re: [Flashcoders] Advice on creating random grid of pairs for a game

2009-03-11 Thread David Hershberger
Jonathan, When you "match" a pair, you pull them off the grid. Therefore after removing the pair of 2s, there are only empty squares in the path between the 1s. Dave On Wed, Mar 11, 2009 at 10:43 AM, jonathan howe wrote: > Hi, Paul, > > Can you explain what you mean by a "clear path". > For ex

Re: [Flashcoders] where did the mouseX go?

2009-03-11 Thread David Hershberger
mouseX and mouseY are member variables of the Sprite class. You don't need to import member variables, only classes. Once you import the Sprite class, all the members come with it. replace your mouseX and mouseY imports with: import flash.display.Sprite; and you'll be golden. Dave On Wed, Ma

Re: [Flashcoders] Advice on creating random grid of pairs for a game

2009-03-11 Thread David Hershberger
My first thought for your algorithm is to essentially follow the solution path that your user might end up taking. Your user will be clearing areas out, opening them up. Your algorithm could start with an empty grid and fill in around a starting seed, growing the tile array outward. 1) empty gri

Re: [Flashcoders] AS3 - XML Filter by Date

2009-03-09 Thread David Hershberger
You can filter XML with arbitrary boolean functions, so the answer is definitely yes. See http://livedocs.adobe.com/flex/3/html/13_Working_with_XML_08.html#131880 One of the examples there shows XML stored in var x with a list of type elements, and you can use this syntax to get an XMLList of em

Re: [Flashcoders] RegExp headache

2009-03-05 Thread David Hershberger
oops, forgot about the comparison operator being optional. New version: /(((<|>)=?)|==)?(-?\d+)/ hot darn. Dave On Thu, Mar 5, 2009 at 10:44 AM, David Hershberger wrote: > How's this? > > /(((<|>)=?)|==)(-?\d+)/ > > Then the comparison operator is in result[1]

Re: [Flashcoders] RegExp headache

2009-03-05 Thread David Hershberger
How's this? /(((<|>)=?)|==)(-?\d+)/ Then the comparison operator is in result[1] and the number is in result[4]. You said "integer", so I threw in the optional negative sign. :) Dave On Thu, Mar 5, 2009 at 10:02 AM, Glen Pike wrote: > Hi, > > How about: > > /([=><]+)([0-9]+)/ > > Check

Re: [Flashcoders] FDT & SVN + Code Assist

2009-02-17 Thread David Hershberger
In Flex Builder, you can go into the "Flex Navigator" window (the tree-layout project-contents window), select a directory (like .svn), right-click it, choose "properties" from the resulting menu, then check the box which says "derived". Once you do that, I believe it will recognize that files in

Re: [Flashcoders] Best way to access my main class?

2009-02-05 Thread David Hershberger
My preference is usually option 3, using an event. It means you can use your ball in other situations, where that "call" back to the root may or may not be necessary. Regarding cleaning up references in event listeners, you can use a "weak reference" when you call addEventListener(). Also, I oft

Re: [Flashcoders] top down plane games

2009-01-26 Thread David Hershberger
I may be misunderstanding the trouble you are having, but are you looking for sine and cosine? var velocity: Number = 3; // Absolute velocity, regardless of direction speedX = velocity * Math.cos( cursorAngle ); // X component of velocity speedY = velocity * Math.sin( cursorAngle ); // Y component

Re: [Flashcoders] get "PROP" from obj.PROP

2009-01-09 Thread David Hershberger
private function assignContent( parentObject: *, memberName: String ): void is what your function needs to take, and you would call it like: assignContent( msg, "ONE" ); With assignContent( msg.ONE ) as you have it, the reference to the object stored in msg.ONE is read from msg before and only t

Re: [Flashcoders] ActionScript syntax enhancements?

2009-01-06 Thread David Hershberger
Dunno if you're going to implement [Bindable], which is I guess part of Flex, but if you do... https://bugs.adobe.com/jira/browse/SDK-14475 and https://bugs.adobe.com/jira/browse/SDK-9804 describe the fact that we can't use data-binding to watch the changes of read-only properties. This ability w

Re: [Flashcoders] Custom eventListener

2008-12-18 Thread David Hershberger
I use custom events mostly when I have data to pass through the event which doesn't fit nicely into some pre-defined one. For instance, we have a HighScoreEvent which has the number of points and the time it took to finish the game. Also, it is good practice to define your own Event subclass(es)

Re: [Flashcoders] Custom eventListener

2008-12-18 Thread David Hershberger
An event is just a message object. Just because one gets created successfully does not mean it is being delivered. dispatchEvent() is a method of the EventDispatcher class, which is a superclass of many classes, including DisplayObject. You need to listen for the event (with addEventListener())

Re: [Flashcoders] Re: A funny little hover problem with CSS

2008-12-15 Thread David Hershberger
We had a similar issue triggered by scaling. When we rescaled objects with Advanced Anti-Aliasing text, they wouldn't recompute their size properly and would truncate themselves with "..." at the end at some scales but not at others. We ended up just turning it off. It's true that it looks bette

Re: [Flashcoders] binary-coded image

2008-12-03 Thread David Hershberger
Also Flex supports PNG and JPEG: mx.graphics.codec.PNGEncoder and mx.graphics.code.JPEGEncoder. Dave On 12/3/08, Ian Thomas <[EMAIL PROTECTED]> wrote: > > If you mean 'how do I encode a bitmap into an image format' e.g. PNG > or JPEG, check out this library: > http://code.google.com/p/as3corelib/

Re: [Flashcoders] adding physics to pivot object around a point

2008-12-01 Thread David Hershberger
http://box2dflash.sourceforge.net/ Good stuff. Dave On 12/1/08, allandt bik-elliott (thefieldcomic.com) <[EMAIL PROTECTED]> wrote: > > hi guys > > could anyone point me in the right direction to do the following, please? > > I'd like an object that is dragged to correctly respond to being pulled

Re: [Flashcoders] passing on ... args

2008-11-28 Thread David Hershberger
Ooh! Ooh! I just wrote this a few days before you asked. Here's my solution: public function call( rpcName: String, responder: Responder, rpcArgs: Array ): void { // NetConnection.call() takes a variable number of arguments after the // RPC call

Re: [Flashcoders] get class by definition - or something like that

2008-11-20 Thread David Hershberger
You want ApplicationDomain.getDefinition(className: String) and also ApplicationDomain.hasDefinition(className: String) is handy. Dave On Thu, Nov 20, 2008 at 1:52 PM, Merrill, Jason < [EMAIL PROTECTED]> wrote: > Refersh my memory. What was the name of that AS3 class method to get a > class def

Re: [Flashcoders] frameworks and flash

2008-11-20 Thread David Hershberger
Actually, Cairngorm does allow arbitrary mappings from events to commands, it does not require 1-to-1. The FrontController's addCommand() function takes an event name (String) and a Command class. In our app I have used the same event with different name-constants to run different commands, like

Re: [Flashcoders] Flex vs. Flash

2008-11-19 Thread David Hershberger
If you are building an application-like user interface with buttons, forms, dialog boxes, etc, I would really recommend Flex. MXML lets you write such things very concisely. It has a powerful layout engine and a nice set of containers which automate a lot of stuff you'd have to write by hand othe

Re: [Flashcoders] frameworks and flash

2008-11-14 Thread David Hershberger
> > This should also be informative. > http://www.insideria.com/2008/11/new-poll-which-flex-framework.html > > > > On Fri, Nov 14, 2008 at 1:52 PM, David Hershberger <[EMAIL PROTECTED] > >wrote: > > > > We have been using Adobe Flex for the past year and have

Re: [Flashcoders] frameworks and flash

2008-11-14 Thread David Hershberger
We have been using Adobe Flex for the past year and have really liked it. It would be hard to call it "blazing" and "bloat" does seem like it might apply to some extent, but on the other hand it does so many nice things for us it is hard to argue with. MXML is very powerful, but there is certainly

[Flashcoders] AS3 text fitting in variable box

2008-11-12 Thread David Hershberger
escriptions on the web. Dave On 11/12/08, Latcho <[EMAIL PROTECTED]> wrote: > > Hi Joel, Jonathan anf Dave for your answers > Dave could you explain what you mean with a binary search ? > Stijn > > David Hershberger wrote: > > Text flow of variable-width fonts with

Re: [Flashcoders] AS3 text fitting in variable box

2008-11-12 Thread David Hershberger
Text flow of variable-width fonts with word-wrapping is inherently messy... there's no way to compute the number of lines with some nice math, you just have to run the text-flow machinery and measure the result, which is exactly what you have suggested. I'm pretty certain there is nothing built in

[Flashcoders] keyboard focus mouse button interaction

2008-11-11 Thread David Hershberger
Hi all, I ran into an issue with keyboard focus which I don't understand, and I don't see detailed in the docs anywhere. We have a site that has games in it as well as forms, so sometimes we want game-style key handling and sometimes we want the form style, where tab or mouse clicks change focus.